author | zautrix <zautrix> | 2005-11-30 08:30:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-30 08:30:24 (UTC) |
commit | 042f35a481acf6c4e711e98184abb6c9f6542429 (patch) (unidiff) | |
tree | 47622f89ebfb6c677797d7906f167ba80976ab7d /korganizer/koincidenceeditor.cpp | |
parent | 14bd7cc7412ffdbca09e1cd63a230222a3fbfd53 (diff) | |
download | kdepimpi-042f35a481acf6c4e711e98184abb6c9f6542429.zip kdepimpi-042f35a481acf6c4e711e98184abb6c9f6542429.tar.gz kdepimpi-042f35a481acf6c4e711e98184abb6c9f6542429.tar.bz2 |
commit
Diffstat (limited to 'korganizer/koincidenceeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koincidenceeditor.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp index 9bc0302..236f6f9 100644 --- a/korganizer/koincidenceeditor.cpp +++ b/korganizer/koincidenceeditor.cpp | |||
@@ -1,185 +1,190 @@ | |||
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 <qframe.h> |
26 | #include <qpixmap.h> | 26 | #include <qpixmap.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | 31 | ||
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kstandarddirs.h> | 34 | #include <kstandarddirs.h> |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | #include <kfiledialog.h> | 36 | #include <kfiledialog.h> |
37 | 37 | ||
38 | #include <libkdepim/categoryselectdialog.h> | 38 | #include <libkdepim/categoryselectdialog.h> |
39 | #include <libkdepim/kinputdialog.h> | 39 | #include <libkdepim/kinputdialog.h> |
40 | 40 | ||
41 | #include <libkcal/calendarlocal.h> | 41 | #include <libkcal/calendarlocal.h> |
42 | #include <libkcal/icalformat.h> | 42 | #include <libkcal/icalformat.h> |
43 | 43 | ||
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | 45 | ||
46 | #include "koincidenceeditor.h" | 46 | #include "koincidenceeditor.h" |
47 | 47 | ||
48 | KOIncidenceEditor::KOIncidenceEditor( const QString &caption, | 48 | KOIncidenceEditor::KOIncidenceEditor( const QString &caption, |
49 | Calendar *calendar, QWidget *parent ) : | 49 | Calendar *calendar, QWidget *parent ) : |
50 | KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, | 50 | KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, |
51 | parent, caption, true, false ), | 51 | parent, caption, true, false ), |
52 | mSaveTemplateDialog( 0 ) | 52 | mSaveTemplateDialog( 0 ) |
53 | { | 53 | { |
54 | mCalendar = calendar; | 54 | mCalendar = calendar; |
55 | 55 | ||
56 | setButtonText( Default, i18n("Template...") ); | 56 | setButtonText( Default, i18n("Template...") ); |
57 | 57 | ||
58 | QString saveTemplateText; | 58 | QString saveTemplateText; |
59 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 59 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
60 | // showButton( User1, false ); | 60 | // showButton( User1, false ); |
61 | // showButton( Apply, false ); | 61 | // showButton( Apply, false ); |
62 | // } else { | 62 | // } else { |
63 | showButton( Apply, false ); | 63 | showButton( Apply, false ); |
64 | saveTemplateText = i18n("Ok+Agenda"); | 64 | saveTemplateText = i18n("Ok+Agenda"); |
65 | // } | 65 | // } |
66 | setButtonText( User1, saveTemplateText ); | 66 | setButtonText( User1, saveTemplateText ); |
67 | 67 | ||
68 | //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); | 68 | //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); |
69 | // KOGlobals::fitDialogToScreen( mCategoryDialog ); | 69 | // KOGlobals::fitDialogToScreen( mCategoryDialog ); |
70 | 70 | ||
71 | //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); | 71 | //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); |
72 | 72 | ||
73 | //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); | 73 | //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); |
74 | // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); | 74 | // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); |
75 | connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); | 75 | connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); |
76 | } | 76 | } |
77 | 77 | ||
78 | KOIncidenceEditor::~KOIncidenceEditor() | 78 | KOIncidenceEditor::~KOIncidenceEditor() |
79 | { | 79 | { |
80 | //delete mCategoryDialog; | 80 | //delete mCategoryDialog; |
81 | } | 81 | } |
82 | 82 | ||
83 | void KOIncidenceEditor::setupAttendeesTab() | 83 | void KOIncidenceEditor::setupAttendeesTab() |
84 | { | 84 | { |
85 | QFrame *topFrame = addPage(i18n("Attendees")); | 85 | QFrame *topFrame = addPage(i18n("Attendees")); |
86 | 86 | ||
87 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 87 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); |
88 | 88 | ||
89 | mDetails = new KOEditorDetails(spacingHint()-2,topFrame); | 89 | mDetails = new KOEditorDetails(spacingHint()-2,topFrame); |
90 | topLayout->addWidget(mDetails); | 90 | topLayout->addWidget(mDetails); |
91 | } | 91 | } |
92 | 92 | ||
93 | void KOIncidenceEditor::alarmWarning() | ||
94 | { | ||
95 | KMessageBox::information( 0, i18n("The alarm for this calendar\nis currently disabled!\nEnable it in resource settings."), i18n("Alarm disabled warning")); | ||
96 | |||
97 | } | ||
93 | 98 | ||
94 | void KOIncidenceEditor::slotApply() | 99 | void KOIncidenceEditor::slotApply() |
95 | { | 100 | { |
96 | processInput( false ); | 101 | processInput( false ); |
97 | } | 102 | } |
98 | void KOIncidenceEditor::accept() | 103 | void KOIncidenceEditor::accept() |
99 | { | 104 | { |
100 | slotOk(); | 105 | slotOk(); |
101 | } | 106 | } |
102 | void KOIncidenceEditor::slotOk() | 107 | void KOIncidenceEditor::slotOk() |
103 | { | 108 | { |
104 | if ( processInput( false ) ) QDialog::accept(); | 109 | if ( processInput( false ) ) QDialog::accept(); |
105 | } | 110 | } |
106 | 111 | ||
107 | void KOIncidenceEditor::updateCategoryConfig() | 112 | void KOIncidenceEditor::updateCategoryConfig() |
108 | { | 113 | { |
109 | qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! "); | 114 | qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! "); |
110 | //mCategoryDialog->updateCategoryConfig(); | 115 | //mCategoryDialog->updateCategoryConfig(); |
111 | } | 116 | } |
112 | 117 | ||
113 | void KOIncidenceEditor::slotCancel() | 118 | void KOIncidenceEditor::slotCancel() |
114 | { | 119 | { |
115 | reject(); | 120 | reject(); |
116 | } | 121 | } |
117 | 122 | ||
118 | void KOIncidenceEditor::slotLoadTemplate() | 123 | void KOIncidenceEditor::slotLoadTemplate() |
119 | { | 124 | { |
120 | kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl; | 125 | kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl; |
121 | } | 126 | } |
122 | void KOIncidenceEditor::slotShowIncidence() | 127 | void KOIncidenceEditor::slotShowIncidence() |
123 | { | 128 | { |
124 | 129 | ||
125 | if ( processInput(true ) ) { | 130 | if ( processInput(true ) ) { |
126 | accept(); | 131 | accept(); |
127 | } | 132 | } |
128 | } | 133 | } |
129 | 134 | ||
130 | void KOIncidenceEditor::slotSaveTemplate() | 135 | void KOIncidenceEditor::slotSaveTemplate() |
131 | { | 136 | { |
132 | kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl; | 137 | kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl; |
133 | } | 138 | } |
134 | 139 | ||
135 | void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type ) | 140 | void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type ) |
136 | { | 141 | { |
137 | if ( !mSaveTemplateDialog ) { | 142 | if ( !mSaveTemplateDialog ) { |
138 | mSaveTemplateDialog = new SaveTemplateDialog( type, this ); | 143 | mSaveTemplateDialog = new SaveTemplateDialog( type, this ); |
139 | connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ), | 144 | connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ), |
140 | SLOT( saveTemplate( const QString & ) ) ); | 145 | SLOT( saveTemplate( const QString & ) ) ); |
141 | } | 146 | } |
142 | mSaveTemplateDialog->show(); | 147 | mSaveTemplateDialog->show(); |
143 | mSaveTemplateDialog->raise(); | 148 | mSaveTemplateDialog->raise(); |
144 | } | 149 | } |
145 | 150 | ||
146 | void KOIncidenceEditor::saveAsTemplate( Incidence *incidence, | 151 | void KOIncidenceEditor::saveAsTemplate( Incidence *incidence, |
147 | const QString &templateName ) | 152 | const QString &templateName ) |
148 | { | 153 | { |
149 | CalendarLocal cal; | 154 | CalendarLocal cal; |
150 | cal.addIncidence( incidence ); | 155 | cal.addIncidence( incidence ); |
151 | ICalFormat format; | 156 | ICalFormat format; |
152 | format.save( &cal, templateName ); | 157 | format.save( &cal, templateName ); |
153 | } | 158 | } |
154 | 159 | ||
155 | QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type, | 160 | QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type, |
156 | const QStringList &templates ) | 161 | const QStringList &templates ) |
157 | { | 162 | { |
158 | // bool ok = false; | 163 | // bool ok = false; |
159 | // QString templateName = KInputDialog::getItem( i18n("Load Template"), | 164 | // QString templateName = KInputDialog::getItem( i18n("Load Template"), |
160 | // i18n("Select a template to load:"), templates, 0, &ok ); | 165 | // i18n("Select a template to load:"), templates, 0, &ok ); |
161 | // if ( !ok || templateName.isEmpty() ) return QString::null; | 166 | // if ( !ok || templateName.isEmpty() ) return QString::null; |
162 | 167 | ||
163 | // QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" + | 168 | // QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" + |
164 | // templateName ); | 169 | // templateName ); |
165 | // fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this ); | 170 | // fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this ); |
166 | 171 | ||
167 | // QString fileName;// =locateLocal( "templates", incidence->type() ); | 172 | // QString fileName;// =locateLocal( "templates", incidence->type() ); |
168 | // fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this ); | 173 | // fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this ); |
169 | // if ( fileNamelength() == 0) | 174 | // if ( fileNamelength() == 0) |
170 | // return QString::null; | 175 | // return QString::null; |
171 | // if ( fileName.isEmpty() ) { | 176 | // if ( fileName.isEmpty() ) { |
172 | // KMessageBox::error( this, i18n("Unable to find template '%1'.") | 177 | // KMessageBox::error( this, i18n("Unable to find template '%1'.") |
173 | // .arg( fileName ) ); | 178 | // .arg( fileName ) ); |
174 | // return QString::null; | 179 | // return QString::null; |
175 | // } else { | 180 | // } else { |
176 | // ICalFormat format; | 181 | // ICalFormat format; |
177 | // if ( !format.load( cal, fileName ) ) { | 182 | // if ( !format.load( cal, fileName ) ) { |
178 | // KMessageBox::error( this, i18n("Error loading template file '%1'.") | 183 | // KMessageBox::error( this, i18n("Error loading template file '%1'.") |
179 | // .arg( fileName ) ); | 184 | // .arg( fileName ) ); |
180 | // return QString::null; | 185 | // return QString::null; |
181 | // } | 186 | // } |
182 | // } | 187 | // } |
183 | 188 | ||
184 | return ""; | 189 | return ""; |
185 | } | 190 | } |