• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.13.3 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 <QVBoxLayout>
23 #include <KGlobal>
24 #include <KConfig>
25 
26 #include <kfilterproxysearchline.h>
27 #include <klineedit.h>
28 
29 using namespace Akonadi;
30 
31 class AgentTypeDialog::Private
32 {
33  public:
34  Private(AgentTypeDialog *qq)
35  : q(qq)
36  {
37 
38  }
39  void readConfig();
40  void writeConfig();
41  AgentTypeWidget *Widget;
42  AgentType agentType;
43  AgentTypeDialog *q;
44 };
45 
46 void AgentTypeDialog::Private::writeConfig()
47 {
48  KConfigGroup group( KGlobal::config(), "AgentTypeDialog" );
49  group.writeEntry( "Size", q->size() );
50 }
51 
52 void AgentTypeDialog::Private::readConfig()
53 {
54  KConfigGroup group( KGlobal::config(), "AgentTypeDialog" );
55  const QSize sizeDialog = group.readEntry( "Size", QSize(460, 320) );
56  if ( sizeDialog.isValid() ) {
57  q->resize( sizeDialog );
58  }
59 }
60 
61 AgentTypeDialog::AgentTypeDialog( QWidget *parent )
62  : KDialog( parent ), d( new Private(this) )
63 {
64  setButtons( Ok | Cancel );
65  QVBoxLayout *layout = new QVBoxLayout( mainWidget() );
66  layout->setMargin( 0 );
67 
68  d->Widget = new Akonadi::AgentTypeWidget( mainWidget() );
69  connect( d->Widget, SIGNAL(activated()), this, SLOT(accept()) );
70 
71  KFilterProxySearchLine* searchLine = new KFilterProxySearchLine( mainWidget() );
72  layout->addWidget( searchLine );
73  searchLine->setProxy( d->Widget->agentFilterProxyModel() );
74 
75  layout->addWidget( d->Widget );
76 
77  connect( this, SIGNAL(okClicked()), this, SLOT(accept()) );
78 
79  d->readConfig();
80 
81  searchLine->lineEdit()->setFocus();
82 }
83 
84 AgentTypeDialog::~AgentTypeDialog()
85 {
86  d->writeConfig();
87  delete d;
88 }
89 
90 void AgentTypeDialog::done( int result )
91 {
92  if ( result == Accepted ) {
93  d->agentType = d->Widget->currentAgentType();
94  } else {
95  d->agentType = AgentType();
96  }
97 
98  KDialog::done( result );
99 }
100 
101 AgentType AgentTypeDialog::agentType() const
102 {
103  return d->agentType;
104 }
105 
106 AgentFilterProxyModel* AgentTypeDialog::agentFilterProxyModel() const
107 {
108  return d->Widget->agentFilterProxyModel();
109 }
Akonadi::AgentTypeWidget
Provides a widget that lists all available agent types.
Definition: agenttypewidget.h:52
Akonadi::AgentType
A representation of an agent type.
Definition: agenttype.h:58
Akonadi::AgentTypeDialog::agentType
AgentType agentType() const
Returns the agent type that was selected by the user, or an empty agent type object if no agent type ...
Definition: agenttypedialog.cpp:101
Akonadi::AgentTypeDialog::AgentTypeDialog
AgentTypeDialog(QWidget *parent=0)
Creates a new agent type dialog.
Definition: agenttypedialog.cpp:61
Akonadi::AgentTypeDialog::~AgentTypeDialog
~AgentTypeDialog()
Destroys the agent type dialog.
Definition: agenttypedialog.cpp:84
Akonadi::AgentTypeDialog::agentFilterProxyModel
AgentFilterProxyModel * agentFilterProxyModel() const
Returns the agent filter proxy model that can be used to filter the agent types that shall be shown i...
Definition: agenttypedialog.cpp:106
Akonadi::AgentFilterProxyModel
A proxy model for filtering AgentType or AgentInstance.
Definition: agentfilterproxymodel.h:52
Akonadi::AgentTypeDialog
A dialog to select an available agent type.
Definition: agenttypedialog.h:53
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Mon Jul 21 2014 08:03:50 by doxygen 1.8.6 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.13.3 API Reference

Skip menu "kdepimlibs-4.13.3 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