00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00038 class KCal::ConfirmSaveDialog::Private
00039 {
00040 public:
00041 Private()
00042 {}
00043 QTreeWidget *mListView;
00044 };
00045
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 }