author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/koeventeditor.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'korganizer/koeventeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventeditor.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp index 3e87197..62ad250 100644 --- a/korganizer/koeventeditor.cpp +++ b/korganizer/koeventeditor.cpp | |||
@@ -9,40 +9,45 @@ | |||
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 <qhbox.h> | 27 | #include <q3hbox.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <qdir.h> | 29 | #include <qdir.h> |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qwidgetstack.h> | 31 | #include <q3widgetstack.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <QDesktopWidget> | ||
34 | //Added by qt3to4: | ||
35 | #include <Q3HBoxLayout> | ||
36 | #include <Q3PtrList> | ||
37 | #include <Q3VBoxLayout> | ||
33 | 38 | ||
34 | #include <kiconloader.h> | 39 | #include <kiconloader.h> |
35 | #include <kstandarddirs.h> | 40 | #include <kstandarddirs.h> |
36 | #include <kdebug.h> | 41 | #include <kdebug.h> |
37 | #include <klocale.h> | 42 | #include <klocale.h> |
38 | #include <kfiledialog.h> | 43 | #include <kfiledialog.h> |
39 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
40 | #include <libkcal/calendarresources.h> | 45 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 46 | #include <libkcal/resourcecalendar.h> |
42 | #include <kresources/resourceselectdialog.h> | 47 | #include <kresources/resourceselectdialog.h> |
43 | 48 | ||
44 | #include <libkdepim/categoryselectdialog.h> | 49 | #include <libkdepim/categoryselectdialog.h> |
45 | #include <libkcal/calendarlocal.h> | 50 | #include <libkcal/calendarlocal.h> |
46 | #include <libkcal/icalformat.h> | 51 | #include <libkcal/icalformat.h> |
47 | 52 | ||
48 | #include "koprefs.h" | 53 | #include "koprefs.h" |
@@ -92,111 +97,111 @@ void KOEventEditor::reload() | |||
92 | 97 | ||
93 | void KOEventEditor::setSecrecy( int sec ) | 98 | void KOEventEditor::setSecrecy( int sec ) |
94 | { | 99 | { |
95 | mGeneral->setSecrecy( sec ); | 100 | mGeneral->setSecrecy( sec ); |
96 | } | 101 | } |
97 | void KOEventEditor::setCategories( QString s ) | 102 | void KOEventEditor::setCategories( QString s ) |
98 | { | 103 | { |
99 | mGeneral->setCategories(s); | 104 | mGeneral->setCategories(s); |
100 | 105 | ||
101 | } | 106 | } |
102 | void KOEventEditor::setupGeneral() | 107 | void KOEventEditor::setupGeneral() |
103 | { | 108 | { |
104 | mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); | 109 | mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); |
105 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); | 110 | connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); |
106 | 111 | ||
107 | if( KOPrefs::instance()->mCompactDialogs ) { | 112 | if( KOPrefs::instance()->mCompactDialogs ) { |
108 | QFrame *topFrame = addPage(i18n("General")); | 113 | Q3Frame *topFrame = addPage(i18n("General")); |
109 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 114 | Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame); |
110 | topLayout->setSpacing(spacingHint()-1); | 115 | topLayout->setSpacing(spacingHint()-1); |
111 | topLayout->setMargin(marginHint()-1); | 116 | topLayout->setMargin(marginHint()-1); |
112 | topLayout->addStretch ( 1 ); | 117 | topLayout->addStretch ( 1 ); |
113 | mGeneral->initHeader(topFrame,topLayout); | 118 | mGeneral->initHeader(topFrame,topLayout); |
114 | topLayout->addStretch ( 1 ); | 119 | topLayout->addStretch ( 1 ); |
115 | mGeneral->initTime(topFrame,topLayout); | 120 | mGeneral->initTime(topFrame,topLayout); |
116 | topLayout->addStretch ( 1 ); | 121 | topLayout->addStretch ( 1 ); |
117 | // QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); | 122 | // QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); |
118 | mGeneral->initAlarm(topFrame,topLayout); | 123 | mGeneral->initAlarm(topFrame,topLayout); |
119 | topLayout->addStretch ( 1 ); | 124 | topLayout->addStretch ( 1 ); |
120 | mGeneral->enableAlarm( false ); | 125 | mGeneral->enableAlarm( false ); |
121 | 126 | ||
122 | QBoxLayout *buttonLayout; | 127 | Q3BoxLayout *buttonLayout; |
123 | if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 ) | 128 | if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 ) |
124 | buttonLayout = new QVBoxLayout( topLayout ); | 129 | buttonLayout = new Q3VBoxLayout( topLayout ); |
125 | else | 130 | else |
126 | buttonLayout = new QHBoxLayout( topLayout ); | 131 | buttonLayout = new Q3HBoxLayout( topLayout ); |
127 | QHBox* buttonWidget = new QHBox (topFrame); | 132 | Q3HBox* buttonWidget = new Q3HBox (topFrame); |
128 | QIconSet icon; | 133 | QIcon icon; |
129 | if ( QApplication::desktop()->width() < 321 ) | 134 | if ( QApplication::desktop()->width() < 321 ) |
130 | icon = SmallIcon("fileexport16"); | 135 | icon = SmallIcon("fileexport16"); |
131 | else | 136 | else |
132 | icon = SmallIcon("fileexport"); | 137 | icon = SmallIcon("fileexport"); |
133 | QPushButton * loadTemplate = new QPushButton( buttonWidget); | 138 | QPushButton * loadTemplate = new QPushButton( buttonWidget); |
134 | QPushButton * saveTemplate = new QPushButton( buttonWidget); | 139 | QPushButton * saveTemplate = new QPushButton( buttonWidget); |
135 | saveTemplate->setIconSet (icon ) ; | 140 | saveTemplate->setIconSet (icon ) ; |
136 | int size = saveTemplate->sizeHint().height(); | 141 | int size = saveTemplate->sizeHint().height(); |
137 | saveTemplate->setFixedSize( size, size ); | 142 | saveTemplate->setFixedSize( size, size ); |
138 | if ( QApplication::desktop()->width() < 321 ) | 143 | if ( QApplication::desktop()->width() < 321 ) |
139 | icon = SmallIcon("fileimport16"); | 144 | icon = SmallIcon("fileimport16"); |
140 | else | 145 | else |
141 | icon = SmallIcon("fileimport"); | 146 | icon = SmallIcon("fileimport"); |
142 | loadTemplate->setIconSet (icon ) ; | 147 | loadTemplate->setIconSet (icon ) ; |
143 | loadTemplate->setFixedSize( size, size ); | 148 | loadTemplate->setFixedSize( size, size ); |
144 | buttonLayout->addWidget( buttonWidget ); | 149 | buttonLayout->addWidget( buttonWidget ); |
145 | mGeneral->initCategories( topFrame, buttonLayout ); | 150 | mGeneral->initCategories( topFrame, buttonLayout ); |
146 | 151 | ||
147 | topLayout->addStretch( 1 ); | 152 | topLayout->addStretch( 1 ); |
148 | 153 | ||
149 | QFrame *topFrame2 = addPage(i18n("Details")); | 154 | Q3Frame *topFrame2 = addPage(i18n("Details")); |
150 | 155 | ||
151 | QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); | 156 | Q3BoxLayout *topLayout2 = new Q3VBoxLayout(topFrame2); |
152 | topLayout2->setSpacing(spacingHint()-1); | 157 | topLayout2->setSpacing(spacingHint()-1); |
153 | topLayout2->setMargin(marginHint()-1); | 158 | topLayout2->setMargin(marginHint()-1); |
154 | topLayout2->setSpacing(spacingHint()); | 159 | topLayout2->setSpacing(spacingHint()); |
155 | 160 | ||
156 | mGeneral->initClass(topFrame2,topLayout2); | 161 | mGeneral->initClass(topFrame2,topLayout2); |
157 | mGeneral->initSecrecy( topFrame2, topLayout2 ); | 162 | mGeneral->initSecrecy( topFrame2, topLayout2 ); |
158 | mGeneral->initDescription(topFrame2,topLayout2); | 163 | mGeneral->initDescription(topFrame2,topLayout2); |
159 | 164 | ||
160 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 165 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
161 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 166 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
162 | } else { | 167 | } else { |
163 | QFrame *topFrame = addPage(i18n("General")); | 168 | Q3Frame *topFrame = addPage(i18n("General")); |
164 | 169 | ||
165 | QBoxLayout *topLayout = new QVBoxLayout(topFrame); | 170 | Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame); |
166 | topLayout->setSpacing(spacingHint()); | 171 | topLayout->setSpacing(spacingHint()); |
167 | 172 | ||
168 | mGeneral->initHeader(topFrame,topLayout); | 173 | mGeneral->initHeader(topFrame,topLayout); |
169 | mGeneral->initTime(topFrame,topLayout); | 174 | mGeneral->initTime(topFrame,topLayout); |
170 | QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); | 175 | Q3BoxLayout *alarmLineLayout = new Q3HBoxLayout(topLayout); |
171 | mGeneral->initAlarm(topFrame,alarmLineLayout); | 176 | mGeneral->initAlarm(topFrame,alarmLineLayout); |
172 | mGeneral->initClass(topFrame,alarmLineLayout); | 177 | mGeneral->initClass(topFrame,alarmLineLayout); |
173 | mGeneral->initDescription(topFrame,topLayout); | 178 | mGeneral->initDescription(topFrame,topLayout); |
174 | QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); | 179 | Q3BoxLayout *detailsLayout = new Q3HBoxLayout(topLayout); |
175 | mGeneral->initCategories( topFrame, detailsLayout ); | 180 | mGeneral->initCategories( topFrame, detailsLayout ); |
176 | mGeneral->initSecrecy( topFrame, detailsLayout ); | 181 | mGeneral->initSecrecy( topFrame, detailsLayout ); |
177 | } | 182 | } |
178 | 183 | ||
179 | mGeneral->finishSetup(); | 184 | mGeneral->finishSetup(); |
180 | 185 | ||
181 | } | 186 | } |
182 | 187 | ||
183 | void KOEventEditor::setupRecurrence() | 188 | void KOEventEditor::setupRecurrence() |
184 | { | 189 | { |
185 | QFrame *topFrame = addPage( i18n("Recurrence") ); | 190 | Q3Frame *topFrame = addPage( i18n("Recurrence") ); |
186 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | 191 | Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame ); |
187 | 192 | ||
188 | mRecurrence = new KOEditorRecurrence( topFrame ); | 193 | mRecurrence = new KOEditorRecurrence( topFrame ); |
189 | topLayout->addWidget( mRecurrence ); | 194 | topLayout->addWidget( mRecurrence ); |
190 | } | 195 | } |
191 | 196 | ||
192 | void KOEventEditor::editEvent(Event *event, bool showDescription) | 197 | void KOEventEditor::editEvent(Event *event, bool showDescription) |
193 | { | 198 | { |
194 | // init(); | 199 | // init(); |
195 | 200 | ||
196 | mEvent = event; | 201 | mEvent = event; |
197 | readEvent(mEvent); | 202 | readEvent(mEvent); |
198 | if ( showDescription ) { | 203 | if ( showDescription ) { |
199 | showPage( 1 ); | 204 | showPage( 1 ); |
200 | mGeneral->setFocusOn( 1 ); | 205 | mGeneral->setFocusOn( 1 ); |
201 | } else { | 206 | } else { |
202 | showPage( 0 ); | 207 | showPage( 0 ); |
@@ -343,33 +348,33 @@ void KOEventEditor::slotLoadTemplate() | |||
343 | 348 | ||
344 | QString fileName =locateLocal( "templates", "events" ); | 349 | QString fileName =locateLocal( "templates", "events" ); |
345 | QDir t_dir; | 350 | QDir t_dir; |
346 | if ( !t_dir.exists(fileName) ) | 351 | if ( !t_dir.exists(fileName) ) |
347 | t_dir.mkdir ( fileName ); | 352 | t_dir.mkdir ( fileName ); |
348 | fileName += "/event"; | 353 | fileName += "/event"; |
349 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this ); | 354 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this ); |
350 | if ( fileName.length() == 0 ) | 355 | if ( fileName.length() == 0 ) |
351 | return; | 356 | return; |
352 | CalendarLocal cal; | 357 | CalendarLocal cal; |
353 | ICalFormat format; | 358 | ICalFormat format; |
354 | if ( !format.load( &cal, fileName ) ) { | 359 | if ( !format.load( &cal, fileName ) ) { |
355 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 360 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
356 | .arg( fileName ) ); | 361 | .arg( fileName ) ); |
357 | return ; | 362 | return ; |
358 | } | 363 | } |
359 | QPtrList<Event> events = cal.events(); | 364 | Q3PtrList<Event> events = cal.events(); |
360 | Event* event = events.first(); | 365 | Event* event = events.first(); |
361 | if ( !event ) { | 366 | if ( !event ) { |
362 | KMessageBox::error( this, | 367 | KMessageBox::error( this, |
363 | i18n("Template does not contain\na valid Event.")); | 368 | i18n("Template does not contain\na valid Event.")); |
364 | } else { | 369 | } else { |
365 | kdDebug() << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl; | 370 | kdDebug() << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl; |
366 | readEvent( event, true ); | 371 | readEvent( event, true ); |
367 | } | 372 | } |
368 | } | 373 | } |
369 | 374 | ||
370 | 375 | ||
371 | void KOEventEditor::slotSaveTemplate() | 376 | void KOEventEditor::slotSaveTemplate() |
372 | { | 377 | { |
373 | QString fileName =locateLocal( "templates", "events" ); | 378 | QString fileName =locateLocal( "templates", "events" ); |
374 | QDir t_dir; | 379 | QDir t_dir; |
375 | if ( !t_dir.exists(fileName) ) | 380 | if ( !t_dir.exists(fileName) ) |