summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-29 00:21:37 (UTC)
committer zautrix <zautrix>2005-10-29 00:21:37 (UTC)
commitacd1c021e6ddef4285b3220d7515a3917416b92f (patch) (unidiff)
tree3409f47cc4a9a0b6ffb53313e9a3b4a1d82f70ce
parent7a90e619147e06e5f4d4facef98364f78a4a04ef (diff)
downloadkdepimpi-acd1c021e6ddef4285b3220d7515a3917416b92f.zip
kdepimpi-acd1c021e6ddef4285b3220d7515a3917416b92f.tar.gz
kdepimpi-acd1c021e6ddef4285b3220d7515a3917416b92f.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt21
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp52
-rw-r--r--kalarmd/simplealarmdaemonimpl.h4
3 files changed, 63 insertions, 14 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 681e433..73f42f1 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,87 +1,108 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.2.6 ************ 3********** VERSION 2.2.6 ************
4 4
5KO/Pi: 5KO/Pi:
6Made navigation in datepicker more userfriendly when using keyboard for scrolling. 6Made navigation in datepicker more userfriendly when using keyboard for scrolling.
7KO/Pi Alarm applet:
8Made font size for the two popup menus with larger font configurable:
9Change size with menu:
10Play Beeps->Font Size
11Save settings such that it will be restored after next reboot with menu:
12Play Beeps->Config->Save.
13KA/Pi:
14Big change! Needed for the upcoming Outlook sync:
15Telephone number types are now fixed in KA/Pi
16(but still compatible with the vCard standard, of cource)
17and they are compatible with the types used by the evil empire.
18That makes syncing with OL possible and make it possible to sync better with mobile devices.
19NOTE:
20All your telephone types will be converted automatically at loading/importing!
21Such that it may bea good idea to make a backup of the data before starting KA/Pi.
22But the editing of phone numbers and types has changed completely such that it is now much faster to edit/change types and numbers.
23HINT:
24To see whether there was some number for some contact not converted senseful, choose
25Menu: View->Modify view
26and add "Other Phone" ( in German "Sonst. Telefon") to the view.
27If a type was not converted senseful to some of the 18 new, fixed types, it will get the "Other" type.
7 28
8********** VERSION 2.2.5 ************ 29********** VERSION 2.2.5 ************
9 30
10Bugfixes in KO/Pi, KA/Pi and OM/Pi. 31Bugfixes in KO/Pi, KA/Pi and OM/Pi.
11Added possibility to disable auto saving in KO/Pi. 32Added possibility to disable auto saving in KO/Pi.
12How to disable it? Good question! Next question, please? 33How to disable it? Good question! Next question, please?
13Added info about count of events/todos/journals to calendar info. 34Added info about count of events/todos/journals to calendar info.
14 35
15 36
16********** VERSION 2.2.4 ************ 37********** VERSION 2.2.4 ************
17 38
18KO/Pi alarm applet: Made font smaller and added a dealy before starting KO/Pi to avoid problems accessing data storage when an alarm did wake up the Z. 39KO/Pi alarm applet: Made font smaller and added a dealy before starting KO/Pi to avoid problems accessing data storage when an alarm did wake up the Z.
19Added 3 sec notification about a started timer. 40Added 3 sec notification about a started timer.
20 41
21KO/Pi: 42KO/Pi:
22Added export option for all data to File->Export menu. 43Added export option for all data to File->Export menu.
23Better management if a save error occours. 44Better management if a save error occours.
24Added 15 sec delay in automatic saving when Z wake up from suspend and the automatic save timer did expire - to avoid problems accessing data storage directly after wake up. 45Added 15 sec delay in automatic saving when Z wake up from suspend and the automatic save timer did expire - to avoid problems accessing data storage directly after wake up.
25Fix for displaying month names of an utf8 translated language (like Russian). I hope a Russian version of KO/Pi will be available soon. 46Fix for displaying month names of an utf8 translated language (like Russian). I hope a Russian version of KO/Pi will be available soon.
26 47
27Added duration info about multiday events. 48Added duration info about multiday events.
28Changed behaviour of "Set complete" in Todo viewer: Now Todo viewer closes not automatically. 49Changed behaviour of "Set complete" in Todo viewer: Now Todo viewer closes not automatically.
29 50
30KA/Pi: 51KA/Pi:
31Added for vCard import the option to import contact data in Latin1 format. 52Added for vCard import the option to import contact data in Latin1 format.
32 53
33********** VERSION 2.2.3 ************ 54********** VERSION 2.2.3 ************
34 55
35KO/Pi: 56KO/Pi:
36Fixed a problem with (non empty) exception dates in the exception date edit dialog of recurring events for newly created events. 57Fixed a problem with (non empty) exception dates in the exception date edit dialog of recurring events for newly created events.
37 58
38Fixed usability problem in KA/Pi: 59Fixed usability problem in KA/Pi:
39Now searching works for "all phone numbers and all addresses" if "all fields" is selected as search option. 60Now searching works for "all phone numbers and all addresses" if "all fields" is selected as search option.
40 61
41Changed some behaviour in OM/Pi mail management to make it more usable. 62Changed some behaviour in OM/Pi mail management to make it more usable.
42 63
43 64
44********** VERSION 2.2.2 ************ 65********** VERSION 2.2.2 ************
45 66
46KO/Pi: 67KO/Pi:
47Fixed a problem with the sort order of last modified date in list view. 68Fixed a problem with the sort order of last modified date in list view.
48KA/Pi: 69KA/Pi:
49Fixed a resource config read problem on windows. 70Fixed a resource config read problem on windows.
50 71
51 72
52********** VERSION 2.2.1 ************ 73********** VERSION 2.2.1 ************
53 74
54KO/Pi: 75KO/Pi:
55Fixed a problem displaying very long allday events in agenda view in single day mode. 76Fixed a problem displaying very long allday events in agenda view in single day mode.
56Fixed a problem with the default settings for new todos. 77Fixed a problem with the default settings for new todos.
57Added an error message dialog if saving of calendar files is not possible. 78Added an error message dialog if saving of calendar files is not possible.
58Made it impossible to close KO/Pi if saving fails. 79Made it impossible to close KO/Pi if saving fails.
59Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick. 80Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick.
60Added config options for conflict detection. 81Added config options for conflict detection.
61 82
62KA/Pi: 83KA/Pi:
63Added a config option to turn on asking before a contact is deleted. 84Added a config option to turn on asking before a contact is deleted.
64Fixed a problem with the default view and view selection at startup. 85Fixed a problem with the default view and view selection at startup.
65Formatted name is now set on import, if formatted name is empty. 86Formatted name is now set on import, if formatted name is empty.
66Fixed a problem of displaying images in the contact details view: 87Fixed a problem of displaying images in the contact details view:
67Now the wid/hei ratio is not changed. 88Now the wid/hei ratio is not changed.
68I a picture is larger than 128 pixels in wid or hei it is downscaled to 89I a picture is larger than 128 pixels in wid or hei it is downscaled to
69max 128 pixels wid/hei. 90max 128 pixels wid/hei.
70 91
71********** VERSION 2.2.0 ************ 92********** VERSION 2.2.0 ************
72 93
73New stable release! 94New stable release!
74Fixed some minor usability problems. 95Fixed some minor usability problems.
75Added writing of next alarm to a file for usage on pdaXrom. 96Added writing of next alarm to a file for usage on pdaXrom.
76 97
77 98
78************************************* 99*************************************
79 100
80You can find the complete changelog 101You can find the complete changelog
81from version 1.7.7 to 2.2.0 102from version 1.7.7 to 2.2.0
82in the source package or on 103in the source package or on
83 104
84http://www.pi-sync.net/html/changelog.html 105http://www.pi-sync.net/html/changelog.html
85 106
86 107
87 108
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 82873e1..2742610 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -1,701 +1,727 @@
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> 34#include <qdatetime.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qdialog.h> 38#include <qdialog.h>
39#define protected public 39#define protected public
40#include <qspinbox.h> 40#include <qspinbox.h>
41#undef protected 41#undef protected
42#include <qtextstream.h> 42#include <qtextstream.h>
43#include <qtopia/qcopenvelope_qws.h> 43#include <qtopia/qcopenvelope_qws.h>
44#include <qtopia/alarmserver.h> 44#include <qtopia/alarmserver.h>
45 45
46#include <stdlib.h> 46#include <stdlib.h>
47#include <stdio.h> 47#include <stdio.h>
48#include <unistd.h> 48#include <unistd.h>
49 49
50 50
51SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) 51SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
52 : QLabel( parent ) 52 : QLabel( parent )
53{ 53{
54 mAlarmDialog = new AlarmDialog( 0 ); 54 mAlarmDialog = new AlarmDialog( 0 );
55 mPopUp = new QPopupMenu( this ); 55 mPopUp = new QPopupMenu( this );
56 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) ); 56 mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) );
57 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) ); 57 mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) );
58 mPopUp->insertSeparator(); 58 mPopUp->insertSeparator();
59 mPopUp->insertItem( "Todo List", this, SLOT ( showTodo() ) ); 59 mPopUp->insertItem( "Todo List", this, SLOT ( showTodo() ) );
60 mPopUp->insertSeparator(); 60 mPopUp->insertSeparator();
61 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) ); 61 mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) );
62 mPopUp->insertSeparator(); 62 mPopUp->insertSeparator();
63 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) ); 63 mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) );
64 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) ); 64 mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) );
65 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) ); 65 mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) );
66 mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); 66 mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) );
67 mPopUp->insertSeparator(); 67 mPopUp->insertSeparator();
68 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); 68 mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) );
69 mTimerPopUp = new QPopupMenu( this ); 69 mTimerPopUp = new QPopupMenu( this );
70 QFont fon = mTimerPopUp->font(); 70
71 int points = (fon.pointSize()*4)/3;
72 fon.setPointSize( points );
73 mTimerPopUp->setFont( fon );
74 mPopUp->setFont( fon );
75 mBeepPopUp = new QPopupMenu( this ); 71 mBeepPopUp = new QPopupMenu( this );
76 mSoundPopUp = new QPopupMenu( this ); 72 mSoundPopUp = new QPopupMenu( this );
77 mPausePopUp = new QPopupMenu( this ); 73 mPausePopUp = new QPopupMenu( this );
74 mFontsizePopup = new QPopupMenu( this );
75 mFontsizePopup->insertItem( "10", 10 );
76 mFontsizePopup->insertItem( "12", 12 );
77 mFontsizePopup->insertItem( "14", 14 );
78 mFontsizePopup->insertItem( "16", 16 );
79 mFontsizePopup->insertItem( "18", 18 );
80 mFontsizePopup->insertItem( "24", 24 );
78 QPopupMenu* savePopUp = new QPopupMenu( this ); 81 QPopupMenu* savePopUp = new QPopupMenu( this );
79 savePopUp->insertItem( "Save", 0 ); 82 savePopUp->insertItem( "Save", 0 );
80 savePopUp->insertItem( "Load", 1 ); 83 savePopUp->insertItem( "Load", 1 );
81 mSoundPopUp->insertItem( "Buzzer", 0 ); 84 mSoundPopUp->insertItem( "Buzzer", 0 );
82 mSoundPopUp->insertItem( "Wav file", 1 ); 85 mSoundPopUp->insertItem( "Wav file", 1 );
83 mPausePopUp->insertItem( " 1 sec", 1 ); 86 mPausePopUp->insertItem( " 1 sec", 1 );
84 mPausePopUp->insertItem( " 2 sec", 2 ); 87 mPausePopUp->insertItem( " 2 sec", 2 );
85 mPausePopUp->insertItem( " 3 sec", 3 ); 88 mPausePopUp->insertItem( " 3 sec", 3 );
86 mPausePopUp->insertItem( " 5 sec", 5 ); 89 mPausePopUp->insertItem( " 5 sec", 5 );
87 mPausePopUp->insertItem( "10 sec", 10 ); 90 mPausePopUp->insertItem( "10 sec", 10 );
88 mPausePopUp->insertItem( "30 sec", 30 ); 91 mPausePopUp->insertItem( "30 sec", 30 );
89 mPausePopUp->insertItem( " 1 min", 60 ); 92 mPausePopUp->insertItem( " 1 min", 60 );
90 mPausePopUp->insertItem( " 5 min", 300 ); 93 mPausePopUp->insertItem( " 5 min", 300 );
91 mPausePopUp->insertItem( "10 min", 600 ); 94 mPausePopUp->insertItem( "10 min", 600 );
92 mSuspendPopUp = new QPopupMenu( this ); 95 mSuspendPopUp = new QPopupMenu( this );
93 mSuspendPopUp->insertItem( "Off", 0 ); 96 mSuspendPopUp->insertItem( "Off", 0 );
94 mSuspendPopUp->insertItem( " 1x", 1 ); 97 mSuspendPopUp->insertItem( " 1x", 1 );
95 mSuspendPopUp->insertItem( " 2x", 2 ); 98 mSuspendPopUp->insertItem( " 2x", 2 );
96 mSuspendPopUp->insertItem( " 3x", 3 ); 99 mSuspendPopUp->insertItem( " 3x", 3 );
97 mSuspendPopUp->insertItem( " 5x", 5 ); 100 mSuspendPopUp->insertItem( " 5x", 5 );
98 mSuspendPopUp->insertItem( "10x", 10 ); 101 mSuspendPopUp->insertItem( "10x", 10 );
99 mSuspendPopUp->insertItem( "20x", 20 ); 102 mSuspendPopUp->insertItem( "20x", 20 );
100 mSuspendPopUp->insertItem( "30x", 30 ); 103 mSuspendPopUp->insertItem( "30x", 30 );
101 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); 104 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp );
102 mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); 105 mBeepPopUp->insertItem( "Beep interval",mPausePopUp );
103 mBeepPopUp->insertItem( "Replay",mSoundPopUp ); 106 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
107 mBeepPopUp->insertItem( "Font Size",mFontsizePopup );
104 mBeepPopUp->insertItem( "Config",savePopUp ); 108 mBeepPopUp->insertItem( "Config",savePopUp );
105 mBeepPopUp->insertItem( "300", 300 ); 109 mBeepPopUp->insertItem( "300", 300 );
106 mBeepPopUp->insertItem( "180", 180 ); 110 mBeepPopUp->insertItem( "180", 180 );
107 mBeepPopUp->insertItem( "60", 60 ); 111 mBeepPopUp->insertItem( "60", 60 );
108 mBeepPopUp->insertItem( "30", 30 ); 112 mBeepPopUp->insertItem( "30", 30 );
109 mBeepPopUp->insertItem( "10", 10 ); 113 mBeepPopUp->insertItem( "10", 10 );
110 mBeepPopUp->insertItem( "3", 3 ); 114 mBeepPopUp->insertItem( "3", 3 );
111 mBeepPopUp->insertItem( "1", 1 ); 115 mBeepPopUp->insertItem( "1", 1 );
112 mBeepPopUp->insertItem( "Off", 0 ); 116 mBeepPopUp->insertItem( "Off", 0 );
113 mBeepPopUp->insertSeparator(); 117 mBeepPopUp->insertSeparator();
114 mBeepPopUp->insertItem( "Simulate", 1000 ); 118 mBeepPopUp->insertItem( "Simulate", 1000 );
115 mBeepPopUp->setCheckable( true ); 119 mBeepPopUp->setCheckable( true );
116 mPopUp->insertSeparator(); 120 mPopUp->insertSeparator();
117 mPopUp->insertItem( "Play beeps", mBeepPopUp ); 121 mPopUp->insertItem( "Play beeps", mBeepPopUp );
118 mPopUp->insertSeparator(); 122 mPopUp->insertSeparator();
119 mPopUp->insertItem( "Timer", mTimerPopUp ); 123 mPopUp->insertItem( "Timer", mTimerPopUp );
120 //mPopUp->insertSeparator(); 124 //mPopUp->insertSeparator();
121 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); 125 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
122 126
123 mPopUp->resize( mPopUp->sizeHint() ); 127 mPopUp->resize( mPopUp->sizeHint() );
124 mPlayBeeps = 60; 128 mPlayBeeps = 60;
125 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 129 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
126 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); 130 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) );
127 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); 131 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) );
128 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); 132 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) );
129 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); 133 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) );
130 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); 134 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) );
131 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); 135 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) );
132 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); 136 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) );
137 connect ( mFontsizePopup, SIGNAL( activated ( int ) ), this, SLOT (confFontSize( int ) ) );
133 mTimerTime = 0; 138 mTimerTime = 0;
134 mCustomText = "Custom Text"; 139 mCustomText = "Custom Text";
135 mCustomMinutes = 7; 140 mCustomMinutes = 7;
136 mTimerPopupConf = 1; 141 mTimerPopupConf = 1;
137 fillTimerPopUp(); 142 fillTimerPopUp();
138 mPausePlay = 0; 143 mPausePlay = 0;
139 confPause( 1 ); 144 confPause( 1 );
140 mSuspend = 0; 145 mSuspend = 0;
141 confSuspend( 0 ); 146 confSuspend( 0 );
142 if ( QApplication::desktop()->width() < 480 ) { 147 if ( QApplication::desktop()->width() < 480 ) {
143 wavAlarm = false; 148 wavAlarm = false;
144 mSoundPopUp->setItemChecked ( 0, true ); 149 mSoundPopUp->setItemChecked ( 0, true );
145 } 150 }
146 else { 151 else {
147 wavAlarm = true; 152 wavAlarm = true;
148 mSoundPopUp->setItemChecked ( 1, true ); 153 mSoundPopUp->setItemChecked ( 1, true );
149 } 154 }
150 saveSlot( 1 );
151 mTimerStartLabel = new QLabel( 0, 0, WType_Popup ); 155 mTimerStartLabel = new QLabel( 0, 0, WType_Popup );
152 //mTimerStartLabel->setCaption( "Timer started!"); 156 //mTimerStartLabel->setCaption( "Timer started!");
153 mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ; 157 mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ;
154 fon = mTimerPopUp->font(); 158 saveSlot( 1 );
155 fon.setBold( true ); 159
156 points = (fon.pointSize()*2); 160
157 fon.setPointSize( points ); 161
158 mTimerStartLabel->setFont( fon );
159} 162}
160 163
161SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() 164SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl()
162{ 165{
163 //delete mPopUp; 166 //delete mPopUp;
164 delete mAlarmDialog; 167 delete mAlarmDialog;
165 delete mTimerStartLabel; 168 delete mTimerStartLabel;
166} 169}
167 170
168void SimpleAlarmDaemonImpl::saveSlot( int load ) 171void SimpleAlarmDaemonImpl::saveSlot( int load )
169{ 172{
170 QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; 173 QString fileName = QDir::homeDirPath() +"/.kopialarmrc";
171 //qDebug("save %d ", load ); 174 //qDebug("save %d ", load );
172 QFile file( fileName ); 175 QFile file( fileName );
173 if ( load ) { 176 if ( load ) {
177 mPopupFontSize = mTimerPopUp->font().pointSize();
178 confFontSize( mPopupFontSize );
174 if( !QFile::exists( fileName) ) 179 if( !QFile::exists( fileName) )
175 return; 180 return;
176 if (!file.open( IO_ReadOnly ) ) { 181 if (!file.open( IO_ReadOnly ) ) {
177 return ; 182 return ;
178 } 183 }
179 QString line; 184 QString line;
180 bool ok; 185 bool ok;
181 int val; 186 int val;
182 int len; 187 int len;
183 while ( file.readLine( line, 1024 ) > 0 ) { 188 while ( file.readLine( line, 1024 ) > 0 ) {
184 //qDebug("read %s ", line.latin1()); 189 //qDebug("read %s ", line.latin1());
185 len = line.length(); 190 len = line.length();
186 if ( line.left(4 ) == "PPAU" ) { 191 if ( line.left(4 ) == "PPAU" ) {
187 val = line.mid( 4,len-5).toInt( &ok ); 192 val = line.mid( 4,len-5).toInt( &ok );
188 if ( ok ) { 193 if ( ok ) {
189 confPause( val ); 194 confPause( val );
190 } 195 }
191 } 196 }
197 if ( line.left(4 ) == "POFO" ) {
198 val = line.mid( 4,len-5).toInt( &ok );
199 if ( ok ) {
200 confFontSize( val );
201 }
202 }
192 if ( line.left(4 ) == "SUCO" ) { 203 if ( line.left(4 ) == "SUCO" ) {
193 val = line.mid( 4,len-5).toInt( &ok ); 204 val = line.mid( 4,len-5).toInt( &ok );
194 if ( ok ) 205 if ( ok )
195 confSuspend ( val ); 206 confSuspend ( val );
196 } 207 }
197 if ( line.left(4 ) == "WAAL" ) { 208 if ( line.left(4 ) == "WAAL" ) {
198 val = line.mid( 4,len-5).toInt( &ok ); 209 val = line.mid( 4,len-5).toInt( &ok );
199 if ( ok ) 210 if ( ok )
200 confSound( val ); 211 confSound( val );
201 212
202 } 213 }
203 if ( line.left(4 ) == "PLBE" ) { 214 if ( line.left(4 ) == "PLBE" ) {
204 val = line.mid( 4,len-5).toInt( &ok ); 215 val = line.mid( 4,len-5).toInt( &ok );
205 if ( ok ) 216 if ( ok )
206 slotPlayBeep( val ); 217 slotPlayBeep( val );
207 218
208 } 219 }
209 if ( line.left(4 ) == "CUTE" ) { 220 if ( line.left(4 ) == "CUTE" ) {
210 mCustomText = line.mid( 5,len-6); 221 mCustomText = line.mid( 5,len-6);
211 // qDebug("text ***%s*** ",mCustomText.latin1() ); 222 // qDebug("text ***%s*** ",mCustomText.latin1() );
212 223
213 } 224 }
214 if ( line.left(4 ) == "CUMI" ) { 225 if ( line.left(4 ) == "CUMI" ) {
215 val = line.mid( 4,len-5).toInt( &ok ); 226 val = line.mid( 4,len-5).toInt( &ok );
216 if ( ok ) 227 if ( ok )
217 mCustomMinutes = val; 228 mCustomMinutes = val;
218 229
219 } 230 }
220 if ( line.left(4 ) == "SUTI" ) { 231 if ( line.left(4 ) == "SUTI" ) {
221 val = line.mid( 4,len-5).toInt( &ok ); 232 val = line.mid( 4,len-5).toInt( &ok );
222 if ( ok ) 233 if ( ok )
223 mAlarmDialog->setSuspendTime( val );; 234 mAlarmDialog->setSuspendTime( val );;
224 235
225 } 236 }
226 } 237 }
227 file.close(); 238 file.close();
228 } else { 239 } else {
229 if (!file.open( IO_WriteOnly ) ) { 240 if (!file.open( IO_WriteOnly ) ) {
230 return; 241 return;
231 } 242 }
232 QString configString ; 243 QString configString ;
233 configString += "PPAU " + QString::number( mPausePlay ) + "\n"; 244 configString += "PPAU " + QString::number( mPausePlay ) + "\n";
234 configString += "SUCO " + QString::number( mSuspend ) + "\n"; 245 configString += "SUCO " + QString::number( mSuspend ) + "\n";
246 configString += "POFO " + QString::number( mPopupFontSize ) + "\n";
235 configString += "WAAL " + QString::number( wavAlarm ) + "\n"; 247 configString += "WAAL " + QString::number( wavAlarm ) + "\n";
236 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; 248 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n";
237 configString += "CUTE " + mCustomText + "\n"; 249 configString += "CUTE " + mCustomText + "\n";
238 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; 250 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n";
239 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; 251 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n";
240 QTextStream ts( &file ); 252 QTextStream ts( &file );
241 ts << configString ; 253 ts << configString ;
242 file.close(); 254 file.close();
243 } 255 }
244 256
245} 257}
246void SimpleAlarmDaemonImpl::confSuspend( int num ) 258void SimpleAlarmDaemonImpl::confSuspend( int num )
247{ 259{
248 mSuspendPopUp->setItemChecked ( mSuspend,false ); 260 mSuspendPopUp->setItemChecked ( mSuspend,false );
249 mSuspend = num; 261 mSuspend = num;
250 mSuspendPopUp->setItemChecked ( mSuspend,true ); 262 mSuspendPopUp->setItemChecked ( mSuspend,true );
251} 263}
252void SimpleAlarmDaemonImpl::confPause( int num ) 264void SimpleAlarmDaemonImpl::confPause( int num )
253{ 265{
254 mPausePopUp->setItemChecked ( mPausePlay,false ); 266 mPausePopUp->setItemChecked ( mPausePlay,false );
255 mPausePlay = num; 267 mPausePlay = num;
256 mPausePopUp->setItemChecked ( mPausePlay,true ); 268 mPausePopUp->setItemChecked ( mPausePlay,true );
257} 269}
258void SimpleAlarmDaemonImpl::confSound( int num ) 270void SimpleAlarmDaemonImpl::confSound( int num )
259{ 271{
260 if ( num == 0 ) { 272 if ( num == 0 ) {
261 wavAlarm = false; 273 wavAlarm = false;
262 mSoundPopUp->setItemChecked ( 0, true ); 274 mSoundPopUp->setItemChecked ( 0, true );
263 mSoundPopUp->setItemChecked ( 1, false ); 275 mSoundPopUp->setItemChecked ( 1, false );
264 } else { 276 } else {
265 wavAlarm = true; 277 wavAlarm = true;
266 mSoundPopUp->setItemChecked ( 0, false ); 278 mSoundPopUp->setItemChecked ( 0, false );
267 mSoundPopUp->setItemChecked ( 1, true ); 279 mSoundPopUp->setItemChecked ( 1, true );
268 } 280 }
269} 281}
270void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) 282void SimpleAlarmDaemonImpl::slotPlayBeep( int num )
271{ 283{
272 if ( num == 1000 ) { 284 if ( num == 1000 ) {
273 simulate(); 285 simulate();
274 return; 286 return;
275 } 287 }
276 mBeepPopUp->setItemChecked ( mPlayBeeps,false ); 288 mBeepPopUp->setItemChecked ( mPlayBeeps,false );
277 mPlayBeeps = num; 289 mPlayBeeps = num;
278 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 290 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
279} 291}
280 292
281void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) 293void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
282{ 294{
283 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data()); 295 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data());
284 QString mess = QString::fromUtf8(msg.data()); 296 QString mess = QString::fromUtf8(msg.data());
285 mAlarmMessage = mess.mid( 9 ); 297 mAlarmMessage = mess.mid( 9 );
286 QString filename = getenv("QPEDIR") ; 298 QString filename = getenv("QPEDIR") ;
287 filename += "/pics/kdepim/korganizer/koalarm.wav"; 299 filename += "/pics/kdepim/korganizer/koalarm.wav";
288 QString tempfilename; 300 QString tempfilename;
289 if ( mess.left( 13 ) == "suspend_alarm") { 301 if ( mess.left( 13 ) == "suspend_alarm") {
290 bool error = false; 302 bool error = false;
291 int len = mess.mid( 13 ).find("+++"); 303 int len = mess.mid( 13 ).find("+++");
292 if ( len < 2 ) 304 if ( len < 2 )
293 error = true; 305 error = true;
294 else { 306 else {
295 tempfilename = mess.mid( 13, len ); 307 tempfilename = mess.mid( 13, len );
296 if ( !QFile::exists( tempfilename ) ) 308 if ( !QFile::exists( tempfilename ) )
297 error = true; 309 error = true;
298 } 310 }
299 if ( ! error ) { 311 if ( ! error ) {
300 filename = tempfilename; 312 filename = tempfilename;
301 } 313 }
302 mAlarmMessage = mess.mid( 13+len+3 ); 314 mAlarmMessage = mess.mid( 13+len+3 );
303 //qDebug("suspend file %s ",tempfilename.latin1() ); 315 //qDebug("suspend file %s ",tempfilename.latin1() );
304 startAlarm( mAlarmMessage, filename); 316 startAlarm( mAlarmMessage, filename);
305 return; 317 return;
306 } 318 }
307 if ( mess.left( 11 ) == "timer_alarm") { 319 if ( mess.left( 11 ) == "timer_alarm") {
308 mTimerTime = 0; 320 mTimerTime = 0;
309 startAlarm( mess.mid( 11 ), filename ); 321 startAlarm( mess.mid( 11 ), filename );
310 return; 322 return;
311 } 323 }
312 if ( mess.left( 10 ) == "proc_alarm") { 324 if ( mess.left( 10 ) == "proc_alarm") {
313 bool error = false; 325 bool error = false;
314 int len = mess.mid( 10 ).find("+++"); 326 int len = mess.mid( 10 ).find("+++");
315 if ( len < 2 ) 327 if ( len < 2 )
316 error = true; 328 error = true;
317 else { 329 else {
318 tempfilename = mess.mid( 10, len ); 330 tempfilename = mess.mid( 10, len );
319 if ( !QFile::exists( tempfilename ) ) 331 if ( !QFile::exists( tempfilename ) )
320 error = true; 332 error = true;
321 } 333 }
322 if ( error ) { 334 if ( error ) {
323 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 335 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
324 mAlarmMessage += mess.mid( 10+len+3+9 ); 336 mAlarmMessage += mess.mid( 10+len+3+9 );
325 } else { 337 } else {
326 //qDebug("-----system command %s ",tempfilename.latin1() ); 338 //qDebug("-----system command %s ",tempfilename.latin1() );
327 if ( vfork () == 0 ) { 339 if ( vfork () == 0 ) {
328 execl ( tempfilename.latin1(), 0 ); 340 execl ( tempfilename.latin1(), 0 );
329 return; 341 return;
330 } 342 }
331 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) ); 343 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) );
332 return; 344 return;
333 } 345 }
334 346
335 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 347 //qDebug("+++++++system command %s ",tempfilename.latin1() );
336 } 348 }
337 if ( mess.left( 11 ) == "audio_alarm") { 349 if ( mess.left( 11 ) == "audio_alarm") {
338 bool error = false; 350 bool error = false;
339 int len = mess.mid( 11 ).find("+++"); 351 int len = mess.mid( 11 ).find("+++");
340 if ( len < 2 ) 352 if ( len < 2 )
341 error = true; 353 error = true;
342 else { 354 else {
343 tempfilename = mess.mid( 11, len ); 355 tempfilename = mess.mid( 11, len );
344 if ( !QFile::exists( tempfilename ) ) 356 if ( !QFile::exists( tempfilename ) )
345 error = true; 357 error = true;
346 } 358 }
347 if ( ! error ) { 359 if ( ! error ) {
348 filename = tempfilename; 360 filename = tempfilename;
349 } 361 }
350 mAlarmMessage = mess.mid( 11+len+3+9 ); 362 mAlarmMessage = mess.mid( 11+len+3+9 );
351 //qDebug("audio file command %s ",tempfilename.latin1() ); 363 //qDebug("audio file command %s ",tempfilename.latin1() );
352 } 364 }
353 if ( mess.left( 9 ) == "cal_alarm") { 365 if ( mess.left( 9 ) == "cal_alarm") {
354 mAlarmMessage = mess.mid( 9 ) ; 366 mAlarmMessage = mess.mid( 9 ) ;
355 } 367 }
356 368
357 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) ); 369 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) );
358 startAlarm( mAlarmMessage, filename ); 370 startAlarm( mAlarmMessage, filename );
359 371
360} 372}
361 373
362int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) 374int SimpleAlarmDaemonImpl::getFileNameLen( QString mess )
363{ 375{
364 return 0; 376 return 0;
365} 377}
366void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) 378void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename )
367{ 379{
368 //mAlarmDialog->show(); 380 //mAlarmDialog->show();
369 //mAlarmDialog->raise(); 381 //mAlarmDialog->raise();
370 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); 382 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend );
371} 383}
372 384
373 385
374void SimpleAlarmDaemonImpl::fillTimerPopUp() 386void SimpleAlarmDaemonImpl::fillTimerPopUp()
375{ 387{
376 388
377 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime ); 389 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime );
378 if ( mTimerPopupConf == mTimerTime ) { 390 if ( mTimerPopupConf == mTimerTime ) {
379 if ( mTimerTime ) { 391 if ( mTimerTime ) {
380 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 392 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
381 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 393 QTime t ( secs/3600, (secs/60)%60, secs%60 );
382 mTimerPopUp->changeItem ( 1 , t.toString() + " (countdown)"); 394 mTimerPopUp->changeItem ( 1 , t.toString() + " (countdown)");
383 } 395 }
384 else { 396 else {
385 QString text = mCustomText.stripWhiteSpace (); 397 QString text = mCustomText.stripWhiteSpace ();
386 int in = text.find( " " ); 398 int in = text.find( " " );
387 text = text.left ( in ); 399 text = text.left ( in );
388 mTimerPopUp->changeItem ( 3, text ); 400 mTimerPopUp->changeItem ( 3, text );
389 } 401 }
390 return; 402 return;
391 } 403 }
392 mTimerPopupConf = mTimerTime; 404 mTimerPopupConf = mTimerTime;
393 mTimerPopUp->clear(); 405 mTimerPopUp->clear();
394 if ( mTimerTime ) { 406 if ( mTimerTime ) {
395 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 407 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
396 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 408 QTime t ( secs/3600, (secs/60)%60, secs%60 );
397 409
398 410
399 mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 ); 411 mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 );
400 mTimerPopUp->insertItem( t.toString() + " (countdown)",1); 412 mTimerPopUp->insertItem( t.toString() + " (countdown)",1);
401 mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm)",2); 413 mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm)",2);
402 } else { 414 } else {
403 415
404 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc"; 416 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc";
405 QFile file( fileName ); 417 QFile file( fileName );
406 if( !QFile::exists( fileName) ) { 418 if( !QFile::exists( fileName) ) {
407 // write defaults 419 // write defaults
408 if (!file.open( IO_WriteOnly ) ) { 420 if (!file.open( IO_WriteOnly ) ) {
409 return; 421 return;
410 } 422 }
411 QString configString ; 423 QString configString ;
412 configString += "#config file for kopi alarm timer\n"; 424 configString += "#config file for kopi alarm timer\n";
413 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n"; 425 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n";
414 configString += "24 hours; 1440\n"; 426 configString += "24 hours; 1440\n";
415 configString += "9 hours; 540\n"; 427 configString += "9 hours; 540\n";
416 configString += "8 hours; 480\n"; 428 configString += "8 hours; 480\n";
417 configString += "1 hour; 60\n"; 429 configString += "1 hour; 60\n";
418 configString += "30 min; 30\n"; 430 configString += "30 min; 30\n";
419 configString += "15 min; 15\n"; 431 configString += "15 min; 15\n";
420 configString += "SEPARATOR\n"; 432 configString += "SEPARATOR\n";
421 configString += "Pizza; 22\n"; 433 configString += "Pizza; 22\n";
422 configString += "Nap; 45\n"; 434 configString += "Nap; 45\n";
423 configString += "Tea; 5\n"; 435 configString += "Tea; 5\n";
424 QTextStream ts( &file ); 436 QTextStream ts( &file );
425 ts << configString ; 437 ts << configString ;
426 file.close(); 438 file.close();
427 } 439 }
428 440
429 if (!file.open( IO_ReadOnly ) ) { 441 if (!file.open( IO_ReadOnly ) ) {
430 return ; 442 return ;
431 } 443 }
432 QString line; 444 QString line;
433 bool ok; 445 bool ok;
434 while ( file.readLine( line, 1024 ) > 0 ) { 446 while ( file.readLine( line, 1024 ) > 0 ) {
435 //qDebug("read %s ", line.latin1()); 447 //qDebug("read %s ", line.latin1());
436 if ( line.left(1 ) != "#" ) { 448 if ( line.left(1 ) != "#" ) {
437 // no comment 449 // no comment
438 if ( line.left(9 ) == "SEPARATOR" ) { 450 if ( line.left(9 ) == "SEPARATOR" ) {
439 mTimerPopUp->insertSeparator(); 451 mTimerPopUp->insertSeparator();
440 } else { 452 } else {
441 QStringList li = QStringList::split(";",line); 453 QStringList li = QStringList::split(";",line);
442 ok = false; 454 ok = false;
443 if ( li.count() == 2 ) { 455 if ( li.count() == 2 ) {
444 int val = li[1].toInt( &ok ); 456 int val = li[1].toInt( &ok );
445 if ( ok && val > 0 ) { 457 if ( ok && val > 0 ) {
446 mTimerPopUp->insertItem( li[0], val+10); 458 mTimerPopUp->insertItem( li[0], val+10);
447 } 459 }
448 } 460 }
449 } 461 }
450 } 462 }
451 } 463 }
452 file.close(); 464 file.close();
453#if 0 465#if 0
454 mTimerPopUp->insertItem( "24 hours", 1440 ); 466 mTimerPopUp->insertItem( "24 hours", 1440 );
455 // mTimerPopUp->insertItem( i18n("12 h"), 720 ); 467 // mTimerPopUp->insertItem( i18n("12 h"), 720 );
456 mTimerPopUp->insertItem( " 8 hours", 480 ); 468 mTimerPopUp->insertItem( " 8 hours", 480 );
457 mTimerPopUp->insertItem( " 5 hours", 300 ); 469 mTimerPopUp->insertItem( " 5 hours", 300 );
458 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 ); 470 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 );
459 mTimerPopUp->insertItem( " 1 hour", 60 ); 471 mTimerPopUp->insertItem( " 1 hour", 60 );
460 mTimerPopUp->insertItem( "30 min", 30 ); 472 mTimerPopUp->insertItem( "30 min", 30 );
461 mTimerPopUp->insertItem( "15 min", 15 ); 473 mTimerPopUp->insertItem( "15 min", 15 );
462 mTimerPopUp->insertItem( "10 min", 10 ); 474 mTimerPopUp->insertItem( "10 min", 10 );
463 //mTimerPopUp->insertItem( " 5 min", 5 ); 475 //mTimerPopUp->insertItem( " 5 min", 5 );
464 mTimerPopUp->insertSeparator(); 476 mTimerPopUp->insertSeparator();
465 mTimerPopUp->insertItem( "Pizza", 22 ); 477 mTimerPopUp->insertItem( "Pizza", 22 );
466 mTimerPopUp->insertItem( "Nap", 45 ); 478 mTimerPopUp->insertItem( "Nap", 45 );
467 mTimerPopUp->insertItem( "Tea", 5 ); 479 mTimerPopUp->insertItem( "Tea", 5 );
468#endif 480#endif
469 QString text = mCustomText.stripWhiteSpace (); 481 QString text = mCustomText.stripWhiteSpace ();
470 int in = text.find( " " ); 482 int in = text.find( " " );
471 text = text.left ( in ); 483 text = text.left ( in );
472 mTimerPopUp->insertItem( text, 3 ); 484 mTimerPopUp->insertItem( text, 3 );
473 mTimerPopUp->insertSeparator(); 485 mTimerPopUp->insertSeparator();
474 mTimerPopUp->insertItem( "Customize", 2 ); 486 mTimerPopUp->insertItem( "Customize", 2 );
475 } 487 }
476 488
477} 489}
478 490
479void SimpleAlarmDaemonImpl::showTimer() 491void SimpleAlarmDaemonImpl::showTimer()
480{ 492{
481 fillTimerPopUp(); 493 fillTimerPopUp();
482} 494}
483 495
484void SimpleAlarmDaemonImpl::confTimer( int time ) 496void SimpleAlarmDaemonImpl::confTimer( int time )
485{ 497{
486 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time ); 498 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time );
487 int minutes = time; 499 int minutes = time;
488 if ( minutes == 0 ) { 500 if ( minutes == 0 ) {
489 if ( ! mTimerTime ) 501 if ( ! mTimerTime )
490 return; 502 return;
491 503
492 QDialog dia ( 0, ("Stop Timer" ), true ); 504 QDialog dia ( 0, ("Stop Timer" ), true );
493 QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia ); 505 QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia );
494 lab.setAlignment( AlignCenter ); 506 lab.setAlignment( AlignCenter );
495 dia.setCaption(("KO/Pi Timer Stop" )); 507 dia.setCaption(("KO/Pi Timer Stop" ));
496 QVBoxLayout lay( &dia ); 508 QVBoxLayout lay( &dia );
497 lay.addWidget( &lab); 509 lay.addWidget( &lab);
498 QPushButton ok ( "Stop timer!", &dia); 510 QPushButton ok ( "Stop timer!", &dia);
499 QFont fo = dia.font(); 511 QFont fo = dia.font();
500 fo.setPointSize( 36 ); 512 fo.setPointSize( 36 );
501 ok.setFont( fo ); 513 ok.setFont( fo );
502 lay.addWidget( &ok); 514 lay.addWidget( &ok);
503 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); 515 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
504 QPushButton con ( "Continue timer!", &dia); 516 QPushButton con ( "Continue timer!", &dia);
505 fo.setPointSize( 36 ); 517 fo.setPointSize( 36 );
506 con.setFont( fo ); 518 con.setFont( fo );
507 lay.addWidget( &con); 519 lay.addWidget( &con);
508 connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) ); 520 connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) );
509 lay.setMargin(5); 521 lay.setMargin(5);
510 lay.setSpacing(5); 522 lay.setSpacing(5);
511 dia.resize(dia.sizeHint() ); 523 dia.resize(dia.sizeHint() );
512 524
513 if ( !dia.exec() ) 525 if ( !dia.exec() )
514 return; 526 return;
515 527
516 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.utf8() ); 528 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.utf8() );
517 mTimerTime = 0; 529 mTimerTime = 0;
518 return; 530 return;
519 } 531 }
520 if ( mTimerTime ) 532 if ( mTimerTime )
521 return; 533 return;
522 if ( minutes == 1 ) { 534 if ( minutes == 1 ) {
523 return; 535 return;
524 } 536 }
525 QString mess = "timer_alarm"; 537 QString mess = "timer_alarm";
526 QString disp; 538 QString disp;
527 mess += ("Timer Alarm!\n"); 539 mess += ("Timer Alarm!\n");
528 if ( minutes == 3 ) { 540 if ( minutes == 3 ) {
529 mess += mCustomText; 541 mess += mCustomText;
530 minutes = mCustomMinutes ; 542 minutes = mCustomMinutes ;
531 mRunningTimerText = mCustomText.stripWhiteSpace (); 543 mRunningTimerText = mCustomText.stripWhiteSpace ();
532 int in = mRunningTimerText.find( " " ); 544 int in = mRunningTimerText.find( " " );
533 mRunningTimerText = mRunningTimerText.left ( in ); 545 mRunningTimerText = mRunningTimerText.left ( in );
534 disp = mCustomText; 546 disp = mCustomText;
535 } 547 }
536 else { 548 else {
537 if ( minutes == 2 ) { 549 if ( minutes == 2 ) {
538 // ask time 550 // ask time
539 QDialog dia ( 0, ("Customize Timer" ), true ); 551 QDialog dia ( 0, ("Customize Timer" ), true );
540 QLabel lab (("Message Text:"), &dia ); 552 QLabel lab (("Message Text:"), &dia );
541 dia.setCaption(("KO/Pi Timer" )); 553 dia.setCaption(("KO/Pi Timer" ));
542 QVBoxLayout lay( &dia ); 554 QVBoxLayout lay( &dia );
543 lay.setMargin(5); 555 lay.setMargin(5);
544 lay.setSpacing(5); 556 lay.setSpacing(5);
545 lay.addWidget( &lab); 557 lay.addWidget( &lab);
546 QLineEdit lEdit( mCustomText, &dia ); 558 QLineEdit lEdit( mCustomText, &dia );
547 lay.addWidget( &lEdit); 559 lay.addWidget( &lEdit);
548 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); 560 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia );
549 lay.addWidget( &lab2); 561 lay.addWidget( &lab2);
550 QHBox hbox1 ( &dia ); 562 QHBox hbox1 ( &dia );
551 lay.addWidget( &hbox1); 563 lay.addWidget( &hbox1);
552 QLabel lab3 (("Hours"), &hbox1 ); 564 QLabel lab3 (("Hours"), &hbox1 );
553 QLabel lab4 (("Minutes"), &hbox1 ); 565 QLabel lab4 (("Minutes"), &hbox1 );
554 QHBox hbox ( &dia ); 566 QHBox hbox ( &dia );
555 QSpinBox spinh( 0, 24, 1,& hbox ); 567 QSpinBox spinh( 0, 24, 1,& hbox );
556 QFont fo = dia.font(); 568 QFont fo = dia.font();
557 fo.setPointSize( 36 ); 569 fo.setPointSize( 36 );
558 QSpinBox spinm( 0, 59, 1,&hbox ); 570 QSpinBox spinm( 0, 59, 1,&hbox );
559 spinm.setFont( fo ); 571 spinm.setFont( fo );
560 spinh.setFont( fo ); 572 spinh.setFont( fo );
561 spinh.setButtonSymbols( QSpinBox::PlusMinus ); 573 spinh.setButtonSymbols( QSpinBox::PlusMinus );
562 spinm.setButtonSymbols( QSpinBox::PlusMinus ); 574 spinm.setButtonSymbols( QSpinBox::PlusMinus );
563 spinh.upButton ()->setFixedSize( QSize( 48, 30 )); 575 spinh.upButton ()->setFixedSize( QSize( 48, 30 ));
564 spinh.downButton ()->setFixedSize( QSize( 48, 30 )); 576 spinh.downButton ()->setFixedSize( QSize( 48, 30 ));
565 //spinh.editor ()->setFixedSize( QSize( 50, 100 )); 577 //spinh.editor ()->setFixedSize( QSize( 50, 100 ));
566 spinh.setFixedSize( 100,62 ); 578 spinh.setFixedSize( 100,62 );
567 spinm.upButton ()->setFixedSize( QSize( 48, 30 )); 579 spinm.upButton ()->setFixedSize( QSize( 48, 30 ));
568 spinm.downButton ()->setFixedSize( QSize( 48, 30 )); 580 spinm.downButton ()->setFixedSize( QSize( 48, 30 ));
569 spinm.downButton ()->setGeometry( 50,50,50,50); 581 spinm.downButton ()->setGeometry( 50,50,50,50);
570 // spinm.setSuffix( " m" ); 582 // spinm.setSuffix( " m" );
571 //spinh.setSuffix( " h" ); 583 //spinh.setSuffix( " h" );
572 spinm.setWrapping ( true ); 584 spinm.setWrapping ( true );
573 //spinm.editor ()->setFixedSize( QSize( 50, 100 )); 585 //spinm.editor ()->setFixedSize( QSize( 50, 100 ));
574 spinm.setLineStep( 1 ); 586 spinm.setLineStep( 1 );
575 spinm.setFixedSize( 110,62 ); 587 spinm.setFixedSize( 110,62 );
576 lay.addWidget( &hbox); 588 lay.addWidget( &hbox);
577 QLabel lab5 ("Timer fires at:", &dia ); 589 QLabel lab5 ("Timer fires at:", &dia );
578 lab5.setAlignment( AlignCenter ); 590 lab5.setAlignment( AlignCenter );
579 lay.addWidget( &lab5); 591 lay.addWidget( &lab5);
580 KODateLabel dl ( &dia ); 592 KODateLabel dl ( &dia );
581 dl.setAlignment( AlignCenter ); 593 dl.setAlignment( AlignCenter );
582 dl.setFont( fo ); 594 dl.setFont( fo );
583 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); 595 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) );
584 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); 596 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) );
585 lay.addWidget( &dl); 597 lay.addWidget( &dl);
586 spinh.setValue( mCustomMinutes/60 ); 598 spinh.setValue( mCustomMinutes/60 );
587 spinm.setValue( mCustomMinutes%60 ); 599 spinm.setValue( mCustomMinutes%60 );
588 QPushButton ok ( "Start timer", &dia); 600 QPushButton ok ( "Start timer", &dia);
589 ok.setDefault( true ); 601 ok.setDefault( true );
590 ok.setFont( fo ); 602 ok.setFont( fo );
591 spinh.setFocus(); 603 spinh.setFocus();
592 lay.addWidget( &ok); 604 lay.addWidget( &ok);
593 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); 605 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
594 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); 606 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
595 607
596 if ( !dia.exec() ) 608 if ( !dia.exec() )
597 return; 609 return;
598 mCustomText = lEdit.text(); 610 mCustomText = lEdit.text();
599 mCustomMinutes = spinh.value()*60+spinm.value(); 611 mCustomMinutes = spinh.value()*60+spinm.value();
600 if ( mCustomMinutes == 0 ) 612 if ( mCustomMinutes == 0 )
601 mCustomMinutes = 1; 613 mCustomMinutes = 1;
602 if ( mCustomMinutes > 1440 ) 614 if ( mCustomMinutes > 1440 )
603 mCustomMinutes = 1440; 615 mCustomMinutes = 1440;
604 mess += mCustomText; 616 mess += mCustomText;
605 disp = mCustomText; 617 disp = mCustomText;
606 minutes = mCustomMinutes; 618 minutes = mCustomMinutes;
607 mRunningTimerText = mCustomText.stripWhiteSpace (); 619 mRunningTimerText = mCustomText.stripWhiteSpace ();
608 int in = mRunningTimerText.find( " " ); 620 int in = mRunningTimerText.find( " " );
609 mRunningTimerText = mRunningTimerText.left ( in ); 621 mRunningTimerText = mRunningTimerText.left ( in );
610 } 622 }
611 else { 623 else {
612 mess += mTimerPopUp->text( minutes ); 624 mess += mTimerPopUp->text( minutes );
613 disp = mTimerPopUp->text( minutes ); 625 disp = mTimerPopUp->text( minutes );
614 mRunningTimerText = mTimerPopUp->text( minutes ); 626 mRunningTimerText = mTimerPopUp->text( minutes );
615 minutes -= 10; 627 minutes -= 10;
616 } 628 }
617 } 629 }
618 //minutes = 1; 630 //minutes = 1;
619 631
620 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); 632 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
621 timerMesssage = mess; 633 timerMesssage = mess;
622 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); 634 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8());
623 mTimerStartLabel->setText( disp + "\n\nTimer started!" ); 635 mTimerStartLabel->setText( disp + "\n\nTimer started!" );
624 int w = mTimerStartLabel->sizeHint().width()+20; 636 int w = mTimerStartLabel->sizeHint().width()+20;
625 int h = mTimerStartLabel->sizeHint().height()+40 ; 637 int h = mTimerStartLabel->sizeHint().height()+40 ;
626 int dw = QApplication::desktop()->width(); 638 int dw = QApplication::desktop()->width();
627 int dh = QApplication::desktop()->height(); 639 int dh = QApplication::desktop()->height();
628 mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 640 mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
629 mTimerStartLabel->show(); 641 mTimerStartLabel->show();
630 QTimer::singleShot( 5000, mTimerStartLabel, SLOT ( hide() ) ); 642 QTimer::singleShot( 5000, mTimerStartLabel, SLOT ( hide() ) );
631 mTimerTime = 1; 643 mTimerTime = 1;
632} 644}
633 645
646void SimpleAlarmDaemonImpl::confFontSize( int size )
647{
648
649 mFontsizePopup->setItemChecked( mPopupFontSize, false );
650 mPopupFontSize = size;
651 mFontsizePopup->setItemChecked( mPopupFontSize, true );
652 QFont fon = mTimerPopUp->font();
653 fon.setPointSize( mPopupFontSize );
654 mTimerPopUp->setFont( fon );
655 mPopUp->setFont( fon );
656 fon.setBold( true );
657 fon.setPointSize( mPopupFontSize * 2 );
658 mTimerStartLabel->setFont( fon );
659}
634void SimpleAlarmDaemonImpl::writeFile() 660void SimpleAlarmDaemonImpl::writeFile()
635{ 661{
636 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 662 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
637 //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); 663 //QCopEnvelope e("QPE/Application/kopi", "-writeFile");
638} 664}
639void SimpleAlarmDaemonImpl::showWN() 665void SimpleAlarmDaemonImpl::showWN()
640{ 666{
641 QCopEnvelope e("QPE/Application/kopi", "-showWN"); 667 QCopEnvelope e("QPE/Application/kopi", "-showWN");
642} 668}
643void SimpleAlarmDaemonImpl::newTodo() 669void SimpleAlarmDaemonImpl::newTodo()
644{ 670{
645 QCopEnvelope e("QPE/Application/kopi", "-newTodo"); 671 QCopEnvelope e("QPE/Application/kopi", "-newTodo");
646} 672}
647 673
648void SimpleAlarmDaemonImpl::newEvent() 674void SimpleAlarmDaemonImpl::newEvent()
649{ 675{
650 QCopEnvelope e("QPE/Application/kopi", "-newEvent"); 676 QCopEnvelope e("QPE/Application/kopi", "-newEvent");
651 677
652} 678}
653void SimpleAlarmDaemonImpl::newMail() 679void SimpleAlarmDaemonImpl::newMail()
654{ 680{
655 QCopEnvelope e("QPE/Application/ompi", "newMail()"); 681 QCopEnvelope e("QPE/Application/ompi", "newMail()");
656} 682}
657void SimpleAlarmDaemonImpl::showAdd() 683void SimpleAlarmDaemonImpl::showAdd()
658{ 684{
659 QCopEnvelope e("QPE/Application/kapi", "raise()"); 685 QCopEnvelope e("QPE/Application/kapi", "raise()");
660} 686}
661void SimpleAlarmDaemonImpl::ringSync() 687void SimpleAlarmDaemonImpl::ringSync()
662{ 688{
663 QCopEnvelope e("QPE/Application/kopi", "-ringSync"); 689 QCopEnvelope e("QPE/Application/kopi", "-ringSync");
664 690
665} 691}
666void SimpleAlarmDaemonImpl::newCountdown() 692void SimpleAlarmDaemonImpl::newCountdown()
667{ 693{
668 //recieve("cal_alarm", 10 ); 694 //recieve("cal_alarm", 10 );
669} 695}
670void SimpleAlarmDaemonImpl::simulate() 696void SimpleAlarmDaemonImpl::simulate()
671{ 697{
672 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) ); 698 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) );
673 QString filename = getenv("QPEDIR") ; 699 QString filename = getenv("QPEDIR") ;
674 filename += "/pics/kdepim/korganizer/koalarm.wav"; 700 filename += "/pics/kdepim/korganizer/koalarm.wav";
675 startAlarm("Alarm simulation", filename ); 701 startAlarm("Alarm simulation", filename );
676} 702}
677void SimpleAlarmDaemonImpl::showKO() 703void SimpleAlarmDaemonImpl::showKO()
678{ 704{
679 QCopEnvelope e("QPE/Application/kopi", "-showKO"); 705 QCopEnvelope e("QPE/Application/kopi", "-showKO");
680 // testing only 706 // testing only
681 //QCopEnvelope e("QPE/Application/kopi", "nextView()"); 707 //QCopEnvelope e("QPE/Application/kopi", "nextView()");
682 708
683} 709}
684void SimpleAlarmDaemonImpl::showTodo() 710void SimpleAlarmDaemonImpl::showTodo()
685{ 711{
686 QCopEnvelope e("QPE/Application/kopi", "-showTodo"); 712 QCopEnvelope e("QPE/Application/kopi", "-showTodo");
687 713
688} 714}
689void SimpleAlarmDaemonImpl::writeJournal() 715void SimpleAlarmDaemonImpl::writeJournal()
690{ 716{
691 QCopEnvelope e("QPE/Application/kopi", "-showJournal"); 717 QCopEnvelope e("QPE/Application/kopi", "-showJournal");
692 718
693} 719}
694 720
695void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) 721void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * )
696{ 722{
697 723
698 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); 724 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() )));
699 725
700} 726}
701 727
diff --git a/kalarmd/simplealarmdaemonimpl.h b/kalarmd/simplealarmdaemonimpl.h
index 9b7de94..06ef91b 100644
--- a/kalarmd/simplealarmdaemonimpl.h
+++ b/kalarmd/simplealarmdaemonimpl.h
@@ -1,120 +1,122 @@
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#include <qtimer.h>
30 30
31class QLabel; 31class QLabel;
32class QTimer; 32class QTimer;
33class QPopupMenu; 33class QPopupMenu;
34class AlarmDialog; 34class AlarmDialog;
35class SimpleAlarmDaemonImpl : public QLabel 35class SimpleAlarmDaemonImpl : public QLabel
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 SimpleAlarmDaemonImpl( QWidget *parent = 0 ); 39 SimpleAlarmDaemonImpl( QWidget *parent = 0 );
40 40
41 ~SimpleAlarmDaemonImpl(); 41 ~SimpleAlarmDaemonImpl();
42 42
43 protected slots: 43 protected slots:
44 void recieve( const QCString& msg, const QByteArray& data ); 44 void recieve( const QCString& msg, const QByteArray& data );
45 void newTodo(); 45 void newTodo();
46 void newEvent(); 46 void newEvent();
47 void newCountdown(); 47 void newCountdown();
48 void simulate(); 48 void simulate();
49 void showKO(); 49 void showKO();
50 void showWN(); 50 void showWN();
51 void showAdd(); 51 void showAdd();
52 void newMail(); 52 void newMail();
53 void ringSync(); 53 void ringSync();
54 void showTodo(); 54 void showTodo();
55 void writeFile(); 55 void writeFile();
56 void writeJournal(); 56 void writeJournal();
57 void slotPlayBeep( int ); 57 void slotPlayBeep( int );
58 void showTimer( ); 58 void showTimer( );
59 void confPause( int ); 59 void confPause( int );
60 void confFontSize( int );
60 void confTimer( int ); 61 void confTimer( int );
61 void saveSlot( int ); 62 void saveSlot( int );
62 void confSuspend( int ); 63 void confSuspend( int );
63 void confSound( int num ); 64 void confSound( int num );
64 void startAlarm(QString mess, QString fn ); 65 void startAlarm(QString mess, QString fn );
65 66
66 protected: 67 protected:
67 void mousePressEvent( QMouseEvent * ); 68 void mousePressEvent( QMouseEvent * );
68 69
69 private: 70 private:
70 AlarmDialog *mAlarmDialog; 71 AlarmDialog *mAlarmDialog;
71 QLabel * mTimerStartLabel; 72 QLabel * mTimerStartLabel;
72 int mPlayBeeps; 73 int mPlayBeeps;
73 int mPausePlay; 74 int mPausePlay;
74 int mSuspend; 75 int mSuspend;
75 QString mAlarmMessage; 76 QString mAlarmMessage;
76 int mTimerTime; 77 int mTimerTime;
77 int getFileNameLen( QString ); 78 int getFileNameLen( QString );
78 QPopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp; 79 QPopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp, *mFontsizePopup;
79 QDateTime mRunningTimer; 80 QDateTime mRunningTimer;
80 void fillTimerPopUp(); 81 void fillTimerPopUp();
81 QString timerMesssage; 82 QString timerMesssage;
82 QString mCustomText; 83 QString mCustomText;
83 QString mRunningTimerText; 84 QString mRunningTimerText;
84 int mCustomMinutes; 85 int mCustomMinutes;
85 int mTimerPopupConf; 86 int mTimerPopupConf;
87 int mPopupFontSize;
86 bool wavAlarm; 88 bool wavAlarm;
87}; 89};
88class KODateLabel : public QLabel 90class KODateLabel : public QLabel
89{ 91{
90 Q_OBJECT 92 Q_OBJECT
91 public: 93 public:
92 KODateLabel( QWidget *parent=0, const char *name=0 ) : 94 KODateLabel( QWidget *parent=0, const char *name=0 ) :
93 QLabel( parent, name ) 95 QLabel( parent, name )
94 { 96 {
95 hour = 0; 97 hour = 0;
96 minutes = 0; 98 minutes = 0;
97 QTimer * ti = new QTimer( this ); 99 QTimer * ti = new QTimer( this );
98 connect ( ti, SIGNAL ( timeout () ), this, SLOT ( updateText() )); 100 connect ( ti, SIGNAL ( timeout () ), this, SLOT ( updateText() ));
99 ti->start( 1000 ); 101 ti->start( 1000 );
100 102
101 } 103 }
102public slots: 104public slots:
103 void slot_minutes( int m ) 105 void slot_minutes( int m )
104 { 106 {
105 minutes = m; updateText(); 107 minutes = m; updateText();
106 } 108 }
107 void slot_hours( int h ) 109 void slot_hours( int h )
108 { 110 {
109 hour = h; updateText(); 111 hour = h; updateText();
110 } 112 }
111private slots: 113private slots:
112 void updateText() 114 void updateText()
113 { 115 {
114 QDateTime dt = QDateTime::currentDateTime(); 116 QDateTime dt = QDateTime::currentDateTime();
115 dt = dt.addSecs( minutes * 60 + hour * 3600 ); 117 dt = dt.addSecs( minutes * 60 + hour * 3600 );
116 setText( dt.time().toString() ); 118 setText( dt.time().toString() );
117 } 119 }
118 int hour, minutes; 120 int hour, minutes;
119}; 121};
120#endif 122#endif