akonadi
agenttypedialog.cpp
00001 /* 00002 Copyright (c) 2006 Tobias Koenig <tokoe@kde.org> 00003 Copyright (c) 2008 Omat Holding B.V. <info@omat.nl> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #include "agenttypedialog.h" 00020 #include "agentfilterproxymodel.h" 00021 00022 #include <QObject> 00023 #include <QtGui/QVBoxLayout> 00024 00025 #include <kdeversion.h> 00026 00027 #include <kfilterproxysearchline.h> 00028 #include <klineedit.h> 00029 00030 using namespace Akonadi; 00031 00032 00033 class AgentTypeDialog::Private 00034 { 00035 public: 00036 AgentTypeWidget *Widget; 00037 AgentType agentType; 00038 }; 00039 00040 AgentTypeDialog::AgentTypeDialog( QWidget *parent ) 00041 : KDialog( parent ), d( new Private ) 00042 { 00043 setButtons( Ok | Cancel ); 00044 QVBoxLayout *layout = new QVBoxLayout( mainWidget() ); 00045 layout->setMargin(0); 00046 00047 d->Widget = new Akonadi::AgentTypeWidget( mainWidget() ); 00048 connect( d->Widget, SIGNAL(activated()), this, SLOT(accept()) ); 00049 00050 KFilterProxySearchLine* searchLine = new KFilterProxySearchLine( mainWidget() ); 00051 layout->addWidget( searchLine ); 00052 searchLine->setProxy( d->Widget->agentFilterProxyModel() ); 00053 00054 layout->addWidget( d->Widget ); 00055 00056 connect( this, SIGNAL(okClicked()), this, SLOT(accept()) ); 00057 00058 resize( 460, 320 ); 00059 00060 searchLine->lineEdit()->setFocus(); 00061 } 00062 00063 AgentTypeDialog::~AgentTypeDialog() 00064 { 00065 delete d; 00066 } 00067 00068 void AgentTypeDialog::done( int result ) 00069 { 00070 if ( result == Accepted ) 00071 d->agentType = d->Widget->currentAgentType(); 00072 else 00073 d->agentType = AgentType(); 00074 00075 KDialog::done( result ); 00076 } 00077 00078 AgentType AgentTypeDialog::agentType() const 00079 { 00080 return d->agentType; 00081 } 00082 00083 AgentFilterProxyModel* AgentTypeDialog::agentFilterProxyModel() const 00084 { 00085 return d->Widget->agentFilterProxyModel(); 00086 } 00087 00088 #include "agenttypedialog.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:18:30 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:18:30 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.