summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-26 20:29:59 (UTC)
committer zautrix <zautrix>2005-03-26 20:29:59 (UTC)
commitc9c3f9e65a72a3c79d7f67eba68fca4537004808 (patch) (unidiff)
tree395970dbf2b5aad3cdafe195e7a9958f5cc8aa15
parent36dd498ad2f5a2cf43fc08c621669fe42198e5eb (diff)
downloadkdepimpi-c9c3f9e65a72a3c79d7f67eba68fca4537004808.zip
kdepimpi-c9c3f9e65a72a3c79d7f67eba68fca4537004808.tar.gz
kdepimpi-c9c3f9e65a72a3c79d7f67eba68fca4537004808.tar.bz2
better timer
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp108
-rw-r--r--kalarmd/simplealarmdaemonimpl.h35
-rw-r--r--korganizer/koeditorgeneral.cpp1
-rw-r--r--korganizer/searchdialog.cpp5
5 files changed, 135 insertions, 18 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index a8035d4..b6293b5 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1242,68 +1242,72 @@
1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" }, 1242{ "Click on this to\nselect week number","Klicke hierauf um\ndie Woche auszuwählen" },
1243{ "T: %1","T: %1" }, 1243{ "T: %1","T: %1" },
1244{ "Start: ","Start: " }, 1244{ "Start: ","Start: " },
1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " }, 1245{ "Pi-Sync options for device: ","Pi-Sync Einstellungen für Gerät: " },
1246{ "Password for remote access:","Passwort für fernen Zugriff:" }, 1246{ "Password for remote access:","Passwort für fernen Zugriff:" },
1247{ "Remote IP address:","Ferne IP Adresse:" }, 1247{ "Remote IP address:","Ferne IP Adresse:" },
1248{ "Remote port number:","Ferne Port Nummer:" }, 1248{ "Remote port number:","Ferne Port Nummer:" },
1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." }, 1249{ "Remote file saved to temp file.","Ferne Daten in temp Datei gespeichert." },
1250{ "Remote from: ","Fern von: " }, 1250{ "Remote from: ","Fern von: " },
1251{ "Local from: ","Lokal von: " }, 1251{ "Local from: ","Lokal von: " },
1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" }, 1252{ "Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n","Synchronisationsübersicht:\n\n %d lokal hinzugefügt\n %d fern hinzugefügt\n %d lokal geändert\n %d fern geändert\n %d lokal gelöscht\n %d fern gelöscht\n %d eingehende ausgefiltert\n %d ausgehende ausgefiltert\n" },
1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" }, 1253{ "Local calendar changed!\n","Lokaler Kalender geändert!\n" },
1254{ "Write back","Schreibe zurück" }, 1254{ "Write back","Schreibe zurück" },
1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" }, 1255{ "KO/Pi Synchronization","KO/Pi Synchronisation" },
1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" }, 1256{ "Pi-Sync succesful!","Pi-Sync erfolgreich!" },
1257{ "Received sync request","Sync Anfrage erhalten" }, 1257{ "Received sync request","Sync Anfrage erhalten" },
1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." }, 1258{ "Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog.","Ferne Synchronisation ...\n\nBenutze diese Anwendung nicht!\n\nWenn das Syncen fehlschlägt kann\ndieser Dialog geschlossen werden." },
1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." }, 1259{ "Saving Data to temp file ...","Speichere Daten in temp Datei..." },
1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" }, 1260{ "Data saved to temp file!","Daten in temp Datei gespeichert!" },
1261{ "Sending file...","Sende Datei..." }, 1261{ "Sending file...","Sende Datei..." },
1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1263{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1263{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1264{ "Received %1 bytes","%1 Bytes erhalten" }, 1264{ "Received %1 bytes","%1 Bytes erhalten" },
1265{ "Writing file to disk...","Speichere Datei..." }, 1265{ "Writing file to disk...","Speichere Datei..." },
1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1268{ "Synchronize!","Synchronisiere!" }, 1268{ "Synchronize!","Synchronisiere!" },
1269{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1269{ "High clock skew!","Großer Uhrzeitunterschied!" },
1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, 1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1274{ "List week view","Listenwochenansicht" }, 1274{ "List week view","Listenwochenansicht" },
1275{ "List week","Listenwochenansicht" }, 1275{ "List week","Listenwochenansicht" },
1276{ "Next Week","Nächste Woche" }, 1276{ "Next Week","Nächste Woche" },
1277{ "Previous Week","Vorherige Woche" }, 1277{ "Previous Week","Vorherige Woche" },
1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, 1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." },
1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1280{ "Details","Details" }, 1280{ "Details","Details" },
1281{ "Created time","Erstellt Zeit" }, 1281{ "Created time","Erstellt Zeit" },
1282{ "Last modified time","Geändert Zeit" }, 1282{ "Last modified time","Geändert Zeit" },
1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1284{ "View Options","Anzeige Optionen" }, 1284{ "View Options","Anzeige Optionen" },
1285{ "<b>Created: ","<b>Erstellt am: " }, 1285{ "<b>Created: ","<b>Erstellt am: " },
1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1287{ "Journal: ","Journal: " }, 1287{ "Journal: ","Journal: " },
1288{ "yearly","jährlich" }, 1288{ "yearly","jährlich" },
1289{ "(%1) ","%1-" }, 1289{ "(%1) ","%1-" },
1290{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, 1290{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" },
1291{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, 1291{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" },
1292{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, 1292{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" },
1293{ "Summary/Loc.","Titel/Ort" }, 1293{ "Summary/Loc.","Titel/Ort" },
1294{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, 1294{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." },
1295{ "Week Number","Wochennummer" }, 1295{ "Week Number","Wochennummer" },
1296{ "Import","Importiere" }, 1296{ "Import","Importiere" },
1297{ "Export","Exportiere" }, 1297{ "Export","Exportiere" },
1298{ "Beam","Beame" }, 1298{ "Beam","Beame" },
1299{ "Export selected","Exportiere Selektierte" }, 1299{ "Export selected","Exportiere Selektierte" },
1300{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, 1300{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1301{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, 1301{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1302{ "Journal/Details...","Journale/Details..." }, 1302{ "Journal/Details...","Journale/Details..." },
1303{ "Agenda View","Agenda Ansicht" }, 1303{ "Agenda View","Agenda Ansicht" },
1304{ "Show current time","Zeige aktuelle Zeit" }, 1304{ "Show current time","Zeige aktuelle Zeit" },
1305{ "Edit new item","Bearbeite neuen Eintrag" }, 1305{ "Edit new item","Bearbeite neuen Eintrag" },
1306{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" },
1307{ "","" },
1308{ "","" },
1309{ "","" },
1306{ "","" }, 1310{ "","" },
1307{ "","" }, 1311{ "","" },
1308{ "","" }, 1312{ "","" },
1309{ "","" }, 1313{ "","" },
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 50c4605..ec7f730 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -1,130 +1,136 @@
1/* 1/*
2 This file is part of the KOrganizer alarm daemon. 2 This file is part of the KOrganizer alarm daemon.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 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 "simplealarmdaemonimpl.h" 24#include "simplealarmdaemonimpl.h"
25 25
26#include "alarmdialog.h" 26#include "alarmdialog.h"
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qapp.h> 28#include <qapp.h>
29#include <qdir.h> 29#include <qdir.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qhbox.h> 31#include <qhbox.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qdatetime.h>
35#include <qpushbutton.h>
34#include <qlayout.h> 36#include <qlayout.h>
35#include <qlineedit.h> 37#include <qlineedit.h>
36#include <qdialog.h> 38#include <qdialog.h>
39#define protected public
37#include <qspinbox.h> 40#include <qspinbox.h>
41#undef protected
38#include <qtextstream.h> 42#include <qtextstream.h>
39#include <qtopia/qcopenvelope_qws.h> 43#include <qtopia/qcopenvelope_qws.h>
40#include <qtopia/alarmserver.h> 44#include <qtopia/alarmserver.h>
41 45
42#include <stdlib.h> 46#include <stdlib.h>
43#include <stdio.h> 47#include <stdio.h>
44#include <unistd.h> 48#include <unistd.h>
45 49
46 50
47SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) 51SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
48 : QLabel( parent ) 52 : QLabel( parent )
49{ 53{
50 mAlarmDialog = new AlarmDialog( 0 ); 54 mAlarmDialog = new AlarmDialog( 0 );
51 mPopUp = new QPopupMenu( this ); 55 mPopUp = new QPopupMenu( this );
52 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) ); 56 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) );
53 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) ); 57 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) );
54 mPopUp->insertSeparator(); 58 mPopUp->insertSeparator();
55 mPopUp->insertItem( "What's Todo?", this, SLOT ( showTodo() ) ); 59 mPopUp->insertItem( "What's Todo?", this, SLOT ( showTodo() ) );
56 mPopUp->insertSeparator(); 60 mPopUp->insertSeparator();
57 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) ); 61 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) );
58 mPopUp->insertSeparator(); 62 mPopUp->insertSeparator();
59 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) ); 63 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) );
60 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) ); 64 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) );
61 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) ); 65 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) );
62 mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); 66 mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) );
63 mPopUp->insertSeparator(); 67 mPopUp->insertSeparator();
64 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); 68 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) );
65 mTimerPopUp = new QPopupMenu( this ); 69 mTimerPopUp = new QPopupMenu( this );
66 70 QFont fon = mTimerPopUp->font();
71 fon.setPointSize( fon.pointSize() *3/2 );
72 mTimerPopUp->setFont( fon );
67 mBeepPopUp = new QPopupMenu( this ); 73 mBeepPopUp = new QPopupMenu( this );
68 mSoundPopUp = new QPopupMenu( this ); 74 mSoundPopUp = new QPopupMenu( this );
69 mPausePopUp = new QPopupMenu( this ); 75 mPausePopUp = new QPopupMenu( this );
70 QPopupMenu* savePopUp = new QPopupMenu( this ); 76 QPopupMenu* savePopUp = new QPopupMenu( this );
71 savePopUp->insertItem( "Save", 0 ); 77 savePopUp->insertItem( "Save", 0 );
72 savePopUp->insertItem( "Load", 1 ); 78 savePopUp->insertItem( "Load", 1 );
73 mSoundPopUp->insertItem( "Buzzer", 0 ); 79 mSoundPopUp->insertItem( "Buzzer", 0 );
74 mSoundPopUp->insertItem( "Wav file", 1 ); 80 mSoundPopUp->insertItem( "Wav file", 1 );
75 mPausePopUp->insertItem( " 1 sec", 1 ); 81 mPausePopUp->insertItem( " 1 sec", 1 );
76 mPausePopUp->insertItem( " 2 sec", 2 ); 82 mPausePopUp->insertItem( " 2 sec", 2 );
77 mPausePopUp->insertItem( " 3 sec", 3 ); 83 mPausePopUp->insertItem( " 3 sec", 3 );
78 mPausePopUp->insertItem( " 5 sec", 5 ); 84 mPausePopUp->insertItem( " 5 sec", 5 );
79 mPausePopUp->insertItem( "10 sec", 10 ); 85 mPausePopUp->insertItem( "10 sec", 10 );
80 mPausePopUp->insertItem( "30 sec", 30 ); 86 mPausePopUp->insertItem( "30 sec", 30 );
81 mPausePopUp->insertItem( " 1 min", 60 ); 87 mPausePopUp->insertItem( " 1 min", 60 );
82 mPausePopUp->insertItem( " 5 min", 300 ); 88 mPausePopUp->insertItem( " 5 min", 300 );
83 mPausePopUp->insertItem( "10 min", 600 ); 89 mPausePopUp->insertItem( "10 min", 600 );
84 mSuspendPopUp = new QPopupMenu( this ); 90 mSuspendPopUp = new QPopupMenu( this );
85 mSuspendPopUp->insertItem( "Off", 0 ); 91 mSuspendPopUp->insertItem( "Off", 0 );
86 mSuspendPopUp->insertItem( " 1x", 1 ); 92 mSuspendPopUp->insertItem( " 1x", 1 );
87 mSuspendPopUp->insertItem( " 2x", 2 ); 93 mSuspendPopUp->insertItem( " 2x", 2 );
88 mSuspendPopUp->insertItem( " 3x", 3 ); 94 mSuspendPopUp->insertItem( " 3x", 3 );
89 mSuspendPopUp->insertItem( " 5x", 5 ); 95 mSuspendPopUp->insertItem( " 5x", 5 );
90 mSuspendPopUp->insertItem( "10x", 10 ); 96 mSuspendPopUp->insertItem( "10x", 10 );
91 mSuspendPopUp->insertItem( "20x", 20 ); 97 mSuspendPopUp->insertItem( "20x", 20 );
92 mSuspendPopUp->insertItem( "30x", 30 ); 98 mSuspendPopUp->insertItem( "30x", 30 );
93 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); 99 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp );
94 mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); 100 mBeepPopUp->insertItem( "Beep interval",mPausePopUp );
95 mBeepPopUp->insertItem( "Replay",mSoundPopUp ); 101 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
96 mBeepPopUp->insertItem( "Config",savePopUp ); 102 mBeepPopUp->insertItem( "Config",savePopUp );
97 mBeepPopUp->insertItem( "300", 300 ); 103 mBeepPopUp->insertItem( "300", 300 );
98 mBeepPopUp->insertItem( "180", 180 ); 104 mBeepPopUp->insertItem( "180", 180 );
99 mBeepPopUp->insertItem( "60", 60 ); 105 mBeepPopUp->insertItem( "60", 60 );
100 mBeepPopUp->insertItem( "30", 30 ); 106 mBeepPopUp->insertItem( "30", 30 );
101 mBeepPopUp->insertItem( "10", 10 ); 107 mBeepPopUp->insertItem( "10", 10 );
102 mBeepPopUp->insertItem( "3", 3 ); 108 mBeepPopUp->insertItem( "3", 3 );
103 mBeepPopUp->insertItem( "1", 1 ); 109 mBeepPopUp->insertItem( "1", 1 );
104 mBeepPopUp->insertItem( "Off", 0 ); 110 mBeepPopUp->insertItem( "Off", 0 );
105 mBeepPopUp->setCheckable( true ); 111 mBeepPopUp->setCheckable( true );
106 mPopUp->insertSeparator(); 112 mPopUp->insertSeparator();
107 mPopUp->insertItem( "Play beeps", mBeepPopUp ); 113 mPopUp->insertItem( "Play beeps", mBeepPopUp );
108 mPopUp->insertSeparator(); 114 mPopUp->insertSeparator();
109 mPopUp->insertItem( "Timer", mTimerPopUp ); 115 mPopUp->insertItem( "Timer", mTimerPopUp );
110 mPopUp->insertSeparator(); 116 mPopUp->insertSeparator();
111 mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); 117 mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
112 118
113 mPopUp->resize( mPopUp->sizeHint() ); 119 mPopUp->resize( mPopUp->sizeHint() );
114 mPlayBeeps = 60; 120 mPlayBeeps = 60;
115 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 121 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
116 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); 122 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) );
117 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); 123 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) );
118 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); 124 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) );
119 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); 125 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) );
120 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); 126 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) );
121 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); 127 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) );
122 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); 128 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) );
123 mTimerTime = 0; 129 mTimerTime = 0;
124 mCustomText = "Custom Text"; 130 mCustomText = "Custom Text";
125 mCustomMinutes = 7; 131 mCustomMinutes = 7;
126 mTimerPopupConf = 1; 132 mTimerPopupConf = 1;
127 fillTimerPopUp(); 133 fillTimerPopUp();
128 mPausePlay = 0; 134 mPausePlay = 0;
129 confPause( 1 ); 135 confPause( 1 );
130 mSuspend = 0; 136 mSuspend = 0;
@@ -294,305 +300,373 @@ void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
294 tempfilename = mess.mid( 10, len ); 300 tempfilename = mess.mid( 10, len );
295 if ( !QFile::exists( tempfilename ) ) 301 if ( !QFile::exists( tempfilename ) )
296 error = true; 302 error = true;
297 } 303 }
298 if ( error ) { 304 if ( error ) {
299 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 305 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
300 mAlarmMessage += mess.mid( 10+len+3+9 ); 306 mAlarmMessage += mess.mid( 10+len+3+9 );
301 } else { 307 } else {
302 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 308 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
303 //qDebug("-----system command %s ",tempfilename.latin1() ); 309 //qDebug("-----system command %s ",tempfilename.latin1() );
304 if ( vfork () == 0 ) { 310 if ( vfork () == 0 ) {
305 execl ( tempfilename.latin1(), 0 ); 311 execl ( tempfilename.latin1(), 0 );
306 return; 312 return;
307 } 313 }
308 return; 314 return;
309 } 315 }
310 316
311 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 317 //qDebug("+++++++system command %s ",tempfilename.latin1() );
312 } 318 }
313 if ( mess.left( 11 ) == "audio_alarm") { 319 if ( mess.left( 11 ) == "audio_alarm") {
314 bool error = false; 320 bool error = false;
315 int len = mess.mid( 11 ).find("+++"); 321 int len = mess.mid( 11 ).find("+++");
316 if ( len < 2 ) 322 if ( len < 2 )
317 error = true; 323 error = true;
318 else { 324 else {
319 tempfilename = mess.mid( 11, len ); 325 tempfilename = mess.mid( 11, len );
320 if ( !QFile::exists( tempfilename ) ) 326 if ( !QFile::exists( tempfilename ) )
321 error = true; 327 error = true;
322 } 328 }
323 if ( ! error ) { 329 if ( ! error ) {
324 filename = tempfilename; 330 filename = tempfilename;
325 } 331 }
326 mAlarmMessage = mess.mid( 11+len+3+9 ); 332 mAlarmMessage = mess.mid( 11+len+3+9 );
327 //qDebug("audio file command %s ",tempfilename.latin1() ); 333 //qDebug("audio file command %s ",tempfilename.latin1() );
328 } 334 }
329 if ( mess.left( 9 ) == "cal_alarm") { 335 if ( mess.left( 9 ) == "cal_alarm") {
330 mAlarmMessage = mess.mid( 9 ) ; 336 mAlarmMessage = mess.mid( 9 ) ;
331 } 337 }
332 338
333 writeFile(); 339 writeFile();
334 startAlarm( mAlarmMessage, filename ); 340 startAlarm( mAlarmMessage, filename );
335 341
336} 342}
337 343
338int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) 344int SimpleAlarmDaemonImpl::getFileNameLen( QString mess )
339{ 345{
340 return 0; 346 return 0;
341} 347}
342void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) 348void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename )
343{ 349{
344 //mAlarmDialog->show(); 350 //mAlarmDialog->show();
345 //mAlarmDialog->raise(); 351 //mAlarmDialog->raise();
346 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); 352 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend );
347} 353}
348 354
349 355
350void SimpleAlarmDaemonImpl::fillTimerPopUp() 356void SimpleAlarmDaemonImpl::fillTimerPopUp()
351{ 357{
352 358
353 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime ); 359 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime );
354 if ( mTimerPopupConf == mTimerTime ) { 360 if ( mTimerPopupConf == mTimerTime ) {
355 if ( mTimerTime ) { 361 if ( mTimerTime ) {
356 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 362 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
357 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 363 QTime t ( secs/3600, (secs/60)%60, secs%60 );
358 mTimerPopUp->changeItem ( 1 , t.toString()); 364 mTimerPopUp->changeItem ( 1 , t.toString() + " (remaining time)");
359 } 365 }
360 else { 366 else {
361 QString text = mCustomText.stripWhiteSpace (); 367 QString text = mCustomText.stripWhiteSpace ();
362 int in = text.find( " " ); 368 int in = text.find( " " );
363 text = text.left ( in ); 369 text = text.left ( in );
364 mTimerPopUp->changeItem ( 3, text ); 370 mTimerPopUp->changeItem ( 3, text );
365 } 371 }
366 return; 372 return;
367 } 373 }
368 mTimerPopupConf = mTimerTime; 374 mTimerPopupConf = mTimerTime;
369 mTimerPopUp->clear(); 375 mTimerPopUp->clear();
370 if ( mTimerTime ) { 376 if ( mTimerTime ) {
371 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 377 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
372 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 378 QTime t ( secs/3600, (secs/60)%60, secs%60 );
373 mTimerPopUp->insertItem( "Stop", 0 ); 379
374 mTimerPopUp->insertItem( t.toString(),1); 380
381 mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 );
382 mTimerPopUp->insertItem( t.toString() + " (remaining time)",1);
383 mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm time)",2);
375 } else { 384 } else {
376 385
377 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc"; 386 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc";
378 QFile file( fileName ); 387 QFile file( fileName );
379 if( !QFile::exists( fileName) ) { 388 if( !QFile::exists( fileName) ) {
380 // write defaults 389 // write defaults
381 if (!file.open( IO_WriteOnly ) ) { 390 if (!file.open( IO_WriteOnly ) ) {
382 return; 391 return;
383 } 392 }
384 QString configString ; 393 QString configString ;
385 configString += "#config file for kopi alarm timer\n"; 394 configString += "#config file for kopi alarm timer\n";
386 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n"; 395 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n";
387 configString += "#NOTE: minimum value for timer are 3 minutes!\n"; 396 configString += "#NOTE: minimum value for timer are 3 minutes!\n";
388 configString += "24 h; 1440\n"; 397 configString += "24 h; 1440\n";
389 configString += " 8 h; 480\n"; 398 configString += " 8 h; 480\n";
390 configString += " 5 h; 300\n"; 399 configString += " 5 h; 300\n";
391 configString += " 1 h; 60\n"; 400 configString += " 1 h; 60\n";
392 configString += "30 min; 30\n"; 401 configString += "30 min; 30\n";
393 configString += "15 min; 15\n"; 402 configString += "15 min; 15\n";
394 configString += "SEPARATOR\n"; 403 configString += "SEPARATOR\n";
395 configString += "Pizza; 22\n"; 404 configString += "Pizza; 22\n";
396 configString += "Nap; 45\n"; 405 configString += "Nap; 45\n";
397 configString += "Tea; 5\n"; 406 configString += "Tea; 5\n";
398 QTextStream ts( &file ); 407 QTextStream ts( &file );
399 ts << configString ; 408 ts << configString ;
400 file.close(); 409 file.close();
401 } 410 }
402 411
403 if (!file.open( IO_ReadOnly ) ) { 412 if (!file.open( IO_ReadOnly ) ) {
404 return ; 413 return ;
405 } 414 }
406 QString line; 415 QString line;
407 bool ok; 416 bool ok;
408 while ( file.readLine( line, 1024 ) > 0 ) { 417 while ( file.readLine( line, 1024 ) > 0 ) {
409 //qDebug("read %s ", line.latin1()); 418 //qDebug("read %s ", line.latin1());
410 if ( line.left(1 ) != "#" ) { 419 if ( line.left(1 ) != "#" ) {
411 // no comment 420 // no comment
412 if ( line.left(9 ) == "SEPARATOR" ) { 421 if ( line.left(9 ) == "SEPARATOR" ) {
413 mTimerPopUp->insertSeparator(); 422 mTimerPopUp->insertSeparator();
414 } else { 423 } else {
415 QStringList li = QStringList::split(";",line); 424 QStringList li = QStringList::split(";",line);
416 ok = false; 425 ok = false;
417 if ( li.count() == 2 ) { 426 if ( li.count() == 2 ) {
418 int val = li[1].toInt( &ok ); 427 int val = li[1].toInt( &ok );
419 if ( ok && val > 2 ) { 428 if ( ok && val > 2 ) {
420 mTimerPopUp->insertItem( li[0], val); 429 mTimerPopUp->insertItem( li[0], val);
421 } 430 }
422 } 431 }
423 } 432 }
424 } 433 }
425 } 434 }
426 file.close(); 435 file.close();
427#if 0 436#if 0
428 mTimerPopUp->insertItem( "24 h", 1440 ); 437 mTimerPopUp->insertItem( "24 h", 1440 );
429 // mTimerPopUp->insertItem( i18n("12 h"), 720 ); 438 // mTimerPopUp->insertItem( i18n("12 h"), 720 );
430 mTimerPopUp->insertItem( " 8 h", 480 ); 439 mTimerPopUp->insertItem( " 8 h", 480 );
431 mTimerPopUp->insertItem( " 5 h", 300 ); 440 mTimerPopUp->insertItem( " 5 h", 300 );
432 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 ); 441 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 );
433 mTimerPopUp->insertItem( " 1 h", 60 ); 442 mTimerPopUp->insertItem( " 1 h", 60 );
434 mTimerPopUp->insertItem( "30 min", 30 ); 443 mTimerPopUp->insertItem( "30 min", 30 );
435 mTimerPopUp->insertItem( "15 min", 15 ); 444 mTimerPopUp->insertItem( "15 min", 15 );
436 mTimerPopUp->insertItem( "10 min", 10 ); 445 mTimerPopUp->insertItem( "10 min", 10 );
437 //mTimerPopUp->insertItem( " 5 min", 5 ); 446 //mTimerPopUp->insertItem( " 5 min", 5 );
438 mTimerPopUp->insertSeparator(); 447 mTimerPopUp->insertSeparator();
439 mTimerPopUp->insertItem( "Pizza", 22 ); 448 mTimerPopUp->insertItem( "Pizza", 22 );
440 mTimerPopUp->insertItem( "Nap", 45 ); 449 mTimerPopUp->insertItem( "Nap", 45 );
441 mTimerPopUp->insertItem( "Tea", 5 ); 450 mTimerPopUp->insertItem( "Tea", 5 );
442#endif 451#endif
443 QString text = mCustomText.stripWhiteSpace (); 452 QString text = mCustomText.stripWhiteSpace ();
444 int in = text.find( " " ); 453 int in = text.find( " " );
445 text = text.left ( in ); 454 text = text.left ( in );
446 mTimerPopUp->insertItem( text, 3 ); 455 mTimerPopUp->insertItem( text, 3 );
447 mTimerPopUp->insertSeparator(); 456 mTimerPopUp->insertSeparator();
448 mTimerPopUp->insertItem( "Customize", 2 ); 457 mTimerPopUp->insertItem( "Customize", 2 );
449 } 458 }
450 459
451} 460}
452 461
453void SimpleAlarmDaemonImpl::showTimer() 462void SimpleAlarmDaemonImpl::showTimer()
454{ 463{
455 fillTimerPopUp(); 464 fillTimerPopUp();
456} 465}
457 466
458void SimpleAlarmDaemonImpl::confTimer( int time ) 467void SimpleAlarmDaemonImpl::confTimer( int time )
459{ 468{
460 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time ); 469 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time );
461 int minutes = time; 470 int minutes = time;
462 if ( minutes == 0 ) { 471 if ( minutes == 0 ) {
463 if ( ! mTimerTime ) 472 if ( ! mTimerTime )
464 return; 473 return;
465 474
466 QDialog dia ( 0, ("Stop Timer" ), true ); 475 QDialog dia ( 0, ("Stop Timer" ), true );
467 QLabel lab (("Really stop the timer?"), &dia ); 476 QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia );
477 lab.setAlignment( AlignCenter );
468 dia.setCaption(("KO/Pi Timer Stop" )); 478 dia.setCaption(("KO/Pi Timer Stop" ));
469 QVBoxLayout lay( &dia ); 479 QVBoxLayout lay( &dia );
480 lay.addWidget( &lab);
481 QPushButton ok ( "Stop timer!", &dia);
482 QFont fo = dia.font();
483 fo.setPointSize( 36 );
484 ok.setFont( fo );
485 lay.addWidget( &ok);
486 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
487 QPushButton con ( "Continue timer!", &dia);
488 fo.setPointSize( 36 );
489 con.setFont( fo );
490 lay.addWidget( &con);
491 connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) );
470 lay.setMargin(5); 492 lay.setMargin(5);
471 lay.setSpacing(5); 493 lay.setSpacing(5);
472 lay.addWidget( &lab); 494 dia.resize(dia.sizeHint() );
473 dia.resize( 200, dia.sizeHint().height() );
474 495
475 if ( !dia.exec() ) 496 if ( !dia.exec() )
476 return; 497 return;
477 498
478 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() ); 499 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.latin1() );
479 mTimerTime = 0; 500 mTimerTime = 0;
480 return; 501 return;
481 } 502 }
482 if ( mTimerTime ) 503 if ( mTimerTime )
483 return; 504 return;
484 if ( minutes == 1 ) { 505 if ( minutes == 1 ) {
485 return; 506 return;
486 } 507 }
487 QString mess = "timer_alarm"; 508 QString mess = "timer_alarm";
488 mess += ("Timer Alarm!\n"); 509 mess += ("Timer Alarm!\n");
489 if ( minutes == 22 ) 510 if ( minutes == 22 ) {
490 mess += ( "Pizza is ready"); 511 mess += ( "Pizza is ready");
491 else if ( minutes == 45 ) 512 mRunningTimerText = "Pizza";
513 }
514 else if ( minutes == 45 ) {
492 mess += ( "Please wake up!"); 515 mess += ( "Please wake up!");
493 else if ( minutes == 5 ) 516 mRunningTimerText = "Nap";
517 }
518 else if ( minutes == 5 ) {
494 mess += ( "Tea is ready"); 519 mess += ( "Tea is ready");
520 mRunningTimerText = "Tea";
521 }
495 else if ( minutes == 3 ) { 522 else if ( minutes == 3 ) {
496 mess += mCustomText; 523 mess += mCustomText;
497 minutes = mCustomMinutes ; 524 minutes = mCustomMinutes ;
525 mRunningTimerText = mCustomText.stripWhiteSpace ();
526 int in = mRunningTimerText.find( " " );
527 mRunningTimerText = mRunningTimerText.left ( in );
498 } 528 }
499 else { 529 else {
500 if ( minutes == 2 ) { 530 if ( minutes == 2 ) {
501 // ask time 531 // ask time
502 QDialog dia ( 0, ("Customize Timer" ), true ); 532 QDialog dia ( 0, ("Customize Timer" ), true );
503 QLabel lab (("Message Text:"), &dia ); 533 QLabel lab (("Message Text:"), &dia );
504 dia.setCaption(("KO/Pi Timer" )); 534 dia.setCaption(("KO/Pi Timer" ));
505 QVBoxLayout lay( &dia ); 535 QVBoxLayout lay( &dia );
506 lay.setMargin(5); 536 lay.setMargin(5);
507 lay.setSpacing(5); 537 lay.setSpacing(5);
508 lay.addWidget( &lab); 538 lay.addWidget( &lab);
509 QLineEdit lEdit( mCustomText, &dia ); 539 QLineEdit lEdit( mCustomText, &dia );
510 lay.addWidget( &lEdit); 540 lay.addWidget( &lEdit);
511 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); 541 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia );
512 lay.addWidget( &lab2); 542 lay.addWidget( &lab2);
543 QHBox hbox1 ( &dia );
544 lay.addWidget( &hbox1);
545 QLabel lab3 (("Hours"), &hbox1 );
546 QLabel lab4 (("Minutes"), &hbox1 );
513 QHBox hbox ( &dia ); 547 QHBox hbox ( &dia );
514 QLabel lab3 (("h:"), &hbox );
515 QSpinBox spinh( 0, 24, 1,& hbox ); 548 QSpinBox spinh( 0, 24, 1,& hbox );
516 QLabel lab4 ((" min:"), &hbox ); 549 QFont fo = dia.font();
550 fo.setPointSize( 36 );
517 QSpinBox spinm( 0, 59, 1,&hbox ); 551 QSpinBox spinm( 0, 59, 1,&hbox );
552 spinm.setFont( fo );
553 spinh.setFont( fo );
554 spinh.setButtonSymbols( QSpinBox::PlusMinus );
555 spinm.setButtonSymbols( QSpinBox::PlusMinus );
556 spinh.upButton ()->setFixedSize( QSize( 48, 30 ));
557 spinh.downButton ()->setFixedSize( QSize( 48, 30 ));
558 //spinh.editor ()->setFixedSize( QSize( 50, 100 ));
559 spinh.setFixedSize( 100,62 );
560 spinm.upButton ()->setFixedSize( QSize( 48, 30 ));
561 spinm.downButton ()->setFixedSize( QSize( 48, 30 ));
562 spinm.downButton ()->setGeometry( 50,50,50,50);
563 spinm.setSuffix( " m" );
564 spinh.setSuffix( " h" );
565 spinm.setWrapping ( true );
566 //spinm.editor ()->setFixedSize( QSize( 50, 100 ));
567 spinm.setLineStep( 1 );
568 spinm.setFixedSize( 110,62 );
569 lay.addWidget( &hbox);
570 QLabel lab5 ("Timer fires at:", &dia );
571 lab5.setAlignment( AlignCenter );
572 lay.addWidget( &lab5);
573 KODateLabel dl ( &dia );
574 dl.setAlignment( AlignCenter );
575 dl.setFont( fo );
576 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) );
577 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) );
578 lay.addWidget( &dl);
518 spinh.setValue( mCustomMinutes/60 ); 579 spinh.setValue( mCustomMinutes/60 );
519 spinm.setValue( mCustomMinutes%60 ); 580 spinm.setValue( mCustomMinutes%60 );
520 lay.addWidget( &hbox); 581 QPushButton ok ( "Start timer", &dia);
582 ok.setFont( fo );
583 lay.addWidget( &ok);
584 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
521 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); 585 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
586
522 if ( !dia.exec() ) 587 if ( !dia.exec() )
523 return; 588 return;
524 mCustomText = lEdit.text(); 589 mCustomText = lEdit.text();
525 mCustomMinutes = spinh.value()*60+spinm.value(); 590 mCustomMinutes = spinh.value()*60+spinm.value();
526 if ( mCustomMinutes == 0 ) 591 if ( mCustomMinutes == 0 )
527 mCustomMinutes = 1; 592 mCustomMinutes = 1;
528 if ( mCustomMinutes > 1440 ) 593 if ( mCustomMinutes > 1440 )
529 mCustomMinutes = 1440; 594 mCustomMinutes = 1440;
530 mess += mCustomText; 595 mess += mCustomText;
531 minutes = mCustomMinutes; 596 minutes = mCustomMinutes;
597 mRunningTimerText = mCustomText.stripWhiteSpace ();
598 int in = mRunningTimerText.find( " " );
599 mRunningTimerText = mRunningTimerText.left ( in );
532 } 600 }
533 else 601 else {
534 mess+= QString::number ( minutes ) + ( " minutes are past!"); 602 mess+= QString::number ( minutes ) + ( " minutes are past!");
603 int min = minutes;
604 if ( min % 60 == 0 )
605 mRunningTimerText = QString::number ( min/60 ) + ( " hours");
606 else
607 mRunningTimerText = QString::number ( minutes ) + ( " minutes");
608 }
535 } 609 }
536 //minutes = 1; 610 //minutes = 1;
537 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); 611 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
538 timerMesssage = mess; 612 timerMesssage = mess;
539 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1()); 613 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.latin1());
540 mTimerTime = 1; 614 mTimerTime = 1;
541} 615}
542 616
543void SimpleAlarmDaemonImpl::writeFile() 617void SimpleAlarmDaemonImpl::writeFile()
544{ 618{
545 QCopEnvelope e("QPE/Application/kopi", "-writeFile"); 619 QCopEnvelope e("QPE/Application/kopi", "-writeFile");
546} 620}
547void SimpleAlarmDaemonImpl::showWN() 621void SimpleAlarmDaemonImpl::showWN()
548{ 622{
549 QCopEnvelope e("QPE/Application/kopi", "-showWN"); 623 QCopEnvelope e("QPE/Application/kopi", "-showWN");
550} 624}
551void SimpleAlarmDaemonImpl::newTodo() 625void SimpleAlarmDaemonImpl::newTodo()
552{ 626{
553 QCopEnvelope e("QPE/Application/kopi", "-newTodo"); 627 QCopEnvelope e("QPE/Application/kopi", "-newTodo");
554} 628}
555 629
556void SimpleAlarmDaemonImpl::newEvent() 630void SimpleAlarmDaemonImpl::newEvent()
557{ 631{
558 QCopEnvelope e("QPE/Application/kopi", "-newEvent"); 632 QCopEnvelope e("QPE/Application/kopi", "-newEvent");
559 633
560} 634}
561void SimpleAlarmDaemonImpl::newMail() 635void SimpleAlarmDaemonImpl::newMail()
562{ 636{
563 QCopEnvelope e("QPE/Application/ompi", "newMail()"); 637 QCopEnvelope e("QPE/Application/ompi", "newMail()");
564} 638}
565void SimpleAlarmDaemonImpl::showAdd() 639void SimpleAlarmDaemonImpl::showAdd()
566{ 640{
567 QCopEnvelope e("QPE/Application/kapi", "raise()"); 641 QCopEnvelope e("QPE/Application/kapi", "raise()");
568} 642}
569void SimpleAlarmDaemonImpl::ringSync() 643void SimpleAlarmDaemonImpl::ringSync()
570{ 644{
571 QCopEnvelope e("QPE/Application/kopi", "-ringSync"); 645 QCopEnvelope e("QPE/Application/kopi", "-ringSync");
572 646
573} 647}
574void SimpleAlarmDaemonImpl::newCountdown() 648void SimpleAlarmDaemonImpl::newCountdown()
575{ 649{
576 //recieve("cal_alarm", 10 ); 650 //recieve("cal_alarm", 10 );
577} 651}
578void SimpleAlarmDaemonImpl::simulate() 652void SimpleAlarmDaemonImpl::simulate()
579{ 653{
580 writeFile(); 654 writeFile();
581 QString filename = getenv("QPEDIR") ; 655 QString filename = getenv("QPEDIR") ;
582 filename += "/pics/kdepim/korganizer/koalarm.wav"; 656 filename += "/pics/kdepim/korganizer/koalarm.wav";
583 startAlarm("Alarm simulation", filename ); 657 startAlarm("Alarm simulation", filename );
584} 658}
585void SimpleAlarmDaemonImpl::showKO() 659void SimpleAlarmDaemonImpl::showKO()
586{ 660{
587 QCopEnvelope e("QPE/Application/kopi", "-showKO"); 661 QCopEnvelope e("QPE/Application/kopi", "-showKO");
588 662
589} 663}
590void SimpleAlarmDaemonImpl::showTodo() 664void SimpleAlarmDaemonImpl::showTodo()
591{ 665{
592 QCopEnvelope e("QPE/Application/kopi", "-showTodo"); 666 QCopEnvelope e("QPE/Application/kopi", "-showTodo");
593 667
594} 668}
595void SimpleAlarmDaemonImpl::writeJournal() 669void SimpleAlarmDaemonImpl::writeJournal()
596{ 670{
597 QCopEnvelope e("QPE/Application/kopi", "-showJournal"); 671 QCopEnvelope e("QPE/Application/kopi", "-showJournal");
598 672
diff --git a/kalarmd/simplealarmdaemonimpl.h b/kalarmd/simplealarmdaemonimpl.h
index 32a3867..cbdba47 100644
--- a/kalarmd/simplealarmdaemonimpl.h
+++ b/kalarmd/simplealarmdaemonimpl.h
@@ -1,86 +1,119 @@
1/* 1/*
2 This file is part of the KOrganizer alarm daemon. 2 This file is part of the KOrganizer alarm daemon.
3 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2003 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#ifndef SIMPLEALARMDAEMONIMPL_H 23#ifndef SIMPLEALARMDAEMONIMPL_H
24#define SIMPLEALARMDAEMONIMPL_H 24#define SIMPLEALARMDAEMONIMPL_H
25 25
26//#include "simplealarmdaemon.h" 26//#include "simplealarmdaemon.h"
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qtimer.h>
29 30
30class QLabel; 31class QLabel;
31class QTimer; 32class QTimer;
32class QPopupMenu; 33class QPopupMenu;
33class AlarmDialog; 34class AlarmDialog;
34class SimpleAlarmDaemonImpl : public QLabel 35class SimpleAlarmDaemonImpl : public QLabel
35{ 36{
36 Q_OBJECT 37 Q_OBJECT
37 public: 38 public:
38 SimpleAlarmDaemonImpl( QWidget *parent = 0 ); 39 SimpleAlarmDaemonImpl( QWidget *parent = 0 );
39 40
40 ~SimpleAlarmDaemonImpl(); 41 ~SimpleAlarmDaemonImpl();
41 42
42 protected slots: 43 protected slots:
43 void recieve( const QCString& msg, const QByteArray& data ); 44 void recieve( const QCString& msg, const QByteArray& data );
44 void newTodo(); 45 void newTodo();
45 void newEvent(); 46 void newEvent();
46 void newCountdown(); 47 void newCountdown();
47 void simulate(); 48 void simulate();
48 void showKO(); 49 void showKO();
49 void showWN(); 50 void showWN();
50 void showAdd(); 51 void showAdd();
51 void newMail(); 52 void newMail();
52 void ringSync(); 53 void ringSync();
53 void showTodo(); 54 void showTodo();
54 void writeFile(); 55 void writeFile();
55 void writeJournal(); 56 void writeJournal();
56 void slotPlayBeep( int ); 57 void slotPlayBeep( int );
57 void showTimer( ); 58 void showTimer( );
58 void confPause( int ); 59 void confPause( int );
59 void confTimer( int ); 60 void confTimer( int );
60 void saveSlot( int ); 61 void saveSlot( int );
61 void confSuspend( int ); 62 void confSuspend( int );
62 void confSound( int num ); 63 void confSound( int num );
63 void startAlarm(QString mess, QString fn ); 64 void startAlarm(QString mess, QString fn );
64 65
65 protected: 66 protected:
66 void mousePressEvent( QMouseEvent * ); 67 void mousePressEvent( QMouseEvent * );
67 68
68 private: 69 private:
69 AlarmDialog *mAlarmDialog; 70 AlarmDialog *mAlarmDialog;
70 int mPlayBeeps; 71 int mPlayBeeps;
71 int mPausePlay; 72 int mPausePlay;
72 int mSuspend; 73 int mSuspend;
73 QString mAlarmMessage; 74 QString mAlarmMessage;
74 int mTimerTime; 75 int mTimerTime;
75 int getFileNameLen( QString ); 76 int getFileNameLen( QString );
76 QPopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp; 77 QPopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp;
77 QDateTime mRunningTimer; 78 QDateTime mRunningTimer;
78 void fillTimerPopUp(); 79 void fillTimerPopUp();
79 QString timerMesssage; 80 QString timerMesssage;
80 QString mCustomText; 81 QString mCustomText;
82 QString mRunningTimerText;
81 int mCustomMinutes; 83 int mCustomMinutes;
82 int mTimerPopupConf; 84 int mTimerPopupConf;
83 bool wavAlarm; 85 bool wavAlarm;
84}; 86};
85 87class KODateLabel : public QLabel
88{
89 Q_OBJECT
90 public:
91 KODateLabel( QWidget *parent=0, const char *name=0 ) :
92 QLabel( parent, name )
93 {
94 hour = 0;
95 minutes = 0;
96 QTimer * ti = new QTimer( this );
97 connect ( ti, SIGNAL ( timeout () ), this, SLOT ( updateText() ));
98 ti->start( 1000 );
99
100 }
101public slots:
102 void slot_minutes( int m )
103 {
104 minutes = m; updateText();
105 }
106 void slot_hours( int h )
107 {
108 hour = h; updateText();
109 }
110private slots:
111 void updateText()
112 {
113 QDateTime dt = QDateTime::currentDateTime();
114 dt = dt.addSecs( minutes * 60 + hour * 3600 );
115 setText( dt.time().toString() );
116 }
117 int hour, minutes;
118};
86#endif 119#endif
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 92fcd1c..b14ca43 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -124,128 +124,129 @@ void KOEditorGeneral::editCategories()
124 csd->setColorEnabled(); 124 csd->setColorEnabled();
125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
126 csd->exec(); 126 csd->exec();
127 delete csd; 127 delete csd;
128} 128}
129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
130{ 130{
131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
132 132
133 mCategoriesButton = new QPushButton(parent); 133 mCategoriesButton = new QPushButton(parent);
134 mCategoriesButton->setText(i18n("Categories...")); 134 mCategoriesButton->setText(i18n("Categories..."));
135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
136 categoriesLayout->addWidget(mCategoriesButton); 136 categoriesLayout->addWidget(mCategoriesButton);
137 137
138 mCategoriesLabel = new QLabel(parent); 138 mCategoriesLabel = new QLabel(parent);
139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
140 categoriesLayout->addWidget(mCategoriesLabel,1); 140 categoriesLayout->addWidget(mCategoriesLabel,1);
141} 141}
142 142
143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
144{ 144{
145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
146 146
147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
149 secrecyLayout->addWidget(mCancelBox); 149 secrecyLayout->addWidget(mCancelBox);
150 secrecyLayout->addWidget(secrecyLabel); 150 secrecyLayout->addWidget(secrecyLabel);
151 151
152 mSecrecyCombo = new QComboBox(parent); 152 mSecrecyCombo = new QComboBox(parent);
153 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 153 mSecrecyCombo->insertStringList(Incidence::secrecyList());
154 secrecyLayout->addWidget(mSecrecyCombo); 154 secrecyLayout->addWidget(mSecrecyCombo);
155} 155}
156 156
157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
158{ 158{
159 mDescriptionEdit = new KTextEdit(parent); 159 mDescriptionEdit = new KTextEdit(parent);
160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
161 mDescriptionEdit->append(""); 161 mDescriptionEdit->append("");
162 mDescriptionEdit->setReadOnly(false); 162 mDescriptionEdit->setReadOnly(false);
163 mDescriptionEdit->setOverwriteMode(false); 163 mDescriptionEdit->setOverwriteMode(false);
164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
165 topLayout->addWidget(mDescriptionEdit); 165 topLayout->addWidget(mDescriptionEdit);
166#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
168#endif 168#endif
169 169
170} 170}
171 171
172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
173{ 173{
174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 174 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
175 175
176 //mAlarmBell = new QLabel(parent); 176 //mAlarmBell = new QLabel(parent);
177 //mAlarmBell->setPixmap(SmallIcon("bell")); 177 //mAlarmBell->setPixmap(SmallIcon("bell"));
178 //alarmLayout->addWidget(mAlarmBell); 178 //alarmLayout->addWidget(mAlarmBell);
179 if ( QApplication::desktop()->width() < 320 ) 179 if ( QApplication::desktop()->width() < 320 )
180 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 180 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
181 else 181 else
182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 182 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
183 183
184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 184 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
185 alarmLayout->addWidget(mAlarmButton); 185 alarmLayout->addWidget(mAlarmButton);
186 186
187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 187 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
188 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
188 alarmLayout->addWidget(mAlarmTimeEdit); 189 alarmLayout->addWidget(mAlarmTimeEdit);
189 mAlarmIncrCombo = new QComboBox(false, parent); 190 mAlarmIncrCombo = new QComboBox(false, parent);
190 if ( QApplication::desktop()->width() < 320 ) { 191 if ( QApplication::desktop()->width() < 320 ) {
191 mAlarmIncrCombo->insertItem(i18n("min")); 192 mAlarmIncrCombo->insertItem(i18n("min"));
192 mAlarmIncrCombo->insertItem(i18n("hou")); 193 mAlarmIncrCombo->insertItem(i18n("hou"));
193 mAlarmIncrCombo->insertItem(i18n("day")); 194 mAlarmIncrCombo->insertItem(i18n("day"));
194 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 195 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
195 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 196 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
196 } else { 197 } else {
197 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 198 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
198 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 199 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
199 mAlarmIncrCombo->insertItem(i18n("day(s)")); 200 mAlarmIncrCombo->insertItem(i18n("day(s)"));
200 } 201 }
201 202
202 // mAlarmIncrCombo->setMinimumHeight(20); 203 // mAlarmIncrCombo->setMinimumHeight(20);
203 alarmLayout->addWidget(mAlarmIncrCombo); 204 alarmLayout->addWidget(mAlarmIncrCombo);
204 mAlarmSoundButton = new QPushButton(parent); 205 mAlarmSoundButton = new QPushButton(parent);
205 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 206 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
206 mAlarmSoundButton->setToggleButton(true); 207 mAlarmSoundButton->setToggleButton(true);
207 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 208 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
208 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 209 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
209 alarmLayout->addWidget(mAlarmSoundButton); 210 alarmLayout->addWidget(mAlarmSoundButton);
210 211
211 mAlarmProgramButton = new QPushButton(parent); 212 mAlarmProgramButton = new QPushButton(parent);
212 mAlarmProgramButton->setPixmap(SmallIcon("run")); 213 mAlarmProgramButton->setPixmap(SmallIcon("run"));
213 mAlarmProgramButton->setToggleButton(true); 214 mAlarmProgramButton->setToggleButton(true);
214 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 215 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
215 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 216 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
216 alarmLayout->addWidget(mAlarmProgramButton); 217 alarmLayout->addWidget(mAlarmProgramButton);
217 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 218 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
218 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 219 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
219 // if ( KOPrefs::instance()->mCompactDialogs ) { 220 // if ( KOPrefs::instance()->mCompactDialogs ) {
220 // mAlarmSoundButton->hide(); 221 // mAlarmSoundButton->hide();
221 // mAlarmProgramButton->hide(); 222 // mAlarmProgramButton->hide();
222 // } 223 // }
223} 224}
224 225
225void KOEditorGeneral::pickAlarmSound() 226void KOEditorGeneral::pickAlarmSound()
226{ 227{
227 228
228 qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); 229 qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
229 //QString prefix = mAlarmSound; 230 //QString prefix = mAlarmSound;
230 if (!mAlarmSoundButton->isOn()) { 231 if (!mAlarmSoundButton->isOn()) {
231 mAlarmSoundButton->setOn(true); 232 mAlarmSoundButton->setOn(true);
232 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); 233 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
233 } else { 234 } else {
234 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 235 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
235 i18n("*.wav|Wav Files"), 0)); 236 i18n("*.wav|Wav Files"), 0));
236 if (!fileName.isEmpty()) { 237 if (!fileName.isEmpty()) {
237 mAlarmSound = fileName; 238 mAlarmSound = fileName;
238 QToolTip::remove(mAlarmSoundButton); 239 QToolTip::remove(mAlarmSoundButton);
239 QString dispStr = i18n("Playing '%1'").arg(fileName); 240 QString dispStr = i18n("Playing '%1'").arg(fileName);
240 QToolTip::add(mAlarmSoundButton, dispStr); 241 QToolTip::add(mAlarmSoundButton, dispStr);
241 mAlarmProgramButton->setOn(false); 242 mAlarmProgramButton->setOn(false);
242 mAlarmSoundButton->setOn(true); 243 mAlarmSoundButton->setOn(true);
243 } else { 244 } else {
244 mAlarmProgramButton->setOn(true); 245 mAlarmProgramButton->setOn(true);
245 mAlarmSoundButton->setOn(false); 246 mAlarmSoundButton->setOn(false);
246 247
247 } 248 }
248 } 249 }
249#if 0 250#if 0
250 if (mAlarmProgramButton->isOn()) 251 if (mAlarmProgramButton->isOn())
251 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); 252 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 678e1bd..341a839 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -103,128 +103,133 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
103 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); 103 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint());
104 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 104 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
105 mStartDate = new KDateEdit(rangeWidget); 105 mStartDate = new KDateEdit(rangeWidget);
106 rangeLayout->addWidget(mStartDate); 106 rangeLayout->addWidget(mStartDate);
107 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 107 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
108 mEndDate = new KDateEdit(rangeWidget); 108 mEndDate = new KDateEdit(rangeWidget);
109 mEndDate->setDate(QDate::currentDate().addDays(365)); 109 mEndDate->setDate(QDate::currentDate().addDays(365));
110 rangeLayout->addWidget(mEndDate); 110 rangeLayout->addWidget(mEndDate);
111 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); 111 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
112 rangeLayout->addWidget( (QWidget*)wt ); 112 rangeLayout->addWidget( (QWidget*)wt );
113 layout->addWidget(rangeWidget); 113 layout->addWidget(rangeWidget);
114 // Results list view 114 // Results list view
115 listView = new KOListView(mCalendar,topFrame); 115 listView = new KOListView(mCalendar,topFrame);
116 layout->addWidget(listView); 116 layout->addWidget(listView);
117 117
118 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 118 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
119 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); 119 connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
120 120
121 setCaption( i18n("KO/Pi Find: ")); 121 setCaption( i18n("KO/Pi Find: "));
122#ifdef DESKTOP_VERSION 122#ifdef DESKTOP_VERSION
123 OkButton = new QPushButton( i18n("Close"), this ); 123 OkButton = new QPushButton( i18n("Close"), this );
124 connect(OkButton,SIGNAL(clicked()),SLOT(hide())); 124 connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
125#endif 125#endif
126} 126}
127 127
128SearchDialog::~SearchDialog() 128SearchDialog::~SearchDialog()
129{ 129{
130 130
131} 131}
132void SearchDialog::setFocusToList() 132void SearchDialog::setFocusToList()
133{ 133{
134 listView->resetFocus(); 134 listView->resetFocus();
135} 135}
136void SearchDialog::accept() 136void SearchDialog::accept()
137{ 137{
138 doSearch(); 138 doSearch();
139} 139}
140void SearchDialog::updateList() 140void SearchDialog::updateList()
141{ 141{
142 //listView->updateList(); 142 //listView->updateList();
143 if ( isVisible() ) { 143 if ( isVisible() ) {
144 updateView(); 144 updateView();
145 //qDebug("SearchDialog::updated "); 145 //qDebug("SearchDialog::updated ");
146 } 146 }
147 else { 147 else {
148 listView->clear(); 148 listView->clear();
149 //qDebug("SearchDialog::cleared "); 149 //qDebug("SearchDialog::cleared ");
150 150
151 } 151 }
152} 152}
153void SearchDialog::searchTextChanged( const QString &_text ) 153void SearchDialog::searchTextChanged( const QString &_text )
154{ 154{
155#if 0 155#if 0
156 enableButton( KDialogBase::User1, !_text.isEmpty() ); 156 enableButton( KDialogBase::User1, !_text.isEmpty() );
157#endif 157#endif
158} 158}
159 159
160void SearchDialog::doSearch() 160void SearchDialog::doSearch()
161{ 161{
162 QRegExp re; 162 QRegExp re;
163 163
164 re.setWildcard(true); // most people understand these better. 164 re.setWildcard(true); // most people understand these better.
165 re.setCaseSensitive(false); 165 re.setCaseSensitive(false);
166 re.setPattern(searchEdit->text()); 166 re.setPattern(searchEdit->text());
167 if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) {
168 KMessageBox::sorry(this,
169 i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals"));
170 return;
171 }
167 if (!re.isValid() ) { 172 if (!re.isValid() ) {
168 KMessageBox::sorry(this, 173 KMessageBox::sorry(this,
169 i18n("Invalid search expression,\ncannot perform " 174 i18n("Invalid search expression,\ncannot perform "
170 "the search.\nPlease enter a search expression\n" 175 "the search.\nPlease enter a search expression\n"
171 "using the wildcard characters\n '*' and '?'" 176 "using the wildcard characters\n '*' and '?'"
172 "where needed.")); 177 "where needed."));
173 return; 178 return;
174 } 179 }
175 180
176 search(re); 181 search(re);
177 182
178 listView->setStartDate( mStartDate->date() ); 183 listView->setStartDate( mStartDate->date() );
179 listView->showEvents(mMatchedEvents); 184 listView->showEvents(mMatchedEvents);
180 listView->addTodos(mMatchedTodos); 185 listView->addTodos(mMatchedTodos);
181 listView->addJournals(mMatchedJournals); 186 listView->addJournals(mMatchedJournals);
182 187
183 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 188 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
184 setCaption(i18n("No items found. Use '*' and '?' where needed.")); 189 setCaption(i18n("No items found. Use '*' and '?' where needed."));
185 } else { 190 } else {
186 QString mess; 191 QString mess;
187 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 192 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
188 setCaption( i18n("KO/Pi Find: ") + mess); 193 setCaption( i18n("KO/Pi Find: ") + mess);
189 194
190 } 195 }
191 searchEdit->setFocus(); 196 searchEdit->setFocus();
192} 197}
193void SearchDialog::updateConfig() 198void SearchDialog::updateConfig()
194{ 199{
195 listView->updateConfig(); 200 listView->updateConfig();
196} 201}
197void SearchDialog::updateView() 202void SearchDialog::updateView()
198{ 203{
199 204
200 QRegExp re; 205 QRegExp re;
201 re.setWildcard(true); // most people understand these better. 206 re.setWildcard(true); // most people understand these better.
202 re.setCaseSensitive(false); 207 re.setCaseSensitive(false);
203 re.setPattern(searchEdit->text()); 208 re.setPattern(searchEdit->text());
204 if (re.isValid()) { 209 if (re.isValid()) {
205 search(re); 210 search(re);
206 } else { 211 } else {
207 mMatchedEvents.clear(); 212 mMatchedEvents.clear();
208 mMatchedTodos.clear(); 213 mMatchedTodos.clear();
209 mMatchedJournals.clear(); 214 mMatchedJournals.clear();
210 } 215 }
211 listView->setStartDate( mStartDate->date() ); 216 listView->setStartDate( mStartDate->date() );
212 listView->showEvents(mMatchedEvents); 217 listView->showEvents(mMatchedEvents);
213 listView->addTodos(mMatchedTodos); 218 listView->addTodos(mMatchedTodos);
214 listView->addJournals(mMatchedJournals); 219 listView->addJournals(mMatchedJournals);
215} 220}
216 221
217void SearchDialog::search(const QRegExp &re) 222void SearchDialog::search(const QRegExp &re)
218{ 223{
219 QPtrList<Event> events = mCalendar->events( mStartDate->date(), 224 QPtrList<Event> events = mCalendar->events( mStartDate->date(),
220 mEndDate->date(), 225 mEndDate->date(),
221 false /*mInclusiveCheck->isChecked()*/ ); 226 false /*mInclusiveCheck->isChecked()*/ );
222 227
223 mMatchedEvents.clear(); 228 mMatchedEvents.clear();
224 if ( mSearchEvent->isChecked() ) { 229 if ( mSearchEvent->isChecked() ) {
225 Event *ev; 230 Event *ev;
226 for(ev=events.first();ev;ev=events.next()) { 231 for(ev=events.first();ev;ev=events.next()) {
227 if (mSummaryCheck->isChecked()) { 232 if (mSummaryCheck->isChecked()) {
228#if QT_VERSION >= 0x030000 233#if QT_VERSION >= 0x030000
229 if (re.search(ev->summary()) != -1) 234 if (re.search(ev->summary()) != -1)
230#else 235#else