~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

« back to all changes in this revision

Viewing changes to akonadi/clients/kabc/kabceditor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christian Mangold
  • Date: 2009-07-10 06:34:50 UTC
  • mfrom: (1.1.40 upstream)
  • Revision ID: james.westby@ubuntu.com-20090710063450-neojgew2fh0n3y0u
Tags: 4:4.2.96-0ubuntu1
* New upstream release
* Bump kde build-deps to 4.2.96

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
    This file is part of Akonadi.
3
 
 
4
 
    Copyright (c) 2007 Tobias Koenig <tokoe@kde.org>
5
 
 
6
 
    This program is free software; you can redistribute it and/or modify
7
 
    it under the terms of the GNU General Public License as published by
8
 
    the Free Software Foundation; either version 2 of the License, or
9
 
    (at your option) any later version.
10
 
 
11
 
    This program is distributed in the hope that it will be useful,
12
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 
    GNU General Public License for more details.
15
 
 
16
 
    You should have received a copy of the GNU General Public License
17
 
    along with this program; if not, write to the Free Software
18
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19
 
    USA.
20
 
*/
21
 
 
22
 
#include "kabceditor.h"
23
 
 
24
 
#include <QtGui/QGridLayout>
25
 
#include <QtGui/QLabel>
26
 
#include <QtGui/QLineEdit>
27
 
#include <QtGui/QPushButton>
28
 
 
29
 
#include <akonadi/item.h>
30
 
#include <kapplication.h>
31
 
#include <kcmdlineargs.h>
32
 
 
33
 
#include "kabc/kabcitemeditor.h"
34
 
 
35
 
Dialog::Dialog( QWidget *parent )
36
 
  : KDialog( parent )
37
 
{
38
 
  setCaption( "Contact Editor" );
39
 
  setButtons( Close );
40
 
 
41
 
  showButtonSeparator( true );
42
 
 
43
 
  QWidget *wdg = new QWidget( this );
44
 
  QGridLayout *layout = new QGridLayout( wdg );
45
 
 
46
 
  mEditor = new Akonadi::KABCItemEditor( Akonadi::KABCItemEditor::EditMode, wdg );
47
 
  layout->addWidget( mEditor, 0, 0, 1, 3 );
48
 
 
49
 
  QLabel *label = new QLabel( "Item Id:", wdg );
50
 
  layout->addWidget( label, 1, 0 );
51
 
 
52
 
  mId = new QLineEdit( wdg );
53
 
  layout->addWidget( mId, 1, 1 );
54
 
 
55
 
  QPushButton *button = new QPushButton( "Load", wdg );
56
 
  layout->addWidget( button, 1, 2 );
57
 
 
58
 
  connect( button, SIGNAL( clicked() ), SLOT( load() ) );
59
 
 
60
 
  button = new QPushButton( "Save", wdg );
61
 
  layout->addWidget( button, 2, 2 );
62
 
 
63
 
  connect( button, SIGNAL( clicked() ), SLOT( save() ) );
64
 
 
65
 
  setMainWidget( wdg );
66
 
}
67
 
 
68
 
Dialog::~Dialog()
69
 
{
70
 
}
71
 
 
72
 
void Dialog::load()
73
 
{
74
 
  mEditor->loadContact( Akonadi::Item( mId->text().toLongLong() ) );
75
 
}
76
 
 
77
 
void Dialog::save()
78
 
{
79
 
  mEditor->saveContact();
80
 
}
81
 
 
82
 
int main( int argc, char **argv )
83
 
{
84
 
  KCmdLineArgs::init( argc, argv, "kabceditor", 0, ki18n("KABC Editor"), "1.0" , ki18n("A contact editor for Akonadi"));
85
 
  KApplication app;
86
 
 
87
 
  Dialog dlg;
88
 
  dlg.exec();
89
 
 
90
 
  return 0;
91
 
}
92
 
 
93
 
#include "kabceditor.moc"