summaryrefslogtreecommitdiffabout
path: root/korganizer/koincidenceeditor.cpp
Unidiff
Diffstat (limited to 'korganizer/koincidenceeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koincidenceeditor.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp
index 236f6f9..2060ea1 100644
--- a/korganizer/koincidenceeditor.cpp
+++ b/korganizer/koincidenceeditor.cpp
@@ -1,183 +1,185 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <q3frame.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <q3widgetstack.h>
29#include <qdatetime.h> 29#include <qdatetime.h>
30#include <qdir.h> 30#include <qdir.h>
31//Added by qt3to4:
32#include <Q3VBoxLayout>
31 33
32#include <kdebug.h> 34#include <kdebug.h>
33#include <klocale.h> 35#include <klocale.h>
34#include <kstandarddirs.h> 36#include <kstandarddirs.h>
35#include <kmessagebox.h> 37#include <kmessagebox.h>
36#include <kfiledialog.h> 38#include <kfiledialog.h>
37 39
38#include <libkdepim/categoryselectdialog.h> 40#include <libkdepim/categoryselectdialog.h>
39#include <libkdepim/kinputdialog.h> 41#include <libkdepim/kinputdialog.h>
40 42
41#include <libkcal/calendarlocal.h> 43#include <libkcal/calendarlocal.h>
42#include <libkcal/icalformat.h> 44#include <libkcal/icalformat.h>
43 45
44#include "koprefs.h" 46#include "koprefs.h"
45 47
46#include "koincidenceeditor.h" 48#include "koincidenceeditor.h"
47 49
48KOIncidenceEditor::KOIncidenceEditor( const QString &caption, 50KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
49 Calendar *calendar, QWidget *parent ) : 51 Calendar *calendar, QWidget *parent ) :
50 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, 52 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok,
51 parent, caption, true, false ), 53 parent, caption, true, false ),
52 mSaveTemplateDialog( 0 ) 54 mSaveTemplateDialog( 0 )
53{ 55{
54 mCalendar = calendar; 56 mCalendar = calendar;
55 57
56 setButtonText( Default, i18n("Template...") ); 58 setButtonText( Default, i18n("Template...") );
57 59
58 QString saveTemplateText; 60 QString saveTemplateText;
59 // if ( KOPrefs::instance()->mCompactDialogs ) { 61 // if ( KOPrefs::instance()->mCompactDialogs ) {
60// showButton( User1, false ); 62// showButton( User1, false );
61// showButton( Apply, false ); 63// showButton( Apply, false );
62// } else { 64// } else {
63 showButton( Apply, false ); 65 showButton( Apply, false );
64 saveTemplateText = i18n("Ok+Agenda"); 66 saveTemplateText = i18n("Ok+Agenda");
65 // } 67 // }
66 setButtonText( User1, saveTemplateText ); 68 setButtonText( User1, saveTemplateText );
67 69
68 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); 70 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
69 // KOGlobals::fitDialogToScreen( mCategoryDialog ); 71 // KOGlobals::fitDialogToScreen( mCategoryDialog );
70 72
71 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); 73 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));
72 74
73 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); 75 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
74 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); 76 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
75 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); 77 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) );
76} 78}
77 79
78KOIncidenceEditor::~KOIncidenceEditor() 80KOIncidenceEditor::~KOIncidenceEditor()
79{ 81{
80 //delete mCategoryDialog; 82 //delete mCategoryDialog;
81} 83}
82 84
83void KOIncidenceEditor::setupAttendeesTab() 85void KOIncidenceEditor::setupAttendeesTab()
84{ 86{
85 QFrame *topFrame = addPage(i18n("Attendees")); 87 Q3Frame *topFrame = addPage(i18n("Attendees"));
86 88
87 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 89 Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
88 90
89 mDetails = new KOEditorDetails(spacingHint()-2,topFrame); 91 mDetails = new KOEditorDetails(spacingHint()-2,topFrame);
90 topLayout->addWidget(mDetails); 92 topLayout->addWidget(mDetails);
91} 93}
92 94
93void KOIncidenceEditor::alarmWarning() 95void KOIncidenceEditor::alarmWarning()
94{ 96{
95 KMessageBox::information( 0, i18n("The alarm for this calendar\nis currently disabled!\nEnable it in resource settings."), i18n("Alarm disabled warning")); 97 KMessageBox::information( 0, i18n("The alarm for this calendar\nis currently disabled!\nEnable it in resource settings."), i18n("Alarm disabled warning"));
96 98
97} 99}
98 100
99void KOIncidenceEditor::slotApply() 101void KOIncidenceEditor::slotApply()
100{ 102{
101 processInput( false ); 103 processInput( false );
102} 104}
103void KOIncidenceEditor::accept() 105void KOIncidenceEditor::accept()
104{ 106{
105 slotOk(); 107 slotOk();
106} 108}
107void KOIncidenceEditor::slotOk() 109void KOIncidenceEditor::slotOk()
108{ 110{
109 if ( processInput( false ) ) QDialog::accept(); 111 if ( processInput( false ) ) QDialog::accept();
110} 112}
111 113
112void KOIncidenceEditor::updateCategoryConfig() 114void KOIncidenceEditor::updateCategoryConfig()
113{ 115{
114 qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! "); 116 qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! ");
115 //mCategoryDialog->updateCategoryConfig(); 117 //mCategoryDialog->updateCategoryConfig();
116} 118}
117 119
118void KOIncidenceEditor::slotCancel() 120void KOIncidenceEditor::slotCancel()
119{ 121{
120 reject(); 122 reject();
121} 123}
122 124
123void KOIncidenceEditor::slotLoadTemplate() 125void KOIncidenceEditor::slotLoadTemplate()
124{ 126{
125 kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl; 127 kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl;
126} 128}
127void KOIncidenceEditor::slotShowIncidence() 129void KOIncidenceEditor::slotShowIncidence()
128{ 130{
129 131
130 if ( processInput(true ) ) { 132 if ( processInput(true ) ) {
131 accept(); 133 accept();
132 } 134 }
133} 135}
134 136
135void KOIncidenceEditor::slotSaveTemplate() 137void KOIncidenceEditor::slotSaveTemplate()
136{ 138{
137 kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl; 139 kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl;
138} 140}
139 141
140void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type ) 142void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type )
141{ 143{
142 if ( !mSaveTemplateDialog ) { 144 if ( !mSaveTemplateDialog ) {
143 mSaveTemplateDialog = new SaveTemplateDialog( type, this ); 145 mSaveTemplateDialog = new SaveTemplateDialog( type, this );
144 connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ), 146 connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ),
145 SLOT( saveTemplate( const QString & ) ) ); 147 SLOT( saveTemplate( const QString & ) ) );
146 } 148 }
147 mSaveTemplateDialog->show(); 149 mSaveTemplateDialog->show();
148 mSaveTemplateDialog->raise(); 150 mSaveTemplateDialog->raise();
149} 151}
150 152
151void KOIncidenceEditor::saveAsTemplate( Incidence *incidence, 153void KOIncidenceEditor::saveAsTemplate( Incidence *incidence,
152 const QString &templateName ) 154 const QString &templateName )
153{ 155{
154 CalendarLocal cal; 156 CalendarLocal cal;
155 cal.addIncidence( incidence ); 157 cal.addIncidence( incidence );
156 ICalFormat format; 158 ICalFormat format;
157 format.save( &cal, templateName ); 159 format.save( &cal, templateName );
158} 160}
159 161
160QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type, 162QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type,
161 const QStringList &templates ) 163 const QStringList &templates )
162{ 164{
163 // bool ok = false; 165 // bool ok = false;
164// QString templateName = KInputDialog::getItem( i18n("Load Template"), 166// QString templateName = KInputDialog::getItem( i18n("Load Template"),
165// i18n("Select a template to load:"), templates, 0, &ok ); 167// i18n("Select a template to load:"), templates, 0, &ok );
166// if ( !ok || templateName.isEmpty() ) return QString::null; 168// if ( !ok || templateName.isEmpty() ) return QString::null;
167 169
168// QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" + 170// QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" +
169// templateName ); 171// templateName );
170// fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this ); 172// fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this );
171 173
172 // QString fileName;// =locateLocal( "templates", incidence->type() ); 174 // QString fileName;// =locateLocal( "templates", incidence->type() );
173// fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this ); 175// fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this );
174// if ( fileNamelength() == 0) 176// if ( fileNamelength() == 0)
175// return QString::null; 177// return QString::null;
176// if ( fileName.isEmpty() ) { 178// if ( fileName.isEmpty() ) {
177// KMessageBox::error( this, i18n("Unable to find template '%1'.") 179// KMessageBox::error( this, i18n("Unable to find template '%1'.")
178// .arg( fileName ) ); 180// .arg( fileName ) );
179// return QString::null; 181// return QString::null;
180// } else { 182// } else {
181// ICalFormat format; 183// ICalFormat format;
182// if ( !format.load( cal, fileName ) ) { 184// if ( !format.load( cal, fileName ) ) {
183// KMessageBox::error( this, i18n("Error loading template file '%1'.") 185// KMessageBox::error( this, i18n("Error loading template file '%1'.")