~ubuntu-branches/ubuntu/raring/kdepim/raring-proposed

« back to all changes in this revision

Viewing changes to akonadiconsole/agentwidget.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-06-07 07:56:38 UTC
  • mfrom: (0.2.27)
  • Revision ID: package-import@ubuntu.com-20120607075638-0luhdq11z7sgvs4m
Tags: 4:4.8.80-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include <KMessageBox>
35
35
#include <KStandardDirs>
36
36
#include <KStandardGuiItem>
 
37
#include <KTextEdit>
37
38
 
38
39
#include <QtCore/QFile>
 
40
#include <QtCore/QPointer>
39
41
#include <QtGui/QGridLayout>
40
42
#include <QtGui/QMenu>
41
43
#include <QtGui/QPushButton>
42
 
#include <QtGui/QTextEdit>
43
44
#include <QDBusInterface>
44
45
#include <QDBusMessage>
45
46
#include <QDBusReply>
55
56
    {
56
57
      setButtons( Ok );
57
58
 
58
 
      mText = new QTextEdit;
 
59
      mText = new KTextEdit;
59
60
      mText->setReadOnly(true);
60
61
      setMainWidget( mText );
61
62
      setInitialSize( QSize( 400, 600 ) );
67
68
    }
68
69
 
69
70
  private:
70
 
    QTextEdit *mText;
 
71
    KTextEdit *mText;
71
72
};
72
73
 
73
74
using namespace Akonadi;
119
120
 
120
121
void AgentWidget::addAgent()
121
122
{
122
 
  Akonadi::AgentTypeDialog dlg( this );
123
 
  if ( dlg.exec() ) {
124
 
    const AgentType agentType = dlg.agentType();
 
123
  QPointer<Akonadi::AgentTypeDialog> dlg = new Akonadi::AgentTypeDialog( this );
 
124
  if ( dlg->exec() ) {
 
125
    const AgentType agentType = dlg->agentType();
125
126
 
126
127
    if ( agentType.isValid() ) {
127
128
      AgentInstanceCreateJob *job = new AgentInstanceCreateJob( agentType, this );
129
130
      job->start(); // TODO: check result
130
131
    }
131
132
  }
 
133
  delete dlg;
132
134
}
133
135
 
134
136
void AgentWidget::selectionChanged()
193
195
{
194
196
  AgentInstance agent = ui.instanceWidget->currentAgentInstance();
195
197
  if ( agent.isValid() ) {
196
 
    AgentConfigDialog dlg( this );
197
 
    dlg.setAgentInstance( agent );
198
 
    dlg.exec();
 
198
    QPointer<AgentConfigDialog> dlg = new AgentConfigDialog( this );
 
199
    dlg->setAgentInstance( agent );
 
200
    dlg->exec();
 
201
    delete dlg;
199
202
  }
200
203
}
201
204
 
231
234
    txt = reply.error().message();
232
235
  }
233
236
 
234
 
  TextDialog dlg( this );
235
 
  dlg.setCaption( QLatin1String( "Resource Task List" ) );
236
 
  dlg.setText( txt );
237
 
  dlg.exec();
 
237
  QPointer<TextDialog> dlg = new TextDialog( this );
 
238
  dlg->setCaption( QLatin1String( "Resource Task List" ) );
 
239
  dlg->setText( txt );
 
240
  dlg->exec();
 
241
  delete dlg;
238
242
}
239
243
 
240
244
void AgentWidget::showChangeNotifications()
254
258
    txt = reply.error().message();
255
259
  }
256
260
 
257
 
  TextDialog dlg( this );
258
 
  dlg.setCaption( QLatin1String( "Change Notification Log" ) );
259
 
  dlg.setText( txt );
 
261
  QPointer<TextDialog> dlg = new TextDialog( this );
 
262
  dlg->setCaption( QLatin1String( "Change Notification Log" ) );
 
263
  dlg->setText( txt );
260
264
 
261
 
  dlg.exec();
 
265
  dlg->exec();
 
266
  delete dlg;
262
267
}
263
268
 
264
269
void AgentWidget::synchronizeTree()
366
371
    QString onlineStatus = ( instance.isOnline() ? i18n( "Online" ) : i18n( "Offline" ) );
367
372
    QString agentStatus;
368
373
    switch( instance.status() ) {
369
 
      case AgentInstance::Idle: agentStatus = i18n( "Idle" ); break;
370
 
      case AgentInstance::Running: agentStatus = i18n( "Running (%1%)", instance.progress() ); break;
371
 
      case AgentInstance::Broken: agentStatus = i18n( "Broken" ); break;
 
374
    case AgentInstance::Idle: agentStatus =
 
375
        i18nc( "agent is in an idle state", "Idle" );
 
376
      break;
 
377
    case AgentInstance::Running: agentStatus =
 
378
        i18nc( "agent is running", "Running (%1%)", instance.progress() );
 
379
      break;
 
380
    case AgentInstance::Broken: agentStatus =
 
381
        i18nc( "agent is broken somehow", "Broken" );
 
382
      break;
372
383
    }
373
 
    ui.statusLabel->setText( i18nc( "Two statuses, for example \"Online, Running (66%)\" or \"Offline, Broken\"",
374
 
          "%1, %2", onlineStatus, agentStatus ) );
 
384
    ui.statusLabel->setText(
 
385
      i18nc( "Two statuses, for example \"Online, Running (66%)\" or \"Offline, Broken\"",
 
386
             "%1, %2", onlineStatus, agentStatus ) );
375
387
    ui.statusMessageLabel->setText( instance.statusMessage() );
376
388
    ui.capabilitiesLabel->setText( instance.type().capabilities().join( ", " ) );
377
389
    ui.mimeTypeLabel->setText( instance.type().mimeTypes().join( ", " ) );