• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.11.5 API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • akonadi
agenttypedialog.cpp
1 /*
2  Copyright (c) 2006 Tobias Koenig <tokoe@kde.org>
3  Copyright (c) 2008 Omat Holding B.V. <info@omat.nl>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #include "agenttypedialog.h"
20 #include "agentfilterproxymodel.h"
21 
22 #include <QObject>
23 #include <QVBoxLayout>
24 
25 #include <kdeversion.h>
26 
27 #include <kfilterproxysearchline.h>
28 #include <klineedit.h>
29 
30 using namespace Akonadi;
31 
32 
33 class AgentTypeDialog::Private
34 {
35  public:
36  Private(AgentTypeDialog *qq)
37  : q(qq)
38  {
39 
40  }
41  void readConfig();
42  void writeConfig();
43  AgentTypeWidget *Widget;
44  AgentType agentType;
45  AgentTypeDialog *q;
46 };
47 
48 void AgentTypeDialog::Private::writeConfig()
49 {
50  KConfigGroup group( KGlobal::config(), "AgentTypeDialog" );
51  group.writeEntry( "Size", q->size() );
52 }
53 
54 void AgentTypeDialog::Private::readConfig()
55 {
56  KConfigGroup group( KGlobal::config(), "AgentTypeDialog" );
57  const QSize sizeDialog = group.readEntry( "Size", QSize(460, 320) );
58  if ( sizeDialog.isValid() ) {
59  q->resize( sizeDialog );
60  }
61 }
62 
63 AgentTypeDialog::AgentTypeDialog( QWidget *parent )
64  : KDialog( parent ), d( new Private(this) )
65 {
66  setButtons( Ok | Cancel );
67  QVBoxLayout *layout = new QVBoxLayout( mainWidget() );
68  layout->setMargin( 0 );
69 
70  d->Widget = new Akonadi::AgentTypeWidget( mainWidget() );
71  connect( d->Widget, SIGNAL(activated()), this, SLOT(accept()) );
72 
73  KFilterProxySearchLine* searchLine = new KFilterProxySearchLine( mainWidget() );
74  layout->addWidget( searchLine );
75  searchLine->setProxy( d->Widget->agentFilterProxyModel() );
76 
77  layout->addWidget( d->Widget );
78 
79  connect( this, SIGNAL(okClicked()), this, SLOT(accept()) );
80 
81  d->readConfig();
82 
83  searchLine->lineEdit()->setFocus();
84 }
85 
86 AgentTypeDialog::~AgentTypeDialog()
87 {
88  d->writeConfig();
89  delete d;
90 }
91 
92 void AgentTypeDialog::done( int result )
93 {
94  if ( result == Accepted ) {
95  d->agentType = d->Widget->currentAgentType();
96  } else {
97  d->agentType = AgentType();
98  }
99 
100  KDialog::done( result );
101 }
102 
103 AgentType AgentTypeDialog::agentType() const
104 {
105  return d->agentType;
106 }
107 
108 AgentFilterProxyModel* AgentTypeDialog::agentFilterProxyModel() const
109 {
110  return d->Widget->agentFilterProxyModel();
111 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Thu Jan 9 2014 17:55:04 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs-4.11.5 API Reference

Skip menu "kdepimlibs-4.11.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal