akonadi/clients
kabceditor.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "kabceditor.h"
00023
00024 #include <QtGui/QGridLayout>
00025 #include <QtGui/QLabel>
00026 #include <QtGui/QLineEdit>
00027 #include <QtGui/QPushButton>
00028
00029 #include <akonadi/item.h>
00030 #include <kapplication.h>
00031 #include <kcmdlineargs.h>
00032
00033 #include "kabc/kabcitemeditor.h"
00034
00035 Dialog::Dialog( QWidget *parent )
00036 : KDialog( parent )
00037 {
00038 setCaption( "Contact Editor" );
00039 setButtons( Close );
00040
00041 showButtonSeparator( true );
00042
00043 QWidget *wdg = new QWidget( this );
00044 QGridLayout *layout = new QGridLayout( wdg );
00045
00046 mEditor = new Akonadi::KABCItemEditor( Akonadi::KABCItemEditor::EditMode, wdg );
00047 layout->addWidget( mEditor, 0, 0, 1, 3 );
00048
00049 QLabel *label = new QLabel( "Item Id:", wdg );
00050 layout->addWidget( label, 1, 0 );
00051
00052 mId = new QLineEdit( wdg );
00053 layout->addWidget( mId, 1, 1 );
00054
00055 QPushButton *button = new QPushButton( "Load", wdg );
00056 layout->addWidget( button, 1, 2 );
00057
00058 connect( button, SIGNAL( clicked() ), SLOT( load() ) );
00059
00060 button = new QPushButton( "Save", wdg );
00061 layout->addWidget( button, 2, 2 );
00062
00063 connect( button, SIGNAL( clicked() ), SLOT( save() ) );
00064
00065 setMainWidget( wdg );
00066 }
00067
00068 Dialog::~Dialog()
00069 {
00070 }
00071
00072 void Dialog::load()
00073 {
00074 mEditor->loadContact( Akonadi::Item( mId->text().toLongLong() ) );
00075 }
00076
00077 void Dialog::save()
00078 {
00079 mEditor->saveContact();
00080 }
00081
00082 int main( int argc, char **argv )
00083 {
00084 KCmdLineArgs::init( argc, argv, "kabceditor", 0, ki18n("KABC Editor"), "1.0" , ki18n("A contact editor for Akonadi"));
00085 KApplication app;
00086
00087 Dialog dlg;
00088 dlg.exec();
00089
00090 return 0;
00091 }
00092
00093 #include "kabceditor.moc"