~ubuntu-branches/ubuntu/trusty/kdepimlibs/trusty

« back to all changes in this revision

Viewing changes to akonadi/contact/contactviewerdialog.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-09-30 14:20:53 UTC
  • mfrom: (1.1.101)
  • Revision ID: package-import@ubuntu.com-20130930142053-k66oi27s75lt8l51
Tags: 4:4.11.2-0ubuntu1
New upstream bugfix release

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
*/
21
21
 
22
22
#include "contactviewerdialog.h"
23
 
 
24
23
#include "contactviewer.h"
 
24
#include "contactdefaultactions.h"
25
25
 
26
26
#include <akonadi/item.h>
27
 
#include <klocalizedstring.h>
 
27
using namespace Akonadi;
 
28
 
 
29
#include <KConfig>
 
30
#include <KLocalizedString>
28
31
 
29
32
#include <QVBoxLayout>
30
33
 
31
 
using namespace Akonadi;
32
 
 
33
34
class ContactViewerDialog::Private
34
35
{
35
36
  public:
 
37
    Private( ContactViewerDialog *parent )
 
38
      : q( parent )
 
39
    {
 
40
    }
 
41
 
 
42
    void readConfig()
 
43
    {
 
44
      KConfig config( QLatin1String( "akonadi_contactrc" ) );
 
45
      KConfigGroup group( &config, QLatin1String( "ContactViewer" ) );
 
46
      const QSize size = group.readEntry( "Size", QSize() );
 
47
      if ( size.isValid() ) {
 
48
        q->resize( size );
 
49
      } else {
 
50
        q->resize( 500, 600 );
 
51
      }
 
52
    }
 
53
 
 
54
    void writeConfig()
 
55
    {
 
56
      KConfig config( QLatin1String( "akonadi_contactrc" ) );
 
57
      KConfigGroup group( &config, QLatin1String( "ContactViewer" ) );
 
58
      group.writeEntry( "Size", q->size() );
 
59
      group.sync();
 
60
    }
 
61
 
 
62
    ContactViewerDialog *q;
36
63
    ContactViewer *mViewer;
37
64
};
38
65
 
39
66
ContactViewerDialog::ContactViewerDialog( QWidget *parent )
40
 
  : KDialog( parent ), d( new Private )
 
67
  : KDialog( parent ), d( new Private( this ) )
41
68
{
42
69
  setCaption( i18n( "Show Contact" ) );
43
70
  setButtons( Ok );
50
77
  d->mViewer = new ContactViewer;
51
78
  layout->addWidget( d->mViewer );
52
79
 
53
 
  setInitialSize( QSize( 500, 600 ) );
 
80
  ContactDefaultActions *actions = new ContactDefaultActions( this );
 
81
  actions->connectToView( d->mViewer );
 
82
 
 
83
  d->readConfig();
54
84
}
55
85
 
56
86
ContactViewerDialog::~ContactViewerDialog()
57
87
{
 
88
  d->writeConfig();
58
89
  delete d;
59
90
}
60
91