summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-08-10 16:47:41 (UTC)
committer zautrix <zautrix>2005-08-10 16:47:41 (UTC)
commit1af305e995d99549091c5b1e167b6101a3910f0d (patch) (unidiff)
tree617106288214a86362d6424d9370f10e5b0572ba
parent2ec31858158e42921b8d7fa2b75ccb1a16d8969c (diff)
downloadkdepimpi-1af305e995d99549091c5b1e167b6101a3910f0d.zip
kdepimpi-1af305e995d99549091c5b1e167b6101a3910f0d.tar.gz
kdepimpi-1af305e995d99549091c5b1e167b6101a3910f0d.tar.bz2
qwhatsthis text
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp8
-rw-r--r--korganizer/kofilterview.h8
-rw-r--r--korganizer/kotodoview.cpp15
3 files changed, 26 insertions, 5 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 6a6fff9..e86ec95 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -1,79 +1,80 @@
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 <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qdialog.h> 29#include <qdialog.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qtextcodec.h> 31#include <qtextcodec.h>
32#include <qwhatsthis.h>
32 33
33 34
34#include <libkcal/calfilter.h> 35#include <libkcal/calfilter.h>
35 36
36#include "kofilterview.h" 37#include "kofilterview.h"
37#include "koprefs.h" 38#include "koprefs.h"
38#include <kiconloader.h> 39#include <kiconloader.h>
39#include <kglobal.h> 40#include <kglobal.h>
40#include <kglobalsettings.h> 41#include <kglobalsettings.h>
41#include <kcolorbutton.h> 42#include <kcolorbutton.h>
42#include <kmessagebox.h> 43#include <kmessagebox.h>
43 44
44 45
45 46
46 47
47 48
48KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, 49KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
49 const char* name,WFlags fl ) 50 const char* name,WFlags fl )
50 : KOFilterView_base(parent,name,fl) 51 : KOFilterView_base(parent,name,fl)
51{ 52{
52 mFilters = filterList; 53 mFilters = filterList;
53 54
54 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 55 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged()));
55 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 56 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged()));
56 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); 57 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters()));
57} 58}
58 59
59KOFilterView::~KOFilterView() 60KOFilterView::~KOFilterView()
60{ 61{
61 // no need to delete child widgets, Qt does it all for us 62 // no need to delete child widgets, Qt does it all for us
62} 63}
63 64
64bool KOFilterView::filtersEnabled() 65bool KOFilterView::filtersEnabled()
65{ 66{
66 return mEnabledCheck->isChecked(); 67 return mEnabledCheck->isChecked();
67} 68}
68 69
69void KOFilterView::setFiltersEnabled(bool set) 70void KOFilterView::setFiltersEnabled(bool set)
70{ 71{
71 mEnabledCheck->setChecked(set); 72 mEnabledCheck->setChecked(set);
72 emit filterChanged(); 73 emit filterChanged();
73} 74}
74 75
75 76
76void KOFilterView::updateFilters() 77void KOFilterView::updateFilters()
77{ 78{
78 mSelectionCombo->clear(); 79 mSelectionCombo->clear();
79 80
@@ -206,132 +207,137 @@ void KOCalEditView::setColor( const QColor& c, int id )
206void KOCalEditView::deleteCal( int id ) 207void KOCalEditView::deleteCal( int id )
207{ 208{
208 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 209 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
209 QString name = kkf->mName; 210 QString name = kkf->mName;
210 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); 211 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 );
211 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; 212 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
212 bool findnewstd = kkf->isStandard; 213 bool findnewstd = kkf->isStandard;
213 emit removeCalendar ( id ); 214 emit removeCalendar ( id );
214 KOPrefs::instance()->mCalendars.remove ( kkf ); 215 KOPrefs::instance()->mCalendars.remove ( kkf );
215 if ( findnewstd ) findNewStandard(); 216 if ( findnewstd ) findNewStandard();
216 emit needsUpdate(); 217 emit needsUpdate();
217 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 218 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
218} 219}
219void KOCalEditView::infoCal( int id ) 220void KOCalEditView::infoCal( int id )
220{ 221{
221 QString name = KOPrefs::instance()->getCalendar( id )->mName; 222 QString name = KOPrefs::instance()->getCalendar( id )->mName;
222 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); 223 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 );
223 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 224 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
224 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { 225 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) {
225 emit calendarAdded( id ); 226 emit calendarAdded( id );
226 emit needsUpdate(); 227 emit needsUpdate();
227 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 228 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
228 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); 229 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
229 } 230 }
230 } 231 }
231 else 232 else
232 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 233 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
233} 234}
234void KOCalEditView::readConfig() 235void KOCalEditView::readConfig()
235{ 236{
236 237
237 mStdandardB.clear(); 238 mStdandardB.clear();
238 mEnabledB.clear(); 239 mEnabledB.clear();
239 mAlarmB.clear(); 240 mAlarmB.clear();
240 mROB.clear(); 241 mROB.clear();
241 242
242 if ( mw ) delete mw; 243 if ( mw ) delete mw;
243 mw = new QWidget ( viewport() ); 244 mw = new QWidget ( viewport() );
244 addChild(mw); 245 addChild(mw);
245 int ii = 0; 246 int ii = 0;
246 mainLayout = new QGridLayout ( mw , 2, 8 ); 247 mainLayout = new QGridLayout ( mw , 2, 8 );
247 mainLayout->setMargin( 2 ); 248 mainLayout->setMargin( 2 );
248 mainLayout->setSpacing( 2 ); 249 mainLayout->setSpacing( 2 );
249 QPushButton * addButT = new QPushButton ( mw ); 250 QPushButton * addButT = new QPushButton ( mw );
250 addButT->setFocusPolicy(NoFocus); 251 addButT->setFocusPolicy(NoFocus);
251 mainLayout->addWidget( addButT,0,0 ); 252 mainLayout->addWidget( addButT,0,0 );
252 addButT->setText( "D"); 253 addButT->setText( "D");
253 connect(addButT,SIGNAL(clicked()),SLOT(defaultInfo())); 254 connect(addButT,SIGNAL(clicked()),SLOT(defaultInfo()));
255 QWhatsThis::add( addButT, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") );
254 //addBut->setPixmap ( SmallIcon("greenhook16")); 256 //addBut->setPixmap ( SmallIcon("greenhook16"));
255 QPushButton *addBut = new QPushButton ( mw ); 257 QPushButton *addBut = new QPushButton ( mw );
256 addBut->setFocusPolicy(NoFocus); 258 addBut->setFocusPolicy(NoFocus);
257 mainLayout->addWidget( addBut,0,++ii ); 259 mainLayout->addWidget( addBut,0,++ii );
258 addBut->setPixmap ( SmallIcon("eye")); 260 addBut->setPixmap ( SmallIcon("eye"));
261 QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.") );
259 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 262 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
260 int max = addBut->sizeHint().height(); 263 int max = addBut->sizeHint().height();
261 addBut->setMaximumWidth( max ); 264 addBut->setMaximumWidth( max );
262 addButT->setFixedSize( QSize( max, max ) ); 265 addButT->setFixedSize( QSize( max, max ) );
263 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); 266 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
264 mainLayout->addWidget( lab,0,++ii ); 267 mainLayout->addWidget( lab,0,++ii );
268 QWhatsThis::add( lab, i18n("In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.") );
265 //lab = new QLabel ( i18n(" "), mw ); 269 //lab = new QLabel ( i18n(" "), mw );
266 //mainLayout->addWidget( lab,0,++ii ); 270 //mainLayout->addWidget( lab,0,++ii );
267 //lab->setFixedWidth( 1 ); 271 //lab->setFixedWidth( 1 );
268 addBut = new QPushButton ( mw ); 272 addBut = new QPushButton ( mw );
269 addBut->setFocusPolicy(NoFocus); 273 addBut->setFocusPolicy(NoFocus);
270 mainLayout->addWidget( addBut,0,++ii ); 274 mainLayout->addWidget( addBut,0,++ii );
271 addBut->setPixmap ( SmallIcon("bell")); 275 addBut->setPixmap ( SmallIcon("bell"));
276 QWhatsThis::add( addBut, i18n("In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as \"do not use\". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.") );
272 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 277 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
273 addBut->setMaximumWidth( addBut->sizeHint().height() ); 278 addBut->setMaximumWidth( addBut->sizeHint().height() );
274 279
275 addBut = new QPushButton ( mw ); 280 addBut = new QPushButton ( mw );
276 addBut->setFocusPolicy(NoFocus); 281 addBut->setFocusPolicy(NoFocus);
277 mainLayout->addWidget( addBut,0,++ii ); 282 mainLayout->addWidget( addBut,0,++ii );
278 addBut->setPixmap ( SmallIcon("pencil")); 283 addBut->setPixmap ( SmallIcon("pencil"));
284 QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.") );
279 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 285 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
280 addBut->setMaximumWidth( addBut->sizeHint().height() ); 286 addBut->setMaximumWidth( addBut->sizeHint().height() );
281 lab = new QLabel ( "", mw ); 287 lab = new QLabel ( "", mw );
282 mainLayout->addWidget( lab,0,++ii ); 288 mainLayout->addWidget( lab,0,++ii );
283 289
284 addBut = new QPushButton ( mw ); 290 addBut = new QPushButton ( mw );
285 addBut->setFocusPolicy(NoFocus); 291 addBut->setFocusPolicy(NoFocus);
286 mainLayout->addWidget( addBut,0,++ii ); 292 mainLayout->addWidget( addBut,0,++ii );
287 addBut->setPixmap ( SmallIcon("plus")); 293 addBut->setPixmap ( SmallIcon("plus"));
288 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 294 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
289 295 QWhatsThis::add( addBut, i18n("Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.") );
290 lab = new QLabel ( " ", mw ); 296 lab = new QLabel ( " ", mw );
291 mainLayout->addWidget( lab,0,++ii ); 297 mainLayout->addWidget( lab,0,++ii );
292 298
293 299
294 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 300 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
295 int row = 1; 301 int row = 1;
296 bool errorLoadStandard = false; 302 bool errorLoadStandard = false;
297 while ( kkf ) { 303 while ( kkf ) {
298 int iii = 0; 304 int iii = 0;
299 KOCalRadioButton* rb = new KOCalRadioButton( mw ); 305 KOCalRadioButton* rb = new KOCalRadioButton( mw );
300 mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); 306 mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb );
301 rb->setChecked( kkf->isStandard ); 307 rb->setChecked( kkf->isStandard );
302 if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) ) 308 if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) )
303 errorLoadStandard = true; 309 errorLoadStandard = true;
304 rb->setNum( kkf->mCalNumber ); 310 rb->setNum( kkf->mCalNumber );
305 connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) ); 311 connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) );
306 if ( kkf->mErrorOnLoad || kkf->isReadOnly ) 312 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
307 rb->setEnabled( false ); 313 rb->setEnabled( false );
308 KOCalCheckButton* cb = new KOCalCheckButton( mw ); 314 KOCalCheckButton* cb = new KOCalCheckButton( mw );
309 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); 315 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
310 cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad ); 316 cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad );
311 cb->setNum( kkf->mCalNumber ); 317 cb->setNum( kkf->mCalNumber );
312 if ( kkf->mErrorOnLoad ) 318 if ( kkf->mErrorOnLoad )
313 cb->setEnabled( false ); 319 cb->setEnabled( false );
314 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 320 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
315 KOCalButton* name = new KOCalButton( mw ); 321 KOCalButton* name = new KOCalButton( mw );
316 name->setNum( kkf->mCalNumber ); 322 name->setNum( kkf->mCalNumber );
317 name->setText( kkf->mName ); 323 name->setText( kkf->mName );
318 mainLayout->addWidget( name,row,++iii ); 324 mainLayout->addWidget( name,row,++iii );
319 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); 325 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
320 //lab = new QLabel (" ", mw ); 326 //lab = new QLabel (" ", mw );
321 //mainLayout->addWidget( lab,row,++iii ); 327 //mainLayout->addWidget( lab,row,++iii );
322 cb = new KOCalCheckButton( mw ); 328 cb = new KOCalCheckButton( mw );
323 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); 329 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb );
324 cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad); 330 cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad);
325 cb->setNum( kkf->mCalNumber ); 331 cb->setNum( kkf->mCalNumber );
326 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); 332 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
327 if ( kkf->mErrorOnLoad ) 333 if ( kkf->mErrorOnLoad )
328 cb->setEnabled( false ); 334 cb->setEnabled( false );
329 cb = new KOCalCheckButton( mw ); 335 cb = new KOCalCheckButton( mw );
330 mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); 336 mainLayout->addWidget( cb,row,++iii );mROB.append( cb );
331 cb->setChecked( kkf->isReadOnly ); 337 cb->setChecked( kkf->isReadOnly );
332 cb->setNum( kkf->mCalNumber ); 338 cb->setNum( kkf->mCalNumber );
333 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); 339 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
334 if ( kkf->mErrorOnLoad ) 340 if ( kkf->mErrorOnLoad )
335 cb->setEnabled( false ); 341 cb->setEnabled( false );
336 if ( row > 1) { 342 if ( row > 1) {
337 KColorButton *colb = new KColorButton( mw ); 343 KColorButton *colb = new KColorButton( mw );
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index be7b5b6..d534dbf 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -16,108 +16,108 @@
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#ifndef KOFILTERVIEW_H 23#ifndef KOFILTERVIEW_H
24#define KOFILTERVIEW_H 24#define KOFILTERVIEW_H
25 25
26#include <qstring.h> 26#include <qstring.h>
27#include <qcheckbox.h> 27#include <qcheckbox.h>
28#include <qapplication.h> 28#include <qapplication.h>
29#include <qradiobutton.h> 29#include <qradiobutton.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qscrollview.h> 33#include <qscrollview.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <kconfig.h> 35#include <kconfig.h>
36#include "kofilterview_base.h" 36#include "kofilterview_base.h"
37 37
38#include <libkcal/calfilter.h> 38#include <libkcal/calfilter.h>
39 39
40#include <kurlrequester.h> 40#include <kurlrequester.h>
41#include <klineedit.h> 41#include <klineedit.h>
42#include <kglobal.h> 42#include <kglobal.h>
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44 44
45class QGridLayout; 45class QGridLayout;
46 46
47using namespace KCal; 47using namespace KCal;
48 48
49class KONewCalPrefs : public QDialog 49class KONewCalPrefs : public QDialog
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 public: 52 public:
53 KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : 53 KONewCalPrefs( QWidget *parent=0, const char *name=0 ) :
54 QDialog( parent, name, true ) 54 QDialog( parent, name, true )
55 { 55 {
56 setCaption( i18n("Add new Calendar") ); 56 setCaption( i18n("Add new Calendar") );
57 QVBoxLayout* lay = new QVBoxLayout( this ); 57 QVBoxLayout* lay = new QVBoxLayout( this );
58 lay->setSpacing( 3 ); 58 lay->setSpacing( 3 );
59 lay->setMargin( 3 ); 59 lay->setMargin( 3 );
60 QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); 60 QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this );
61 lay->addWidget( lab ); 61 lay->addWidget( lab );
62 nameE = new KLineEdit( this ); 62 nameE = new KLineEdit( this );
63 lay->addWidget( nameE ); 63 lay->addWidget( nameE );
64 lab = new QLabel( i18n("<b>Local ical (*.ics) file:</b>"), this ); 64 lab = new QLabel( i18n("<b>iCal (*.ics) file on disk:</b><br>(will be created, if not existing)"), this );
65 lay->addWidget( lab ); 65 lay->addWidget( lab );
66 url = new KURLRequester ( this ); 66 url = new KURLRequester ( this );
67 lay->addWidget( url ); 67 lay->addWidget( url );
68 QPushButton * ok = new QPushButton( i18n("OK"), this ); 68 QPushButton * ok = new QPushButton( i18n("OK"), this );
69 lay->addWidget( ok ); 69 lay->addWidget( ok );
70 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 70 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
71 lay->addWidget( cancel ); 71 lay->addWidget( cancel );
72 connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) ); 72 connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) );
73 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 73 connect (cancel, SIGNAL( clicked() ), this, SLOT ( reject()) );
74 int minwid = 220; 74 int minwid = 440;
75 if ( QApplication::desktop()->width() >= 320 ) minwid = 300; 75 if ( QApplication::desktop()->width() < 480 ) minwid = 220;
76 setMinimumWidth( minwid ); 76 setMinimumWidth( minwid );
77 resize(sizeHint() ); 77 resize(sizeHint() );
78 } 78 }
79 79
80 QString calName() { return nameE->text(); } 80 QString calName() { return nameE->text(); }
81 QString calFileName() { return url->url(); } 81 QString calFileName() { return url->url(); }
82 82
83public slots: 83public slots:
84void checkValid() { 84void checkValid() {
85 if ( nameE->text().isEmpty() ) { 85 if ( nameE->text().isEmpty() ) {
86 KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") ); 86 KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") );
87 nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () )); 87 nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () ));
88 return; 88 return;
89 } 89 }
90 if ( url->url().isEmpty() ) { 90 if ( url->url().isEmpty() ) {
91 KMessageBox::information( this, i18n("Sorry, the file name is empty!") ); 91 KMessageBox::information( this, i18n("Sorry, the file name is empty!") );
92 url->setURL( nameE->text() + ".ics" ); 92 url->setURL( nameE->text() + ".ics" );
93 return; 93 return;
94 } 94 }
95 accept(); 95 accept();
96} 96}
97 97
98public: 98public:
99 KLineEdit* nameE; 99 KLineEdit* nameE;
100 KURLRequester *url; 100 KURLRequester *url;
101}; 101};
102 102
103class KOCalButton : public QPushButton 103class KOCalButton : public QPushButton
104{ 104{
105 Q_OBJECT 105 Q_OBJECT
106 public: 106 public:
107 KOCalButton( QWidget *parent=0, const char *name=0 ) : 107 KOCalButton( QWidget *parent=0, const char *name=0 ) :
108 QPushButton( parent, name) 108 QPushButton( parent, name)
109 { 109 {
110 connect( this, SIGNAL( clicked() ), 110 connect( this, SIGNAL( clicked() ),
111 SLOT( bottonClicked() )); 111 SLOT( bottonClicked() ));
112 mNumber = -1; 112 mNumber = -1;
113 setFocusPolicy(NoFocus); 113 setFocusPolicy(NoFocus);
114 } 114 }
115 void setNum ( int num ) {mNumber = num; } 115 void setNum ( int num ) {mNumber = num; }
116 signals: 116 signals:
117 void selectNum ( int ); 117 void selectNum ( int );
118private: 118private:
119 int mNumber; 119 int mNumber;
120 void keyPressEvent ( QKeyEvent * e ) 120 void keyPressEvent ( QKeyEvent * e )
121 { 121 {
122 e->ignore(); 122 e->ignore();
123 } 123 }
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 27d755e..17248dc 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -438,166 +438,181 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
438 438
439 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 439 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
440 switch ( e->key() ) { 440 switch ( e->key() ) {
441 case Qt::Key_Down: 441 case Qt::Key_Down:
442 case Qt::Key_Up: 442 case Qt::Key_Up:
443 QListView::keyPressEvent ( e ); 443 QListView::keyPressEvent ( e );
444 e->accept(); 444 e->accept();
445 break; 445 break;
446 case Qt::Key_Left: 446 case Qt::Key_Left:
447 case Qt::Key_Right: 447 case Qt::Key_Right:
448 QListView::keyPressEvent ( e ); 448 QListView::keyPressEvent ( e );
449 e->accept(); 449 e->accept();
450 return; 450 return;
451 break; 451 break;
452 default: 452 default:
453 e->ignore(); 453 e->ignore();
454 break; 454 break;
455 } 455 }
456 return; 456 return;
457 } 457 }
458 e->ignore(); 458 e->ignore();
459} 459}
460void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 460void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
461{ 461{
462 QListView::contentsMouseReleaseEvent(e); 462 QListView::contentsMouseReleaseEvent(e);
463 mMousePressed = false; 463 mMousePressed = false;
464} 464}
465 465
466void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 466void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
467{ 467{
468 if (!e) return; 468 if (!e) return;
469 469
470 QPoint vp = contentsToViewport(e->pos()); 470 QPoint vp = contentsToViewport(e->pos());
471 471
472 QListViewItem *item = itemAt(vp); 472 QListViewItem *item = itemAt(vp);
473 473
474 emit double_Clicked(item); 474 emit double_Clicked(item);
475 if (!item) return; 475 if (!item) return;
476 476
477 emit doubleClicked(item,vp,0); 477 emit doubleClicked(item,vp,0);
478} 478}
479 479
480///////////////////////////////////////////////////////////////////////////// 480/////////////////////////////////////////////////////////////////////////////
481 481
482KOQuickTodo::KOQuickTodo(QWidget *parent) : 482KOQuickTodo::KOQuickTodo(QWidget *parent) :
483 QLineEdit(parent) 483 QLineEdit(parent)
484{ 484{
485 setText(i18n("Click to add new Todo")); 485 setText(i18n("Click to add new Todo"));
486 setFocusPolicy ( QWidget::ClickFocus );
486} 487}
487 488
488void KOQuickTodo::focusInEvent(QFocusEvent *ev) 489void KOQuickTodo::focusInEvent(QFocusEvent *ev)
489{ 490{
490 if ( text()==i18n("Click to add new Todo") ) 491 if ( text()==i18n("Click to add new Todo") )
491 setText(""); 492 setText("");
492 QLineEdit::focusInEvent(ev); 493 QLineEdit::focusInEvent(ev);
493} 494}
494 495
495void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 496void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
496{ 497{
497 setText(i18n("Click to add new Todo")); 498 setText(i18n("Click to add new Todo"));
498 QLineEdit::focusOutEvent(ev); 499 QLineEdit::focusOutEvent(ev);
499} 500}
500 501
501///////////////////////////////////////////////////////////////////////////// 502/////////////////////////////////////////////////////////////////////////////
502 503
503KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 504KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
504 KOrg::BaseView(calendar,parent,name) 505 KOrg::BaseView(calendar,parent,name)
505{ 506{
506 mActiveItem = 0; 507 mActiveItem = 0;
507 mCategoryPopupMenu = 0; 508 mCategoryPopupMenu = 0;
508 mPendingUpdateBeforeRepaint = false; 509 mPendingUpdateBeforeRepaint = false;
509 isFlatDisplay = false; 510 isFlatDisplay = false;
510 mNavigator = 0; 511 mNavigator = 0;
511 QBoxLayout *topLayout = new QVBoxLayout(this); 512 QBoxLayout *topLayout = new QVBoxLayout(this);
512 mName = QString ( name ); 513 mName = QString ( name );
513 mBlockUpdate = false; 514 mBlockUpdate = false;
514 mQuickBar = new QWidget( this ); 515 mQuickBar = new QWidget( this );
515 topLayout->addWidget(mQuickBar); 516 topLayout->addWidget(mQuickBar);
516 517
517 mQuickAdd = new KOQuickTodo(mQuickBar); 518 mQuickAdd = new KOQuickTodo(mQuickBar);
518 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); 519 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar);
519 quickLayout->addWidget( mQuickAdd ); 520 quickLayout->addWidget( mQuickAdd );
520 mNewSubBut = new QPushButton( "sub",mQuickBar ); 521 mNewSubBut = new QPushButton( "sub",mQuickBar );
521 QPushButton * s_done = new QPushButton( "D",mQuickBar ); 522 QPushButton * s_done = new QPushButton( "D",mQuickBar );
522 QPushButton * s_run = new QPushButton( "R",mQuickBar ); 523 QPushButton * s_run = new QPushButton( "R",mQuickBar );
523 QPushButton * allopen = new QPushButton( "O",mQuickBar ); 524 QPushButton * allopen = new QPushButton( "O",mQuickBar );
524 QPushButton * allclose = new QPushButton( "C",mQuickBar ); 525 QPushButton * allclose = new QPushButton( "C",mQuickBar );
525 QPushButton * flat = new QPushButton( "F",mQuickBar ); 526 QPushButton * flat = new QPushButton( "F",mQuickBar );
526 527
527 int fixwid = mQuickAdd->sizeHint().height(); 528 int fixwid = mQuickAdd->sizeHint().height();
528 int fixhei = fixwid; 529 int fixhei = fixwid;
529 if ( QApplication::desktop()->width() > 800 ) 530 if ( QApplication::desktop()->width() > 800 )
530 fixwid = (fixwid*3)/2; 531 fixwid = (fixwid*3)/2;
531 connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); 532 connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat()));
532 connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); 533 connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen()));
533 connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); 534 connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose()));
534 s_done->setPixmap( SmallIcon("greenhook16")); 535 s_done->setPixmap( SmallIcon("greenhook16"));
535 connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); 536 connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted()));
536 s_run->setPixmap( SmallIcon("ko16old")); 537 s_run->setPixmap( SmallIcon("ko16old"));
537 connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); 538 connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning()));
538 539
539 connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); 540 connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo()));
540 541
541 mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); 542 mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() );
542 mNewSubBut->setEnabled( false ); 543 mNewSubBut->setEnabled( false );
543 flat->setFixedWidth( fixwid ); 544 flat->setFixedWidth( fixwid );
544 s_done->setFixedWidth( fixwid ); 545 s_done->setFixedWidth( fixwid );
545 allopen->setFixedWidth( fixwid ); 546 allopen->setFixedWidth( fixwid );
546 allclose->setFixedWidth( fixwid ); 547 allclose->setFixedWidth( fixwid );
547 s_run->setFixedWidth( fixwid ); 548 s_run->setFixedWidth( fixwid );
548 549
549 flat->setFixedHeight(fixhei ); 550 flat->setFixedHeight(fixhei );
550 s_done->setFixedHeight(fixhei ); 551 s_done->setFixedHeight(fixhei );
551 allopen->setFixedHeight(fixhei ); 552 allopen->setFixedHeight(fixhei );
552 allclose->setFixedHeight(fixhei ); 553 allclose->setFixedHeight(fixhei );
553 s_run->setFixedHeight(fixhei ); 554 s_run->setFixedHeight(fixhei );
554 mNewSubBut->setFixedHeight(fixhei ); 555 mNewSubBut->setFixedHeight(fixhei );
556
557 flat->setFocusPolicy( NoFocus );
558 s_done->setFocusPolicy( NoFocus );
559 allopen->setFocusPolicy( NoFocus );
560 allclose->setFocusPolicy( NoFocus );
561 s_run->setFocusPolicy( NoFocus );
562 mNewSubBut->setFocusPolicy( NoFocus );
555 563
564 QWhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) );
565 QWhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) );
566 QWhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) );
567 QWhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) );
568 QWhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) );
569 QWhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) );
570
556 quickLayout->addWidget( mNewSubBut ); 571 quickLayout->addWidget( mNewSubBut );
557 quickLayout->addWidget( s_done ); 572 quickLayout->addWidget( s_done );
558 quickLayout->addWidget( s_run ); 573 quickLayout->addWidget( s_run );
559 quickLayout->addWidget( allopen ); 574 quickLayout->addWidget( allopen );
560 quickLayout->addWidget( allclose ); 575 quickLayout->addWidget( allclose );
561 quickLayout->addWidget( flat ); 576 quickLayout->addWidget( flat );
562 577
563 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); 578 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide();
564 579
565 mTodoListView = new KOTodoListView(calendar,this, name ); 580 mTodoListView = new KOTodoListView(calendar,this, name );
566 topLayout->addWidget(mTodoListView); 581 topLayout->addWidget(mTodoListView);
567 //mTodoListView->header()->setMaximumHeight(30); 582 //mTodoListView->header()->setMaximumHeight(30);
568 mTodoListView->setRootIsDecorated(true); 583 mTodoListView->setRootIsDecorated(true);
569 mTodoListView->setAllColumnsShowFocus(true); 584 mTodoListView->setAllColumnsShowFocus(true);
570 585
571 mTodoListView->setShowSortIndicator(true); 586 mTodoListView->setShowSortIndicator(true);
572 587
573 mTodoListView->addColumn(i18n("Todo")); 588 mTodoListView->addColumn(i18n("Todo"));
574 mTodoListView->addColumn(i18n("Prio")); 589 mTodoListView->addColumn(i18n("Prio"));
575 mTodoListView->setColumnAlignment(1,AlignHCenter); 590 mTodoListView->setColumnAlignment(1,AlignHCenter);
576 mTodoListView->addColumn(i18n("Complete")); 591 mTodoListView->addColumn(i18n("Complete"));
577 mTodoListView->setColumnAlignment(2,AlignCenter); 592 mTodoListView->setColumnAlignment(2,AlignCenter);
578 593
579 mTodoListView->addColumn(i18n("Due Date")); 594 mTodoListView->addColumn(i18n("Due Date"));
580 mTodoListView->setColumnAlignment(3,AlignLeft); 595 mTodoListView->setColumnAlignment(3,AlignLeft);
581 mTodoListView->addColumn(i18n("Due Time")); 596 mTodoListView->addColumn(i18n("Due Time"));
582 mTodoListView->setColumnAlignment(4,AlignHCenter); 597 mTodoListView->setColumnAlignment(4,AlignHCenter);
583 598
584 mTodoListView->addColumn(i18n("Start Date")); 599 mTodoListView->addColumn(i18n("Start Date"));
585 mTodoListView->setColumnAlignment(5,AlignLeft); 600 mTodoListView->setColumnAlignment(5,AlignLeft);
586 mTodoListView->addColumn(i18n("Start Time")); 601 mTodoListView->addColumn(i18n("Start Time"));
587 mTodoListView->setColumnAlignment(6,AlignHCenter); 602 mTodoListView->setColumnAlignment(6,AlignHCenter);
588 603
589 //mTodoListView->addColumn(i18n("Cancelled")); 604 //mTodoListView->addColumn(i18n("Cancelled"));
590 mTodoListView->addColumn(i18n("Categories")); 605 mTodoListView->addColumn(i18n("Categories"));
591 mTodoListView->addColumn(i18n("Calendar")); 606 mTodoListView->addColumn(i18n("Calendar"));
592 mTodoListView->addColumn(i18n("Last Modified")); 607 mTodoListView->addColumn(i18n("Last Modified"));
593 mTodoListView->addColumn(i18n("Created")); 608 mTodoListView->addColumn(i18n("Created"));
594 mTodoListView->addColumn(i18n("Last Modified Sub")); 609 mTodoListView->addColumn(i18n("Last Modified Sub"));
595#if 0 610#if 0
596 mTodoListView->addColumn(i18n("Sort Id")); 611 mTodoListView->addColumn(i18n("Sort Id"));
597 mTodoListView->setColumnAlignment(4,AlignHCenter); 612 mTodoListView->setColumnAlignment(4,AlignHCenter);
598#endif 613#endif
599 614
600 mTodoListView->setMinimumHeight( 60 ); 615 mTodoListView->setMinimumHeight( 60 );
601 mTodoListView->setItemsRenameable( true ); 616 mTodoListView->setItemsRenameable( true );
602 mTodoListView->setRenameable( 0 ); 617 mTodoListView->setRenameable( 0 );
603 mTodoListView->setColumnWidth( 0, 120 ); 618 mTodoListView->setColumnWidth( 0, 120 );