KCal Library
confirmsavedialog.cpp
00001 /* 00002 This file is part of the kcal library. 00003 00004 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #include "confirmsavedialog.h" 00023 00024 #include <klocale.h> 00025 00026 #include <QtGui/QBoxLayout> 00027 #include <QtGui/QLabel> 00028 #include <QtGui/QVBoxLayout> 00029 #include <QtGui/QTreeWidget> 00030 00031 using namespace KCal; 00032 00037 //@cond PRIVATE 00038 class KCal::ConfirmSaveDialog::Private 00039 { 00040 public: 00041 Private() 00042 {} 00043 QTreeWidget *mListView; 00044 }; 00045 //@endcond 00046 00047 ConfirmSaveDialog::ConfirmSaveDialog( const QString &destination, 00048 QWidget *parent ) 00049 : KDialog( parent ), d( new KCal::ConfirmSaveDialog::Private ) 00050 { 00051 setCaption( i18n( "Confirm Save" ) ); 00052 setModal( true ); 00053 setButtons( Ok | Cancel ); 00054 setDefaultButton( Ok ); 00055 QFrame *topFrame = new QFrame( this ); 00056 setMainWidget( topFrame ); 00057 00058 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 00059 00060 QLabel *label = new QLabel( 00061 i18n( "You have requested to save the following objects to '%1':", 00062 destination ), topFrame ); 00063 topLayout->addWidget( label ); 00064 00065 QStringList headers; 00066 headers << i18n( "Operation" ) 00067 << i18n( "Type" ) 00068 << i18n( "Summary" ) 00069 << i18n( "UID" ); 00070 00071 d->mListView = new QTreeWidget( topFrame ); 00072 d->mListView->setColumnCount( 4 ); 00073 d->mListView->setHeaderLabels( headers ); 00074 00075 topLayout->addWidget( d->mListView ); 00076 } 00077 00078 ConfirmSaveDialog::~ConfirmSaveDialog() 00079 { 00080 delete d; 00081 } 00082 00083 void ConfirmSaveDialog::addIncidences( const Incidence::List &incidences, 00084 const QString &operation ) 00085 { 00086 Incidence::List::ConstIterator it; 00087 for ( it = incidences.begin(); it != incidences.end(); ++it ) { 00088 Incidence *i = *it; 00089 QTreeWidgetItem *item = new QTreeWidgetItem( d->mListView ); 00090 item->setText( 0, operation ); 00091 item->setText( 1, i->type() ); 00092 item->setText( 2, i->summary() ); 00093 item->setText( 3, i->uid() ); 00094 } 00095 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:03:20 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:03:20 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.