summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt6
-rw-r--r--korganizer/kolistview.cpp79
-rw-r--r--korganizer/kolistview.h135
3 files changed, 216 insertions, 4 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index ec08321..6abf802 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -129,25 +129,25 @@
129{ "Delete All","Lösche alles" }, 129{ "Delete All","Lösche alles" },
130{ "Delete all selected","Lösche alle Selektierten" }, 130{ "Delete all selected","Lösche alle Selektierten" },
131{ "Delete Current","Aktuellen löschen" }, 131{ "Delete Current","Aktuellen löschen" },
132{ "Delete Event...","Lösche Termin..." }, 132{ "Delete Event...","Lösche Termin..." },
133{ "Delete Event","Lösche Termin" }, 133{ "Delete Event","Lösche Termin" },
134{ "&Delete","Löschen" }, 134{ "&Delete","Löschen" },
135{ "Delete...","Löschen..." }, 135{ "Delete...","Löschen..." },
136{ "Delete","Löschen" }, 136{ "Delete","Löschen" },
137{ "Delete Todo...","Lösche Todo..." }, 137{ "Delete Todo...","Lösche Todo..." },
138{ "Delete To-Do","Lösche Todo" }, 138{ "Delete To-Do","Lösche Todo" },
139{ "Deleting item %d ...","Lösche Eintrag %d..." }, 139{ "Deleting item %d ...","Lösche Eintrag %d..." },
140{ "Descriptions","Beschreibungen" }, 140{ "Descriptions","Beschreibungen" },
141{ "Deselect All","Deselektiere Alle" }, 141{ "Deselect all","Deselektiere Alle" },
142{ "Details","Details" }, 142{ "Details","Details" },
143{ "Dinner","Abendessen" }, 143{ "Dinner","Abendessen" },
144{ "Do you really want\nto close KO/Pi?","Möchten Sie wirklich\nKO/PI verlassen?" }, 144{ "Do you really want\nto close KO/Pi?","Möchten Sie wirklich\nKO/PI verlassen?" },
145{ "Due Date","Fällig am" }, 145{ "Due Date","Fällig am" },
146{ "Due: ","Fällig: "}, 146{ "Due: ","Fällig: "},
147{ "Due Time","Fällig um" }, 147{ "Due Time","Fällig um" },
148{ "Due:","Fällig:"}, 148{ "Due:","Fällig:"},
149{ "Duration: ","Dauer: " }, 149{ "Duration: ","Dauer: " },
150{ "Edit...","Bearbeite..." }, 150{ "Edit...","Bearbeite..." },
151{ "Edit","Bearbeite" }, 151{ "Edit","Bearbeite" },
152{ "Edit Event...","Bearbeite Termin..." }, 152{ "Edit Event...","Bearbeite Termin..." },
153{ "Edit Event","Bearbeite Termin" }, 153{ "Edit Event","Bearbeite Termin" },
@@ -1198,15 +1198,19 @@
1198{ "Next days","Nächste Tage" }, 1198{ "Next days","Nächste Tage" },
1199{ "Next week","Nächste Woche" }, 1199{ "Next week","Nächste Woche" },
1200{ "Next two weeks","Nächste zwei Wochen" }, 1200{ "Next two weeks","Nächste zwei Wochen" },
1201{ "Next month","Nächster Monat" }, 1201{ "Next month","Nächster Monat" },
1202{ "Journal view","Journal" }, 1202{ "Journal view","Journal" },
1203{ "Display all opened","Zeige alle geöffnet" }, 1203{ "Display all opened","Zeige alle geöffnet" },
1204{ "Display all closed","Zeige alle geschlossen" }, 1204{ "Display all closed","Zeige alle geschlossen" },
1205{ "Display all flat","Zeige alle flach" }, 1205{ "Display all flat","Zeige alle flach" },
1206{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" }, 1206{ "<p><i>Completed on %1</i></p>","<p><i>Erledigt am %1</i></p>" },
1207{ "Default todo done color:","Standard Todo erledigt Farbe" }, 1207{ "Default todo done color:","Standard Todo erledigt Farbe" },
1208{ "Select week %1-%2","Selektiere Woche %1-%2" }, 1208{ "Select week %1-%2","Selektiere Woche %1-%2" },
1209{ "Select Week","Selektiere Woche" }, 1209{ "Select Week","Selektiere Woche" },
1210{ "Set alarm for selected...","Setze Alarm für Selekt..." },
1211{ "Set reminder offset to:","Setze Alarm Offset auf:" },
1212{ "Set Alarm!","Setze Alarm!" },
1213{ "Canged alarm for %1 items","Alarm für %1 Items geändert" },
1210{ "","" }, 1214{ "","" },
1211{ "","" }, 1215{ "","" },
1212{ "","" }, 1216{ "","" },
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 732fc46..d4d9c0f 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -56,24 +56,26 @@
56#endif 56#endif
57 57
58#ifndef KORG_NOPRINTER 58#ifndef KORG_NOPRINTER
59#include "calprinter.h" 59#include "calprinter.h"
60#endif 60#endif
61#include "koglobals.h" 61#include "koglobals.h"
62#include "koprefs.h" 62#include "koprefs.h"
63#include "kfiledialog.h" 63#include "kfiledialog.h"
64 64
65#include "kolistview.h" 65#include "kolistview.h"
66 66
67 67
68
69
68class KOListViewWhatsThis :public QWhatsThis 70class KOListViewWhatsThis :public QWhatsThis
69{ 71{
70public: 72public:
71 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
72 74
73protected: 75protected:
74 virtual QString text( const QPoint& p) 76 virtual QString text( const QPoint& p)
75 { 77 {
76 return _view->getWhatsThisText(p) ; 78 return _view->getWhatsThisText(p) ;
77 } 79 }
78private: 80private:
79 QWidget* _wid; 81 QWidget* _wid;
@@ -248,47 +250,51 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
248 int iii = 0; 250 int iii = 0;
249 for ( iii = 0; iii< 10 ; ++iii ) 251 for ( iii = 0; iii< 10 ; ++iii )
250 mListView->setColumnWidthMode( iii, QListView::Manual ); 252 mListView->setColumnWidthMode( iii, QListView::Manual );
251 253
252 QBoxLayout *layoutTop = new QVBoxLayout(this); 254 QBoxLayout *layoutTop = new QVBoxLayout(this);
253 layoutTop->addWidget(mListView); 255 layoutTop->addWidget(mListView);
254 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 256 mListView->setFont ( KOPrefs::instance()->mListViewFont );
255 mPopupMenu = eventPopup(); 257 mPopupMenu = eventPopup();
256 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
257 i18n("Select all"),this, 259 i18n("Select all"),this,
258 SLOT(allSelection()),true); 260 SLOT(allSelection()),true);
259 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
260 i18n("Deselect All"),this, 262 i18n("Deselect all"),this,
261 SLOT(clearSelection()),true); 263 SLOT(clearSelection()),true);
262 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
263 i18n("Delete all selected"),this, 265 i18n("Delete all selected"),this,
264 SLOT(deleteAll()),true); 266 SLOT(deleteAll()),true);
265 mPopupMenu->insertSeparator(); 267 mPopupMenu->insertSeparator();
266 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
267 i18n("Save selected to file..."),this, 269 i18n("Save selected to file..."),this,
268 SLOT(saveToFile()),true); 270 SLOT(saveToFile()),true);
269 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
270 i18n("Save Journal/Description..."),this, 272 i18n("Save Journal/Description..."),this,
271 SLOT(saveDescriptionToFile()),true); 273 SLOT(saveDescriptionToFile()),true);
272 mPopupMenu->insertSeparator(); 274 // mPopupMenu->insertSeparator();
273 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
274 i18n("Add Categ. to selected..."),this, 276 i18n("Add Categ. to selected..."),this,
275 SLOT(addCat()),true); 277 SLOT(addCat()),true);
276 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
277 i18n("Set Categ. for selected..."),this, 279 i18n("Set Categ. for selected..."),this,
278 SLOT(setCat()),true); 280 SLOT(setCat()),true);
279 mPopupMenu->insertSeparator(); 281 //mPopupMenu->insertSeparator();
282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
283 i18n("Set alarm for selected..."),this,
284 SLOT(setAlarm()),true);
280 285
281 286
282#ifndef DESKTOP_VERSION 287#ifndef DESKTOP_VERSION
288 mPopupMenu->insertSeparator();
283 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
284 i18n("Beam selected via IR"),this, 290 i18n("Beam selected via IR"),this,
285 SLOT(beamSelected()),true); 291 SLOT(beamSelected()),true);
286#endif 292#endif
287 /* 293 /*
288 mPopupMenu = new QPopupMenu; 294 mPopupMenu = new QPopupMenu;
289 mPopupMenu->insertItem(i18n("Edit Event"), this, 295 mPopupMenu->insertItem(i18n("Edit Event"), this,
290 SLOT (editEvent())); 296 SLOT (editEvent()));
291 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
292 SLOT (deleteEvent())); 298 SLOT (deleteEvent()));
293 mPopupMenu->insertSeparator(); 299 mPopupMenu->insertSeparator();
294 mPopupMenu->insertItem(i18n("Show Dates"), this, 300 mPopupMenu->insertItem(i18n("Show Dates"), this,
@@ -329,24 +335,91 @@ void KOListView::updateList()
329 // qDebug(" KOListView::updateList() "); 335 // qDebug(" KOListView::updateList() ");
330 336
331} 337}
332 338
333void KOListView::addCat( ) 339void KOListView::addCat( )
334{ 340{
335 setCategories( false ); 341 setCategories( false );
336} 342}
337void KOListView::setCat() 343void KOListView::setCat()
338{ 344{
339 setCategories( true ); 345 setCategories( true );
340} 346}
347void KOListView::setAlarm()
348{
349 KOAlarmPrefs kap( this);
350 if ( !kap.exec() )
351 return;
352
353
354 QStringList itemList;
355 QPtrList<KOListViewItem> sel ;
356 QListViewItem *qitem = mListView->firstChild ();
357 while ( qitem ) {
358 if ( qitem->isSelected() ) {
359 sel.append(((KOListViewItem *)qitem));
360 }
361 qitem = qitem->nextSibling();
362 }
363 int count = 0;
364 KOListViewItem * item, *temp;
365 item = sel.first();
366 Incidence* inc;
367 while ( item ) {
368 inc = item->data();
369 if ( inc->type() != "Journal" ) {
370 ++count;
371 if (kap.mAlarmButton->isChecked()) {
372 if (inc->alarms().count() == 0)
373 inc->newAlarm();
374 QPtrList<Alarm> alarms = inc->alarms();
375 Alarm *alarm;
376 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
377 alarm->setEnabled(true);
378 int j = kap.mAlarmTimeEdit->value()* -60;
379 if (kap.mAlarmIncrCombo->currentItem() == 1)
380 j = j * 60;
381 else if (kap.mAlarmIncrCombo->currentItem() == 2)
382 j = j * (60 * 24);
383 alarm->setStartOffset( j );
384
385 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
386 alarm->setProcedureAlarm(kap.mAlarmProgram);
387 }
388 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
389 alarm->setAudioAlarm(kap.mAlarmSound);
390 else
391 alarm->setType(Alarm::Invalid);
392 //alarm->setAudioAlarm("default");
393 // TODO: Deal with multiple alarms
394 break; // For now, stop after the first alarm
395 }
396 } else {
397 Alarm* alarm = inc->alarms().first();
398 if ( alarm ) {
399 alarm->setEnabled(false);
400 alarm->setType(Alarm::Invalid);
401 }
402 }
403 }
404 temp = item;
405 item = sel.next();
406 mUidDict.remove( inc->uid() );
407 delete temp;;
408 addIncidence( inc );
409 }
410 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
411 qDebug("KO: Set alarm for %d items", count);
412 calendar()->reInitAlarmSettings();
413}
341void KOListView::setCategories( bool removeOld ) 414void KOListView::setCategories( bool removeOld )
342{ 415{
343 416
344 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 417 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
345 if (! csd->exec()) { 418 if (! csd->exec()) {
346 delete csd; 419 delete csd;
347 return; 420 return;
348 } 421 }
349 QStringList catList = csd->selectedCategories(); 422 QStringList catList = csd->selectedCategories();
350 delete csd; 423 delete csd;
351 // if ( catList.count() == 0 ) 424 // if ( catList.count() == 0 )
352 // return; 425 // return;
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index be9b09c..78004fe 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -33,24 +33,158 @@
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/incidence.h> 38#include <libkcal/incidence.h>
39 39
40#include "koeventview.h" 40#include "koeventview.h"
41#include "customlistviewitem.h" 41#include "customlistviewitem.h"
42 42
43using namespace KCal; 43using namespace KCal;
44 44
45
46
47#include <qpushbutton.h>
48#include <qlayout.h>
49#include <qdialog.h>
50#include <qcombobox.h>
51#include <qspinbox.h>
52#include <qtooltip.h>
53#include <qcheckbox.h>
54#include <qhbox.h>
55#include <qlabel.h>
56#include <kiconloader.h>
57#include "kfiledialog.h"
58#include "koprefs.h"
59class KOAlarmPrefs : public QDialog
60{
61 Q_OBJECT
62 public:
63 KOAlarmPrefs( QWidget *par=0, const char *name=0 ) :
64 QDialog( par, name, true )
65 {
66 setCaption( i18n("Alarm Options") );
67 QVBoxLayout* alarmLayout = new QVBoxLayout( this );
68 alarmLayout->setSpacing( 3 );
69 alarmLayout->setMargin( 3 );
70 QWidget *parent = this;
71 mAlarmButton = new QCheckBox(i18n("Set reminder offset to:"),parent);
72 alarmLayout->addWidget(mAlarmButton);
73 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
74 mAlarmTimeEdit->setValue( 15 );
75 alarmLayout->addWidget(mAlarmTimeEdit);
76 mAlarmIncrCombo = new QComboBox(false, parent);
77 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
78 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
79 mAlarmIncrCombo->insertItem(i18n("day(s)"));
80 alarmLayout->addWidget(mAlarmIncrCombo);
81 QHBox * hb = new QHBox ( parent );
82 alarmLayout->addWidget(hb);
83 mAlarmSoundButton = new QPushButton(hb);
84 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
85 mAlarmSoundButton->setToggleButton(true);
86 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
87 mAlarmProgramButton = new QPushButton(hb);
88 mAlarmProgramButton->setPixmap(SmallIcon("run"));
89 mAlarmProgramButton->setToggleButton(true);
90 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
91 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
92 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
93 mAlarmLabel = new QLabel( this );
94 alarmLayout->addWidget( mAlarmLabel );
95 mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) );
96 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
97 mAlarmSoundButton->setOn( true );
98 QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this );
99 alarmLayout->addWidget( ok );
100 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
101 alarmLayout->addWidget( cancel );
102 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
103 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
104 resize( 200, 200 );
105
106 }
107
108
109
110 QString mAlarmSound, mAlarmProgram ;
111 QCheckBox* mAlarmButton;
112 QSpinBox* mAlarmTimeEdit;
113 QLabel* mAlarmLabel;
114 QComboBox* mAlarmIncrCombo ;
115 QPushButton* mAlarmSoundButton ,*mAlarmProgramButton;
116private slots:
117
118void pickAlarmSound()
119{
120 //QString prefix = mAlarmSound;
121 if (!mAlarmSoundButton->isOn()) {
122 //mAlarmSound = "";
123 QToolTip::remove(mAlarmSoundButton);
124 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
125 mAlarmProgramButton->setOn(true);
126 mAlarmSoundButton->setOn(false);
127 } else {
128 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
129 i18n("*.wav|Wav Files"), 0));
130 if (!fileName.isEmpty()) {
131 mAlarmSound = fileName;
132 mAlarmLabel->setText( "..."+fileName.right( 30 ) );
133 QToolTip::remove(mAlarmSoundButton);
134 QString dispStr = i18n("Playing '%1'").arg(fileName);
135 QToolTip::add(mAlarmSoundButton, dispStr);
136 mAlarmProgramButton->setOn(false);
137 mAlarmSoundButton->setOn(true);
138 } else {
139 mAlarmProgramButton->setOn(true);
140 mAlarmSoundButton->setOn(false);
141
142 }
143 }
144};
145
146void pickAlarmProgram()
147{
148 if (!mAlarmProgramButton->isOn()) {
149 //mAlarmProgram = "";
150 QToolTip::remove(mAlarmProgramButton);
151 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
152 mAlarmProgramButton->setOn(false);
153 mAlarmSoundButton->setOn(true);
154 } else {
155 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0));
156 if (!fileName.isEmpty()) {
157 mAlarmProgram = fileName;
158 mAlarmLabel->setText( "..."+fileName.right( 30 ) );
159 QToolTip::remove(mAlarmProgramButton);
160 QString dispStr = i18n("Running '%1'").arg(fileName);
161 QToolTip::add(mAlarmProgramButton, dispStr);
162 mAlarmSoundButton->setOn(false);
163 mAlarmProgramButton->setOn(true);
164 } else {
165 mAlarmProgramButton->setOn(false);
166 mAlarmSoundButton->setOn(true);
167 }
168 }
169};
170
171};
172
173
174
175
176
177
178
45typedef CustomListViewItem<Incidence *> KOListViewItem; 179typedef CustomListViewItem<Incidence *> KOListViewItem;
46 180
47/** 181/**
48 This class provides the initialisation of a KOListViewItem for calendar 182 This class provides the initialisation of a KOListViewItem for calendar
49 components using the Incidence::Visitor. 183 components using the Incidence::Visitor.
50*/ 184*/
51class ListItemVisitor : public Incidence::Visitor 185class ListItemVisitor : public Incidence::Visitor
52{ 186{
53 public: 187 public:
54 ListItemVisitor(KOListViewItem *, QDate d); 188 ListItemVisitor(KOListViewItem *, QDate d);
55 ~ListItemVisitor(); 189 ~ListItemVisitor();
56 190
@@ -133,24 +267,25 @@ class KOListView : public KOEventView
133 267
134 void clear(); 268 void clear();
135 void beamDone( Ir *ir ); 269 void beamDone( Ir *ir );
136 void showDates(); 270 void showDates();
137 void hideDates(); 271 void hideDates();
138 void deleteAll(); 272 void deleteAll();
139 void saveToFile(); 273 void saveToFile();
140 void saveDescriptionToFile(); 274 void saveDescriptionToFile();
141 void beamSelected(); 275 void beamSelected();
142 void updateConfig(); 276 void updateConfig();
143 void addCat(); 277 void addCat();
144 void setCat(); 278 void setCat();
279 void setAlarm();
145 void setCategories( bool removeOld ); 280 void setCategories( bool removeOld );
146 void changeEventDisplay(Event *, int); 281 void changeEventDisplay(Event *, int);
147 282
148 void defaultItemAction(QListViewItem *item); 283 void defaultItemAction(QListViewItem *item);
149 void popupMenu(QListViewItem *item,const QPoint &,int); 284 void popupMenu(QListViewItem *item,const QPoint &,int);
150 285
151 protected slots: 286 protected slots:
152 void processSelectionChange(QListViewItem *); 287 void processSelectionChange(QListViewItem *);
153 288
154 protected: 289 protected:
155 void addEvents(QPtrList<Event> eventList); 290 void addEvents(QPtrList<Event> eventList);
156 void addIncidence(Incidence *); 291 void addIncidence(Incidence *);