confirmsavedialog.cpp
00001 /* 00002 This file is part of libkcal. 00003 00004 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program 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 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "confirmsavedialog.h" 00022 00023 #include <klistview.h> 00024 #include <klocale.h> 00025 00026 #include <tqlayout.h> 00027 #include <tqframe.h> 00028 #include <tqlabel.h> 00029 00030 using namespace KCal; 00031 00032 ConfirmSaveDialog::ConfirmSaveDialog( const TQString &destination, 00033 TQWidget *parent, const char *name ) 00034 : KDialogBase( parent, name, true, i18n("Confirm Save"), Ok | Cancel ) 00035 { 00036 TQFrame *topFrame = makeMainWidget(); 00037 00038 TQBoxLayout *topLayout = new TQVBoxLayout( topFrame ); 00039 topLayout->setSpacing( spacingHint() ); 00040 00041 TQLabel *label = new TQLabel( 00042 i18n("You have requested to save the following objects to '%1':") 00043 .arg( destination ), topFrame ); 00044 topLayout->addWidget( label ); 00045 00046 mListView = new KListView( topFrame ); 00047 mListView->addColumn( i18n("Operation") ); 00048 mListView->addColumn( i18n("Type") ); 00049 mListView->addColumn( i18n("Summary") ); 00050 mListView->addColumn( i18n("UID") ); 00051 topLayout->addWidget( mListView ); 00052 } 00053 00054 void ConfirmSaveDialog::addIncidences( const Incidence::List &incidences, 00055 const TQString &operation ) 00056 { 00057 Incidence::List::ConstIterator it; 00058 for( it = incidences.begin(); it != incidences.end(); ++it ) { 00059 Incidence *i = *it; 00060 KListViewItem *item = new KListViewItem( mListView ); 00061 item->setText( 0, operation ); 00062 item->setText( 1, i->type() ); 00063 item->setText( 2, i->summary() ); 00064 item->setText( 3, i->uid() ); 00065 } 00066 }