~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

« back to all changes in this revision

Viewing changes to akonadi/migration/kres/infodialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi, Alessandro Ghersi, Harald Sitter
  • Date: 2009-06-27 04:40:05 UTC
  • mfrom: (1.1.39 upstream)
  • Revision ID: james.westby@ubuntu.com-20090627044005-4y2vm9xz7rvmzi4p
Tags: 4:4.2.95svn20090701-0ubuntu1
[ Alessandro Ghersi ]
* New upstream release
  - Bump build-deps
* Remove akonadi-kde and libmaildir4 packages
  - remove akonadi-kde.install and libmaildir4.install
  - remove libmaildir4 from debian/rules
  - remove akonadi-kde and libmaildir4 from depends
  - remove akonadi-kde and libmaildir4 from installgen
* Update kdepim-dev.install
* Update kpilot.install
* Add akonadi-kde and libmaildir4 transitional packages

[ Harald Sitter ]
* KAddressbook replaces Kontact << 4.2.85 (LP: #378373)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2008 Volker Krause <vkrause@kde.org>
 
3
 
 
4
    This library is free software; you can redistribute it and/or modify it
 
5
    under the terms of the GNU Library General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or (at your
 
7
    option) any later version.
 
8
 
 
9
    This library is distributed in the hope that it will be useful, but WITHOUT
 
10
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
 
12
    License for more details.
 
13
 
 
14
    You should have received a copy of the GNU Library General Public License
 
15
    along with this library; see the file COPYING.LIB.  If not, write to the
 
16
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
17
    02110-1301, USA.
 
18
*/
 
19
 
 
20
#include "infodialog.h"
 
21
 
 
22
#include <KDebug>
 
23
#include <KGlobal>
 
24
 
 
25
#include <QListWidget>
 
26
 
 
27
InfoDialog::InfoDialog( bool closeWhenDone ) :
 
28
    mMigratorCount( 0 ),
 
29
    mError( false ),
 
30
    mChange( false ),
 
31
    mCloseWhenDone( closeWhenDone )
 
32
{
 
33
  KGlobal::ref();
 
34
  setButtons( Close );
 
35
  enableButton( Close, false );
 
36
  mList = new QListWidget( this );
 
37
  mList->setMinimumWidth( 640 );
 
38
  setMainWidget( mList );
 
39
 
 
40
  connect( this, SIGNAL(closeClicked()), SLOT(deleteLater()) );
 
41
}
 
42
 
 
43
InfoDialog::~InfoDialog()
 
44
{
 
45
  KGlobal::deref();
 
46
}
 
47
 
 
48
void InfoDialog::message(KResMigratorBase::MessageType type, const QString & msg)
 
49
{
 
50
  QListWidgetItem *item = new QListWidgetItem( msg, mList );
 
51
  switch ( type ) {
 
52
    case KResMigratorBase::Success:
 
53
      item->setIcon( KIcon( "dialog-ok-apply" ) );
 
54
      mChange = true;
 
55
      kDebug() << msg;
 
56
      break;
 
57
    case KResMigratorBase::Skip:
 
58
      item->setIcon( KIcon( "dialog-ok" ) );
 
59
      kDebug() << msg;
 
60
      break;
 
61
    case KResMigratorBase::Info:
 
62
      item->setIcon( KIcon( "dialog-information" ) );
 
63
      kDebug() << msg;
 
64
      break;
 
65
    case KResMigratorBase::Error:
 
66
      item->setIcon( KIcon( "dialog-error" ) );
 
67
      mError = true;
 
68
      kError() << msg;
 
69
      break;
 
70
    default:
 
71
      kError() << "WTF?";
 
72
  }
 
73
}
 
74
 
 
75
void InfoDialog::migratorAdded()
 
76
{
 
77
  ++mMigratorCount;
 
78
}
 
79
 
 
80
void InfoDialog::migratorDone()
 
81
{
 
82
  --mMigratorCount;
 
83
  if ( mMigratorCount == 0 ) {
 
84
    enableButton( Close, true );
 
85
    if ( mCloseWhenDone && !hasError() && !hasChange() )
 
86
      emit closeClicked();
 
87
  }
 
88
}