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

akonadi

  • sources
  • kde-4.12
  • kdepimlibs
  • 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 class AgentTypeDialog::Private
33 {
34  public:
35  Private(AgentTypeDialog *qq)
36  : q(qq)
37  {
38 
39  }
40  void readConfig();
41  void writeConfig();
42  AgentTypeWidget *Widget;
43  AgentType agentType;
44  AgentTypeDialog *q;
45 };
46 
47 void AgentTypeDialog::Private::writeConfig()
48 {
49  KConfigGroup group( KGlobal::config(), "AgentTypeDialog" );
50  group.writeEntry( "Size", q->size() );
51 }
52 
53 void AgentTypeDialog::Private::readConfig()
54 {
55  KConfigGroup group( KGlobal::config(), "AgentTypeDialog" );
56  const QSize sizeDialog = group.readEntry( "Size", QSize(460, 320) );
57  if ( sizeDialog.isValid() ) {
58  q->resize( sizeDialog );
59  }
60 }
61 
62 AgentTypeDialog::AgentTypeDialog( QWidget *parent )
63  : KDialog( parent ), d( new Private(this) )
64 {
65  setButtons( Ok | Cancel );
66  QVBoxLayout *layout = new QVBoxLayout( mainWidget() );
67  layout->setMargin( 0 );
68 
69  d->Widget = new Akonadi::AgentTypeWidget( mainWidget() );
70  connect( d->Widget, SIGNAL(activated()), this, SLOT(accept()) );
71 
72  KFilterProxySearchLine* searchLine = new KFilterProxySearchLine( mainWidget() );
73  layout->addWidget( searchLine );
74  searchLine->setProxy( d->Widget->agentFilterProxyModel() );
75 
76  layout->addWidget( d->Widget );
77 
78  connect( this, SIGNAL(okClicked()), this, SLOT(accept()) );
79 
80  d->readConfig();
81 
82  searchLine->lineEdit()->setFocus();
83 }
84 
85 AgentTypeDialog::~AgentTypeDialog()
86 {
87  d->writeConfig();
88  delete d;
89 }
90 
91 void AgentTypeDialog::done( int result )
92 {
93  if ( result == Accepted ) {
94  d->agentType = d->Widget->currentAgentType();
95  } else {
96  d->agentType = AgentType();
97  }
98 
99  KDialog::done( result );
100 }
101 
102 AgentType AgentTypeDialog::agentType() const
103 {
104  return d->agentType;
105 }
106 
107 AgentFilterProxyModel* AgentTypeDialog::agentFilterProxyModel() const
108 {
109  return d->Widget->agentFilterProxyModel();
110 }
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:102
Akonadi::AgentTypeDialog::AgentTypeDialog
AgentTypeDialog(QWidget *parent=0)
Creates a new agent type dialog.
Definition: agenttypedialog.cpp:62
Akonadi::AgentTypeDialog::~AgentTypeDialog
~AgentTypeDialog()
Destroys the agent type dialog.
Definition: agenttypedialog.cpp:85
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:107
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 Tue Oct 14 2014 23:00:26 by doxygen 1.8.7 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 API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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