• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 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
29using namespace Akonadi;
30
31class AgentTypeDialog::Private
32{
33public:
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
46void AgentTypeDialog::Private::writeConfig()
47{
48 KConfigGroup group(KGlobal::config(), "AgentTypeDialog");
49 group.writeEntry("Size", q->size());
50}
51
52void 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
61AgentTypeDialog::AgentTypeDialog(QWidget *parent)
62 : KDialog(parent)
63 , 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
85AgentTypeDialog::~AgentTypeDialog()
86{
87 d->writeConfig();
88 delete d;
89}
90
91void 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
102AgentType AgentTypeDialog::agentType() const
103{
104 return d->agentType;
105}
106
107AgentFilterProxyModel *AgentTypeDialog::agentFilterProxyModel() const
108{
109 return d->Widget->agentFilterProxyModel();
110}
Akonadi::AgentFilterProxyModel
A proxy model for filtering AgentType or AgentInstance.
Definition agentfilterproxymodel.h:53
Akonadi::AgentTypeDialog
A dialog to select an available agent type.
Definition agenttypedialog.h:54
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::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:61
Akonadi::AgentTypeDialog::~AgentTypeDialog
~AgentTypeDialog()
Destroys the agent type dialog.
Definition agenttypedialog.cpp:85
Akonadi::AgentTypeWidget
Provides a widget that lists all available agent types.
Definition agenttypewidget.h:53
Akonadi::AgentType
A representation of an agent type.
Definition agenttype.h:59
Akonadi
FreeBusyManager::Singleton.
Definition actionstatemanager_p.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 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
  • Related Pages

kdepimlibs-4.14.10 API Reference

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