akonadi/clients
kabcviewer.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 "kabcviewer.h"
00023
00024 #include <QtGui/QVBoxLayout>
00025
00026 #include <kapplication.h>
00027 #include <kcmdlineargs.h>
00028 #include <klocale.h>
00029
00030 #include "kabc/kabcitembrowser.h"
00031
00032 Dialog::Dialog( QWidget *parent )
00033 : KDialog( parent )
00034 {
00035 setCaption( "Contact Viewer" );
00036 setButtons( Close );
00037 showButtonSeparator( true );
00038
00039 QWidget *wdg = new QWidget( this );
00040 QVBoxLayout *layout = new QVBoxLayout( wdg );
00041
00042 mBrowser = new Akonadi::KABCItemBrowser( wdg );
00043 layout->addWidget( mBrowser );
00044
00045 setMainWidget( wdg );
00046
00047 resize( 520, 580 );
00048 }
00049
00050 Dialog::~Dialog()
00051 {
00052 }
00053
00054 void Dialog::loadUid( Akonadi::Item::Id uid )
00055 {
00056 mBrowser->setItem( Akonadi::Item( uid ) );
00057 }
00058
00059 int main( int argc, char **argv )
00060 {
00061 KCmdLineArgs::init( argc, argv, "kabcviewer", 0, ki18n("KABC Viewer"), "1.0" , ki18n("A contact viewer for Akonadi"));
00062
00063 KCmdLineOptions options;
00064 options.add("uid <uid>", ki18n( "Uid of the Akonadi contact" ));
00065 KCmdLineArgs::addCmdLineOptions( options );
00066 KApplication app;
00067
00068 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00069
00070 Dialog dlg;
00071 if ( !args->isSet( "uid" ) ) {
00072 KCmdLineArgs::usage();
00073 return 1;
00074 }
00075
00076 dlg.loadUid( args->getOption( "uid" ).toLongLong() );
00077 dlg.exec();
00078
00079 return 0;
00080 }
00081
00082 #include "kabcviewer.moc"