summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--desktop/rpm/kdepim_rpm2
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp17
-rw-r--r--version2
3 files changed, 14 insertions, 7 deletions
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm
index 9076943..bf19aca 100644
--- a/desktop/rpm/kdepim_rpm
+++ b/desktop/rpm/kdepim_rpm
@@ -1,84 +1,84 @@
1Summary: A collection of PIM programs 1Summary: A collection of PIM programs
2Name: KDE-Pim-Pi 2Name: KDE-Pim-Pi
3Version: 2.2.6 3Version: 2.2.7
4Release: SuSE_9.2 4Release: SuSE_9.2
5Copyright:GPL 5Copyright:GPL
6Group: Productivity/Pim 6Group: Productivity/Pim
7Source:http://sourceforge.net/projects/kdepimpi/ 7Source:http://sourceforge.net/projects/kdepimpi/
8URL:http://sourceforge.net/projects/kdepimpi/ 8URL:http://sourceforge.net/projects/kdepimpi/
9Packager: zautrix 9Packager: zautrix
10 10
11%description 11%description
12This package contains the platform-independent PIM programs from 12This package contains the platform-independent PIM programs from
13www.pi-sync.info, compiled for SuSE 9.2: 13www.pi-sync.info, compiled for SuSE 9.2:
14KTimeTacker/Pi 14KTimeTacker/Pi
15KPhone/Pi 15KPhone/Pi
16KAddressbook/Pi 16KAddressbook/Pi
17KOrganizer/Pi 17KOrganizer/Pi
18PasswordManager/Pi 18PasswordManager/Pi
19KOPieMail/Pi 19KOPieMail/Pi
20 20
21These applications do not need anything from the KDE-desktop 21These applications do not need anything from the KDE-desktop
22at all to run on Linux. However, there is a dependency from 22at all to run on Linux. However, there is a dependency from
23two KDE libs, because a small command line program is included 23two KDE libs, because a small command line program is included
24to make it possible to sync with the KDE-desktop applications. 24to make it possible to sync with the KDE-desktop applications.
25 25
26These applications are independent from the KDE-desktop 26These applications are independent from the KDE-desktop
27environment. That means, nothing of your existing 27environment. That means, nothing of your existing
28KDE-desktop setup will be changed, or any data 28KDE-desktop setup will be changed, or any data
29(calendar-addressbook) used by the KDE-desktop 29(calendar-addressbook) used by the KDE-desktop
30applications will be changed or accessed. 30applications will be changed or accessed.
31These applications stores their data and config in 31These applications stores their data and config in
32$HOME/kdepim/ 32$HOME/kdepim/
33However, because the same file format is used, 33However, because the same file format is used,
34an easy exchange of data with the KDE-desktop 34an easy exchange of data with the KDE-desktop
35is possible. 35is possible.
36A small command line program is included 36A small command line program is included
37to make it possible to sync with the KDE-desktop applications. 37to make it possible to sync with the KDE-desktop applications.
38You do not need to call this program from the commandline, 38You do not need to call this program from the commandline,
39it is called from the KDE-Pim/Pi apps when you choose there: 39it is called from the KDE-Pim/Pi apps when you choose there:
40Sync with KDE_Desktop. 40Sync with KDE_Desktop.
41If something is going wrong, please start the 41If something is going wrong, please start the
42KDE-Pim/Pi program itself from the console to get detailed output. 42KDE-Pim/Pi program itself from the console to get detailed output.
43 43
44After installation, you should have a 44After installation, you should have a
45PIM-pi 45PIM-pi
46folder in your KDE start menu, where you can 46folder in your KDE start menu, where you can
47start the applications from. 47start the applications from.
48 48
49These programs makes it possible to sync your Zaurus easily 49These programs makes it possible to sync your Zaurus easily
50(with the KDE-Pim/Pi programs running on the Zaurus) 50(with the KDE-Pim/Pi programs running on the Zaurus)
51with the KDE-desktop calendar/addressbook data. 51with the KDE-desktop calendar/addressbook data.
52If you want to use that, you have to update your 52If you want to use that, you have to update your
53KDE-desktop to version 3.3.0 or higher. 53KDE-desktop to version 3.3.0 or higher.
54SuSE 9.2 contains KDE 3.3.0 such that no update is needed. 54SuSE 9.2 contains KDE 3.3.0 such that no update is needed.
55Actually - after the (non difficult) configuration is set up - 55Actually - after the (non difficult) configuration is set up -
56with two mouseklicks on the Zaurus, 56with two mouseklicks on the Zaurus,
57the Zaurus syncs with the corresponding KDE-Pim/Pi 57the Zaurus syncs with the corresponding KDE-Pim/Pi
58program on the Linux Desktop which syncs automatically 58program on the Linux Desktop which syncs automatically
59with the KDE-desktop data. 59with the KDE-desktop data.
60 60
61If you want to use the KDE-desktop calendar/addressbook applications, 61If you want to use the KDE-desktop calendar/addressbook applications,
62just install these apps in this package and use them as a syncing tool for the 62just install these apps in this package and use them as a syncing tool for the
63Zaurus <-> KDE-desktop sync. 63Zaurus <-> KDE-desktop sync.
64The sync requires a network connection from your Zaurus to 64The sync requires a network connection from your Zaurus to
65the PC. A detailed Sync HowTo is available in the 65the PC. A detailed Sync HowTo is available in the
66Help menu of the applications. 66Help menu of the applications.
67 67
68These applications makes it also possible, that you can sync 68These applications makes it also possible, that you can sync
69(or just export the data to) your mobile phone with your 69(or just export the data to) your mobile phone with your
70data of the KDE-desktop calendar/addressbook applications. 70data of the KDE-desktop calendar/addressbook applications.
71This is tested and working for Nokia mobile phones, 71This is tested and working for Nokia mobile phones,
72it may work with others as well. 72it may work with others as well.
73(More info about that: -> Sync HowTo) 73(More info about that: -> Sync HowTo)
74 74
75NOTE: 75NOTE:
76When using SuSE 9.1 you have to update your KDE to 3.3.x 76When using SuSE 9.1 you have to update your KDE to 3.3.x
77and you have to make an online update in SuSE 9.1 to make it 77and you have to make an online update in SuSE 9.1 to make it
78possible to get the infrared connection working, such that 78possible to get the infrared connection working, such that
79you can sync your (Nokia) mobile phone via infrared. 79you can sync your (Nokia) mobile phone via infrared.
80 80
81%files 81%files
82/opt/kde3/share/applnk/PIM-pi/ 82/opt/kde3/share/applnk/PIM-pi/
83/opt/kdepimpi/ 83/opt/kdepimpi/
84/usr/lib/libmicro* 84/usr/lib/libmicro*
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 2742610..aa61fb8 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -1,727 +1,734 @@
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 70
71 mBeepPopUp = new QPopupMenu( this ); 71 mBeepPopUp = new QPopupMenu( this );
72 mSoundPopUp = new QPopupMenu( this ); 72 mSoundPopUp = new QPopupMenu( this );
73 mPausePopUp = new QPopupMenu( this ); 73 mPausePopUp = new QPopupMenu( this );
74 mFontsizePopup = new QPopupMenu( this ); 74 mFontsizePopup = new QPopupMenu( this );
75 mFontsizePopup->insertItem( "10", 10 ); 75 mFontsizePopup->insertItem( "10", 10 );
76 mFontsizePopup->insertItem( "12", 12 ); 76 mFontsizePopup->insertItem( "12", 12 );
77 mFontsizePopup->insertItem( "14", 14 ); 77 mFontsizePopup->insertItem( "14", 14 );
78 mFontsizePopup->insertItem( "16", 16 ); 78 mFontsizePopup->insertItem( "16", 16 );
79 mFontsizePopup->insertItem( "18", 18 ); 79 mFontsizePopup->insertItem( "18", 18 );
80 mFontsizePopup->insertItem( "20", 20 );
81 mFontsizePopup->insertItem( "22", 22 );
80 mFontsizePopup->insertItem( "24", 24 ); 82 mFontsizePopup->insertItem( "24", 24 );
83 mFontsizePopup->insertItem( "26", 26 );
84 mFontsizePopup->insertItem( "28", 28 );
85 mFontsizePopup->insertItem( "30", 30 );
86 mFontsizePopup->insertItem( "32", 32 );
87 mFontsizePopup->insertItem( "36", 36 );
81 QPopupMenu* savePopUp = new QPopupMenu( this ); 88 QPopupMenu* savePopUp = new QPopupMenu( this );
82 savePopUp->insertItem( "Save", 0 ); 89 savePopUp->insertItem( "Save", 0 );
83 savePopUp->insertItem( "Load", 1 ); 90 savePopUp->insertItem( "Load", 1 );
84 mSoundPopUp->insertItem( "Buzzer", 0 ); 91 mSoundPopUp->insertItem( "Buzzer", 0 );
85 mSoundPopUp->insertItem( "Wav file", 1 ); 92 mSoundPopUp->insertItem( "Wav file", 1 );
86 mPausePopUp->insertItem( " 1 sec", 1 ); 93 mPausePopUp->insertItem( " 1 sec", 1 );
87 mPausePopUp->insertItem( " 2 sec", 2 ); 94 mPausePopUp->insertItem( " 2 sec", 2 );
88 mPausePopUp->insertItem( " 3 sec", 3 ); 95 mPausePopUp->insertItem( " 3 sec", 3 );
89 mPausePopUp->insertItem( " 5 sec", 5 ); 96 mPausePopUp->insertItem( " 5 sec", 5 );
90 mPausePopUp->insertItem( "10 sec", 10 ); 97 mPausePopUp->insertItem( "10 sec", 10 );
91 mPausePopUp->insertItem( "30 sec", 30 ); 98 mPausePopUp->insertItem( "30 sec", 30 );
92 mPausePopUp->insertItem( " 1 min", 60 ); 99 mPausePopUp->insertItem( " 1 min", 60 );
93 mPausePopUp->insertItem( " 5 min", 300 ); 100 mPausePopUp->insertItem( " 5 min", 300 );
94 mPausePopUp->insertItem( "10 min", 600 ); 101 mPausePopUp->insertItem( "10 min", 600 );
95 mSuspendPopUp = new QPopupMenu( this ); 102 mSuspendPopUp = new QPopupMenu( this );
96 mSuspendPopUp->insertItem( "Off", 0 ); 103 mSuspendPopUp->insertItem( "Off", 0 );
97 mSuspendPopUp->insertItem( " 1x", 1 ); 104 mSuspendPopUp->insertItem( " 1x", 1 );
98 mSuspendPopUp->insertItem( " 2x", 2 ); 105 mSuspendPopUp->insertItem( " 2x", 2 );
99 mSuspendPopUp->insertItem( " 3x", 3 ); 106 mSuspendPopUp->insertItem( " 3x", 3 );
100 mSuspendPopUp->insertItem( " 5x", 5 ); 107 mSuspendPopUp->insertItem( " 5x", 5 );
101 mSuspendPopUp->insertItem( "10x", 10 ); 108 mSuspendPopUp->insertItem( "10x", 10 );
102 mSuspendPopUp->insertItem( "20x", 20 ); 109 mSuspendPopUp->insertItem( "20x", 20 );
103 mSuspendPopUp->insertItem( "30x", 30 ); 110 mSuspendPopUp->insertItem( "30x", 30 );
111 mBeepPopUp->insertItem( "Config",savePopUp );
112 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
113 mBeepPopUp->insertItem( "Font Size",mFontsizePopup );
104 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); 114 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp );
105 mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); 115 mBeepPopUp->insertItem( "Beep interval",mPausePopUp );
106 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
107 mBeepPopUp->insertItem( "Font Size",mFontsizePopup );
108 mBeepPopUp->insertItem( "Config",savePopUp );
109 mBeepPopUp->insertItem( "300", 300 );
110 mBeepPopUp->insertItem( "180", 180 ); 116 mBeepPopUp->insertItem( "180", 180 );
111 mBeepPopUp->insertItem( "60", 60 ); 117 mBeepPopUp->insertItem( "60", 60 );
112 mBeepPopUp->insertItem( "30", 30 ); 118 mBeepPopUp->insertItem( "30", 30 );
119 mBeepPopUp->insertItem( "18", 18 );
113 mBeepPopUp->insertItem( "10", 10 ); 120 mBeepPopUp->insertItem( "10", 10 );
114 mBeepPopUp->insertItem( "3", 3 ); 121 mBeepPopUp->insertItem( "3", 3 );
115 mBeepPopUp->insertItem( "1", 1 ); 122 mBeepPopUp->insertItem( "1", 1 );
116 mBeepPopUp->insertItem( "Off", 0 ); 123 mBeepPopUp->insertItem( "Off", 0 );
117 mBeepPopUp->insertSeparator(); 124 mBeepPopUp->insertSeparator();
118 mBeepPopUp->insertItem( "Simulate", 1000 ); 125 mBeepPopUp->insertItem( "Simulate", 1000 );
119 mBeepPopUp->setCheckable( true ); 126 mBeepPopUp->setCheckable( true );
120 mPopUp->insertSeparator(); 127 mPopUp->insertSeparator();
121 mPopUp->insertItem( "Play beeps", mBeepPopUp ); 128 mPopUp->insertItem( "Play beeps", mBeepPopUp );
122 mPopUp->insertSeparator(); 129 mPopUp->insertSeparator();
123 mPopUp->insertItem( "Timer", mTimerPopUp ); 130 mPopUp->insertItem( "Timer", mTimerPopUp );
124 //mPopUp->insertSeparator(); 131 //mPopUp->insertSeparator();
125 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); 132 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
126 133
127 mPopUp->resize( mPopUp->sizeHint() ); 134 mPopUp->resize( mPopUp->sizeHint() );
128 mPlayBeeps = 60; 135 mPlayBeeps = 60;
129 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 136 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
130 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); 137 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) );
131 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); 138 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) );
132 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); 139 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) );
133 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); 140 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) );
134 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); 141 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) );
135 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); 142 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) );
136 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); 143 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) );
137 connect ( mFontsizePopup, SIGNAL( activated ( int ) ), this, SLOT (confFontSize( int ) ) ); 144 connect ( mFontsizePopup, SIGNAL( activated ( int ) ), this, SLOT (confFontSize( int ) ) );
138 mTimerTime = 0; 145 mTimerTime = 0;
139 mCustomText = "Custom Text"; 146 mCustomText = "Custom Text";
140 mCustomMinutes = 7; 147 mCustomMinutes = 7;
141 mTimerPopupConf = 1; 148 mTimerPopupConf = 1;
142 fillTimerPopUp(); 149 fillTimerPopUp();
143 mPausePlay = 0; 150 mPausePlay = 0;
144 confPause( 1 ); 151 confPause( 1 );
145 mSuspend = 0; 152 mSuspend = 0;
146 confSuspend( 0 ); 153 confSuspend( 0 );
147 if ( QApplication::desktop()->width() < 480 ) { 154 if ( QApplication::desktop()->width() < 480 ) {
148 wavAlarm = false; 155 wavAlarm = false;
149 mSoundPopUp->setItemChecked ( 0, true ); 156 mSoundPopUp->setItemChecked ( 0, true );
150 } 157 }
151 else { 158 else {
152 wavAlarm = true; 159 wavAlarm = true;
153 mSoundPopUp->setItemChecked ( 1, true ); 160 mSoundPopUp->setItemChecked ( 1, true );
154 } 161 }
155 mTimerStartLabel = new QLabel( 0, 0, WType_Popup ); 162 mTimerStartLabel = new QLabel( 0, 0, WType_Popup );
156 //mTimerStartLabel->setCaption( "Timer started!"); 163 //mTimerStartLabel->setCaption( "Timer started!");
157 mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ; 164 mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ;
158 saveSlot( 1 ); 165 saveSlot( 1 );
159 166
160 167
161 168
162} 169}
163 170
164SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() 171SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl()
165{ 172{
166 //delete mPopUp; 173 //delete mPopUp;
167 delete mAlarmDialog; 174 delete mAlarmDialog;
168 delete mTimerStartLabel; 175 delete mTimerStartLabel;
169} 176}
170 177
171void SimpleAlarmDaemonImpl::saveSlot( int load ) 178void SimpleAlarmDaemonImpl::saveSlot( int load )
172{ 179{
173 QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; 180 QString fileName = QDir::homeDirPath() +"/.kopialarmrc";
174 //qDebug("save %d ", load ); 181 //qDebug("save %d ", load );
175 QFile file( fileName ); 182 QFile file( fileName );
176 if ( load ) { 183 if ( load ) {
177 mPopupFontSize = mTimerPopUp->font().pointSize(); 184 mPopupFontSize = mTimerPopUp->font().pointSize();
178 confFontSize( mPopupFontSize ); 185 confFontSize( mPopupFontSize );
179 if( !QFile::exists( fileName) ) 186 if( !QFile::exists( fileName) )
180 return; 187 return;
181 if (!file.open( IO_ReadOnly ) ) { 188 if (!file.open( IO_ReadOnly ) ) {
182 return ; 189 return ;
183 } 190 }
184 QString line; 191 QString line;
185 bool ok; 192 bool ok;
186 int val; 193 int val;
187 int len; 194 int len;
188 while ( file.readLine( line, 1024 ) > 0 ) { 195 while ( file.readLine( line, 1024 ) > 0 ) {
189 //qDebug("read %s ", line.latin1()); 196 //qDebug("read %s ", line.latin1());
190 len = line.length(); 197 len = line.length();
191 if ( line.left(4 ) == "PPAU" ) { 198 if ( line.left(4 ) == "PPAU" ) {
192 val = line.mid( 4,len-5).toInt( &ok ); 199 val = line.mid( 4,len-5).toInt( &ok );
193 if ( ok ) { 200 if ( ok ) {
194 confPause( val ); 201 confPause( val );
195 } 202 }
196 } 203 }
197 if ( line.left(4 ) == "POFO" ) { 204 if ( line.left(4 ) == "POFO" ) {
198 val = line.mid( 4,len-5).toInt( &ok ); 205 val = line.mid( 4,len-5).toInt( &ok );
199 if ( ok ) { 206 if ( ok ) {
200 confFontSize( val ); 207 confFontSize( val );
201 } 208 }
202 } 209 }
203 if ( line.left(4 ) == "SUCO" ) { 210 if ( line.left(4 ) == "SUCO" ) {
204 val = line.mid( 4,len-5).toInt( &ok ); 211 val = line.mid( 4,len-5).toInt( &ok );
205 if ( ok ) 212 if ( ok )
206 confSuspend ( val ); 213 confSuspend ( val );
207 } 214 }
208 if ( line.left(4 ) == "WAAL" ) { 215 if ( line.left(4 ) == "WAAL" ) {
209 val = line.mid( 4,len-5).toInt( &ok ); 216 val = line.mid( 4,len-5).toInt( &ok );
210 if ( ok ) 217 if ( ok )
211 confSound( val ); 218 confSound( val );
212 219
213 } 220 }
214 if ( line.left(4 ) == "PLBE" ) { 221 if ( line.left(4 ) == "PLBE" ) {
215 val = line.mid( 4,len-5).toInt( &ok ); 222 val = line.mid( 4,len-5).toInt( &ok );
216 if ( ok ) 223 if ( ok )
217 slotPlayBeep( val ); 224 slotPlayBeep( val );
218 225
219 } 226 }
220 if ( line.left(4 ) == "CUTE" ) { 227 if ( line.left(4 ) == "CUTE" ) {
221 mCustomText = line.mid( 5,len-6); 228 mCustomText = line.mid( 5,len-6);
222 // qDebug("text ***%s*** ",mCustomText.latin1() ); 229 // qDebug("text ***%s*** ",mCustomText.latin1() );
223 230
224 } 231 }
225 if ( line.left(4 ) == "CUMI" ) { 232 if ( line.left(4 ) == "CUMI" ) {
226 val = line.mid( 4,len-5).toInt( &ok ); 233 val = line.mid( 4,len-5).toInt( &ok );
227 if ( ok ) 234 if ( ok )
228 mCustomMinutes = val; 235 mCustomMinutes = val;
229 236
230 } 237 }
231 if ( line.left(4 ) == "SUTI" ) { 238 if ( line.left(4 ) == "SUTI" ) {
232 val = line.mid( 4,len-5).toInt( &ok ); 239 val = line.mid( 4,len-5).toInt( &ok );
233 if ( ok ) 240 if ( ok )
234 mAlarmDialog->setSuspendTime( val );; 241 mAlarmDialog->setSuspendTime( val );;
235 242
236 } 243 }
237 } 244 }
238 file.close(); 245 file.close();
239 } else { 246 } else {
240 if (!file.open( IO_WriteOnly ) ) { 247 if (!file.open( IO_WriteOnly ) ) {
241 return; 248 return;
242 } 249 }
243 QString configString ; 250 QString configString ;
244 configString += "PPAU " + QString::number( mPausePlay ) + "\n"; 251 configString += "PPAU " + QString::number( mPausePlay ) + "\n";
245 configString += "SUCO " + QString::number( mSuspend ) + "\n"; 252 configString += "SUCO " + QString::number( mSuspend ) + "\n";
246 configString += "POFO " + QString::number( mPopupFontSize ) + "\n"; 253 configString += "POFO " + QString::number( mPopupFontSize ) + "\n";
247 configString += "WAAL " + QString::number( wavAlarm ) + "\n"; 254 configString += "WAAL " + QString::number( wavAlarm ) + "\n";
248 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; 255 configString += "PLBE " + QString::number( mPlayBeeps ) + "\n";
249 configString += "CUTE " + mCustomText + "\n"; 256 configString += "CUTE " + mCustomText + "\n";
250 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; 257 configString += "CUMI " + QString::number( mCustomMinutes ) + "\n";
251 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n"; 258 configString += "SUTI " + QString::number( mAlarmDialog->getSuspendTime( )) + "\n";
252 QTextStream ts( &file ); 259 QTextStream ts( &file );
253 ts << configString ; 260 ts << configString ;
254 file.close(); 261 file.close();
255 } 262 }
256 263
257} 264}
258void SimpleAlarmDaemonImpl::confSuspend( int num ) 265void SimpleAlarmDaemonImpl::confSuspend( int num )
259{ 266{
260 mSuspendPopUp->setItemChecked ( mSuspend,false ); 267 mSuspendPopUp->setItemChecked ( mSuspend,false );
261 mSuspend = num; 268 mSuspend = num;
262 mSuspendPopUp->setItemChecked ( mSuspend,true ); 269 mSuspendPopUp->setItemChecked ( mSuspend,true );
263} 270}
264void SimpleAlarmDaemonImpl::confPause( int num ) 271void SimpleAlarmDaemonImpl::confPause( int num )
265{ 272{
266 mPausePopUp->setItemChecked ( mPausePlay,false ); 273 mPausePopUp->setItemChecked ( mPausePlay,false );
267 mPausePlay = num; 274 mPausePlay = num;
268 mPausePopUp->setItemChecked ( mPausePlay,true ); 275 mPausePopUp->setItemChecked ( mPausePlay,true );
269} 276}
270void SimpleAlarmDaemonImpl::confSound( int num ) 277void SimpleAlarmDaemonImpl::confSound( int num )
271{ 278{
272 if ( num == 0 ) { 279 if ( num == 0 ) {
273 wavAlarm = false; 280 wavAlarm = false;
274 mSoundPopUp->setItemChecked ( 0, true ); 281 mSoundPopUp->setItemChecked ( 0, true );
275 mSoundPopUp->setItemChecked ( 1, false ); 282 mSoundPopUp->setItemChecked ( 1, false );
276 } else { 283 } else {
277 wavAlarm = true; 284 wavAlarm = true;
278 mSoundPopUp->setItemChecked ( 0, false ); 285 mSoundPopUp->setItemChecked ( 0, false );
279 mSoundPopUp->setItemChecked ( 1, true ); 286 mSoundPopUp->setItemChecked ( 1, true );
280 } 287 }
281} 288}
282void SimpleAlarmDaemonImpl::slotPlayBeep( int num ) 289void SimpleAlarmDaemonImpl::slotPlayBeep( int num )
283{ 290{
284 if ( num == 1000 ) { 291 if ( num == 1000 ) {
285 simulate(); 292 simulate();
286 return; 293 return;
287 } 294 }
288 mBeepPopUp->setItemChecked ( mPlayBeeps,false ); 295 mBeepPopUp->setItemChecked ( mPlayBeeps,false );
289 mPlayBeeps = num; 296 mPlayBeeps = num;
290 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 297 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
291} 298}
292 299
293void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& ) 300void SimpleAlarmDaemonImpl::recieve( const QCString& msg, const QByteArray& )
294{ 301{
295 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data()); 302 //qDebug("SimpleAlarmDaemonImpl::ALARM RECEIVED! %s", msg.data());
296 QString mess = QString::fromUtf8(msg.data()); 303 QString mess = QString::fromUtf8(msg.data());
297 mAlarmMessage = mess.mid( 9 ); 304 mAlarmMessage = mess.mid( 9 );
298 QString filename = getenv("QPEDIR") ; 305 QString filename = getenv("QPEDIR") ;
299 filename += "/pics/kdepim/korganizer/koalarm.wav"; 306 filename += "/pics/kdepim/korganizer/koalarm.wav";
300 QString tempfilename; 307 QString tempfilename;
301 if ( mess.left( 13 ) == "suspend_alarm") { 308 if ( mess.left( 13 ) == "suspend_alarm") {
302 bool error = false; 309 bool error = false;
303 int len = mess.mid( 13 ).find("+++"); 310 int len = mess.mid( 13 ).find("+++");
304 if ( len < 2 ) 311 if ( len < 2 )
305 error = true; 312 error = true;
306 else { 313 else {
307 tempfilename = mess.mid( 13, len ); 314 tempfilename = mess.mid( 13, len );
308 if ( !QFile::exists( tempfilename ) ) 315 if ( !QFile::exists( tempfilename ) )
309 error = true; 316 error = true;
310 } 317 }
311 if ( ! error ) { 318 if ( ! error ) {
312 filename = tempfilename; 319 filename = tempfilename;
313 } 320 }
314 mAlarmMessage = mess.mid( 13+len+3 ); 321 mAlarmMessage = mess.mid( 13+len+3 );
315 //qDebug("suspend file %s ",tempfilename.latin1() ); 322 //qDebug("suspend file %s ",tempfilename.latin1() );
316 startAlarm( mAlarmMessage, filename); 323 startAlarm( mAlarmMessage, filename);
317 return; 324 return;
318 } 325 }
319 if ( mess.left( 11 ) == "timer_alarm") { 326 if ( mess.left( 11 ) == "timer_alarm") {
320 mTimerTime = 0; 327 mTimerTime = 0;
321 startAlarm( mess.mid( 11 ), filename ); 328 startAlarm( mess.mid( 11 ), filename );
322 return; 329 return;
323 } 330 }
324 if ( mess.left( 10 ) == "proc_alarm") { 331 if ( mess.left( 10 ) == "proc_alarm") {
325 bool error = false; 332 bool error = false;
326 int len = mess.mid( 10 ).find("+++"); 333 int len = mess.mid( 10 ).find("+++");
327 if ( len < 2 ) 334 if ( len < 2 )
328 error = true; 335 error = true;
329 else { 336 else {
330 tempfilename = mess.mid( 10, len ); 337 tempfilename = mess.mid( 10, len );
331 if ( !QFile::exists( tempfilename ) ) 338 if ( !QFile::exists( tempfilename ) )
332 error = true; 339 error = true;
333 } 340 }
334 if ( error ) { 341 if ( error ) {
335 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 342 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
336 mAlarmMessage += mess.mid( 10+len+3+9 ); 343 mAlarmMessage += mess.mid( 10+len+3+9 );
337 } else { 344 } else {
338 //qDebug("-----system command %s ",tempfilename.latin1() ); 345 //qDebug("-----system command %s ",tempfilename.latin1() );
339 if ( vfork () == 0 ) { 346 if ( vfork () == 0 ) {
340 execl ( tempfilename.latin1(), 0 ); 347 execl ( tempfilename.latin1(), 0 );
341 return; 348 return;
342 } 349 }
343 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) ); 350 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) );
344 return; 351 return;
345 } 352 }
346 353
347 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 354 //qDebug("+++++++system command %s ",tempfilename.latin1() );
348 } 355 }
349 if ( mess.left( 11 ) == "audio_alarm") { 356 if ( mess.left( 11 ) == "audio_alarm") {
350 bool error = false; 357 bool error = false;
351 int len = mess.mid( 11 ).find("+++"); 358 int len = mess.mid( 11 ).find("+++");
352 if ( len < 2 ) 359 if ( len < 2 )
353 error = true; 360 error = true;
354 else { 361 else {
355 tempfilename = mess.mid( 11, len ); 362 tempfilename = mess.mid( 11, len );
356 if ( !QFile::exists( tempfilename ) ) 363 if ( !QFile::exists( tempfilename ) )
357 error = true; 364 error = true;
358 } 365 }
359 if ( ! error ) { 366 if ( ! error ) {
360 filename = tempfilename; 367 filename = tempfilename;
361 } 368 }
362 mAlarmMessage = mess.mid( 11+len+3+9 ); 369 mAlarmMessage = mess.mid( 11+len+3+9 );
363 //qDebug("audio file command %s ",tempfilename.latin1() ); 370 //qDebug("audio file command %s ",tempfilename.latin1() );
364 } 371 }
365 if ( mess.left( 9 ) == "cal_alarm") { 372 if ( mess.left( 9 ) == "cal_alarm") {
366 mAlarmMessage = mess.mid( 9 ) ; 373 mAlarmMessage = mess.mid( 9 ) ;
367 } 374 }
368 375
369 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) ); 376 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) );
370 startAlarm( mAlarmMessage, filename ); 377 startAlarm( mAlarmMessage, filename );
371 378
372} 379}
373 380
374int SimpleAlarmDaemonImpl::getFileNameLen( QString mess ) 381int SimpleAlarmDaemonImpl::getFileNameLen( QString mess )
375{ 382{
376 return 0; 383 return 0;
377} 384}
378void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename ) 385void SimpleAlarmDaemonImpl::startAlarm( QString mess, QString filename )
379{ 386{
380 //mAlarmDialog->show(); 387 //mAlarmDialog->show();
381 //mAlarmDialog->raise(); 388 //mAlarmDialog->raise();
382 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend ); 389 mAlarmDialog->eventNotification( mess, mPlayBeeps, filename, wavAlarm,mPausePlay ,mSuspend );
383} 390}
384 391
385 392
386void SimpleAlarmDaemonImpl::fillTimerPopUp() 393void SimpleAlarmDaemonImpl::fillTimerPopUp()
387{ 394{
388 395
389 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime ); 396 // qDebug(" timer %d %d ",mTimerPopupConf, mTimerTime );
390 if ( mTimerPopupConf == mTimerTime ) { 397 if ( mTimerPopupConf == mTimerTime ) {
391 if ( mTimerTime ) { 398 if ( mTimerTime ) {
392 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 399 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
393 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 400 QTime t ( secs/3600, (secs/60)%60, secs%60 );
394 mTimerPopUp->changeItem ( 1 , t.toString() + " (countdown)"); 401 mTimerPopUp->changeItem ( 1 , t.toString() + " (countdown)");
395 } 402 }
396 else { 403 else {
397 QString text = mCustomText.stripWhiteSpace (); 404 QString text = mCustomText.stripWhiteSpace ();
398 int in = text.find( " " ); 405 int in = text.find( " " );
399 text = text.left ( in ); 406 text = text.left ( in );
400 mTimerPopUp->changeItem ( 3, text ); 407 mTimerPopUp->changeItem ( 3, text );
401 } 408 }
402 return; 409 return;
403 } 410 }
404 mTimerPopupConf = mTimerTime; 411 mTimerPopupConf = mTimerTime;
405 mTimerPopUp->clear(); 412 mTimerPopUp->clear();
406 if ( mTimerTime ) { 413 if ( mTimerTime ) {
407 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer ); 414 int secs = QDateTime::currentDateTime().secsTo ( mRunningTimer );
408 QTime t ( secs/3600, (secs/60)%60, secs%60 ); 415 QTime t ( secs/3600, (secs/60)%60, secs%60 );
409 416
410 417
411 mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 ); 418 mTimerPopUp->insertItem( "Stop timer "+ mRunningTimerText , 0 );
412 mTimerPopUp->insertItem( t.toString() + " (countdown)",1); 419 mTimerPopUp->insertItem( t.toString() + " (countdown)",1);
413 mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm)",2); 420 mTimerPopUp->insertItem( mRunningTimer.time().toString() + " (alarm)",2);
414 } else { 421 } else {
415 422
416 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc"; 423 QString fileName = QDir::homeDirPath() +"/.kopialarmtimerrc";
417 QFile file( fileName ); 424 QFile file( fileName );
418 if( !QFile::exists( fileName) ) { 425 if( !QFile::exists( fileName) ) {
419 // write defaults 426 // write defaults
420 if (!file.open( IO_WriteOnly ) ) { 427 if (!file.open( IO_WriteOnly ) ) {
421 return; 428 return;
422 } 429 }
423 QString configString ; 430 QString configString ;
424 configString += "#config file for kopi alarm timer\n"; 431 configString += "#config file for kopi alarm timer\n";
425 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n"; 432 configString += "#format: <Text for popup menu>;<timer countdown in minutes>\n";
426 configString += "24 hours; 1440\n"; 433 configString += "24 hours; 1440\n";
427 configString += "9 hours; 540\n"; 434 configString += "9 hours; 540\n";
428 configString += "8 hours; 480\n"; 435 configString += "8 hours; 480\n";
429 configString += "1 hour; 60\n"; 436 configString += "1 hour; 60\n";
430 configString += "30 min; 30\n"; 437 configString += "30 min; 30\n";
431 configString += "15 min; 15\n"; 438 configString += "15 min; 15\n";
432 configString += "SEPARATOR\n"; 439 configString += "SEPARATOR\n";
433 configString += "Pizza; 22\n"; 440 configString += "Pizza; 22\n";
434 configString += "Nap; 45\n"; 441 configString += "Nap; 45\n";
435 configString += "Tea; 5\n"; 442 configString += "Tea; 5\n";
436 QTextStream ts( &file ); 443 QTextStream ts( &file );
437 ts << configString ; 444 ts << configString ;
438 file.close(); 445 file.close();
439 } 446 }
440 447
441 if (!file.open( IO_ReadOnly ) ) { 448 if (!file.open( IO_ReadOnly ) ) {
442 return ; 449 return ;
443 } 450 }
444 QString line; 451 QString line;
445 bool ok; 452 bool ok;
446 while ( file.readLine( line, 1024 ) > 0 ) { 453 while ( file.readLine( line, 1024 ) > 0 ) {
447 //qDebug("read %s ", line.latin1()); 454 //qDebug("read %s ", line.latin1());
448 if ( line.left(1 ) != "#" ) { 455 if ( line.left(1 ) != "#" ) {
449 // no comment 456 // no comment
450 if ( line.left(9 ) == "SEPARATOR" ) { 457 if ( line.left(9 ) == "SEPARATOR" ) {
451 mTimerPopUp->insertSeparator(); 458 mTimerPopUp->insertSeparator();
452 } else { 459 } else {
453 QStringList li = QStringList::split(";",line); 460 QStringList li = QStringList::split(";",line);
454 ok = false; 461 ok = false;
455 if ( li.count() == 2 ) { 462 if ( li.count() == 2 ) {
456 int val = li[1].toInt( &ok ); 463 int val = li[1].toInt( &ok );
457 if ( ok && val > 0 ) { 464 if ( ok && val > 0 ) {
458 mTimerPopUp->insertItem( li[0], val+10); 465 mTimerPopUp->insertItem( li[0], val+10);
459 } 466 }
460 } 467 }
461 } 468 }
462 } 469 }
463 } 470 }
464 file.close(); 471 file.close();
465#if 0 472#if 0
466 mTimerPopUp->insertItem( "24 hours", 1440 ); 473 mTimerPopUp->insertItem( "24 hours", 1440 );
467 // mTimerPopUp->insertItem( i18n("12 h"), 720 ); 474 // mTimerPopUp->insertItem( i18n("12 h"), 720 );
468 mTimerPopUp->insertItem( " 8 hours", 480 ); 475 mTimerPopUp->insertItem( " 8 hours", 480 );
469 mTimerPopUp->insertItem( " 5 hours", 300 ); 476 mTimerPopUp->insertItem( " 5 hours", 300 );
470 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 ); 477 // mTimerPopUp->insertItem( i18n(" 2 h"), 120 );
471 mTimerPopUp->insertItem( " 1 hour", 60 ); 478 mTimerPopUp->insertItem( " 1 hour", 60 );
472 mTimerPopUp->insertItem( "30 min", 30 ); 479 mTimerPopUp->insertItem( "30 min", 30 );
473 mTimerPopUp->insertItem( "15 min", 15 ); 480 mTimerPopUp->insertItem( "15 min", 15 );
474 mTimerPopUp->insertItem( "10 min", 10 ); 481 mTimerPopUp->insertItem( "10 min", 10 );
475 //mTimerPopUp->insertItem( " 5 min", 5 ); 482 //mTimerPopUp->insertItem( " 5 min", 5 );
476 mTimerPopUp->insertSeparator(); 483 mTimerPopUp->insertSeparator();
477 mTimerPopUp->insertItem( "Pizza", 22 ); 484 mTimerPopUp->insertItem( "Pizza", 22 );
478 mTimerPopUp->insertItem( "Nap", 45 ); 485 mTimerPopUp->insertItem( "Nap", 45 );
479 mTimerPopUp->insertItem( "Tea", 5 ); 486 mTimerPopUp->insertItem( "Tea", 5 );
480#endif 487#endif
481 QString text = mCustomText.stripWhiteSpace (); 488 QString text = mCustomText.stripWhiteSpace ();
482 int in = text.find( " " ); 489 int in = text.find( " " );
483 text = text.left ( in ); 490 text = text.left ( in );
484 mTimerPopUp->insertItem( text, 3 ); 491 mTimerPopUp->insertItem( text, 3 );
485 mTimerPopUp->insertSeparator(); 492 mTimerPopUp->insertSeparator();
486 mTimerPopUp->insertItem( "Customize", 2 ); 493 mTimerPopUp->insertItem( "Customize", 2 );
487 } 494 }
488 495
489} 496}
490 497
491void SimpleAlarmDaemonImpl::showTimer() 498void SimpleAlarmDaemonImpl::showTimer()
492{ 499{
493 fillTimerPopUp(); 500 fillTimerPopUp();
494} 501}
495 502
496void SimpleAlarmDaemonImpl::confTimer( int time ) 503void SimpleAlarmDaemonImpl::confTimer( int time )
497{ 504{
498 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time ); 505 //qDebug("impleAlarmDaemonImpl::confTimer() %d ", time );
499 int minutes = time; 506 int minutes = time;
500 if ( minutes == 0 ) { 507 if ( minutes == 0 ) {
501 if ( ! mTimerTime ) 508 if ( ! mTimerTime )
502 return; 509 return;
503 510
504 QDialog dia ( 0, ("Stop Timer" ), true ); 511 QDialog dia ( 0, ("Stop Timer" ), true );
505 QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia ); 512 QLabel lab (("Really stop the timer?\n\n"+ mRunningTimerText+"\n"), &dia );
506 lab.setAlignment( AlignCenter ); 513 lab.setAlignment( AlignCenter );
507 dia.setCaption(("KO/Pi Timer Stop" )); 514 dia.setCaption(("KO/Pi Timer Stop" ));
508 QVBoxLayout lay( &dia ); 515 QVBoxLayout lay( &dia );
509 lay.addWidget( &lab); 516 lay.addWidget( &lab);
510 QPushButton ok ( "Stop timer!", &dia); 517 QPushButton ok ( "Stop timer!", &dia);
511 QFont fo = dia.font(); 518 QFont fo = dia.font();
512 fo.setPointSize( 36 ); 519 fo.setPointSize( 36 );
513 ok.setFont( fo ); 520 ok.setFont( fo );
514 lay.addWidget( &ok); 521 lay.addWidget( &ok);
515 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); 522 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
516 QPushButton con ( "Continue timer!", &dia); 523 QPushButton con ( "Continue timer!", &dia);
517 fo.setPointSize( 36 ); 524 fo.setPointSize( 36 );
518 con.setFont( fo ); 525 con.setFont( fo );
519 lay.addWidget( &con); 526 lay.addWidget( &con);
520 connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) ); 527 connect ( &con, SIGNAL (clicked()), &dia, SLOT ( reject() ) );
521 lay.setMargin(5); 528 lay.setMargin(5);
522 lay.setSpacing(5); 529 lay.setSpacing(5);
523 dia.resize(dia.sizeHint() ); 530 dia.resize(dia.sizeHint() );
524 531
525 if ( !dia.exec() ) 532 if ( !dia.exec() )
526 return; 533 return;
527 534
528 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.utf8() ); 535 AlarmServer::deleteAlarm ( mRunningTimer,"koalarm" , timerMesssage.utf8() );
529 mTimerTime = 0; 536 mTimerTime = 0;
530 return; 537 return;
531 } 538 }
532 if ( mTimerTime ) 539 if ( mTimerTime )
533 return; 540 return;
534 if ( minutes == 1 ) { 541 if ( minutes == 1 ) {
535 return; 542 return;
536 } 543 }
537 QString mess = "timer_alarm"; 544 QString mess = "timer_alarm";
538 QString disp; 545 QString disp;
539 mess += ("Timer Alarm!\n"); 546 mess += ("Timer Alarm!\n");
540 if ( minutes == 3 ) { 547 if ( minutes == 3 ) {
541 mess += mCustomText; 548 mess += mCustomText;
542 minutes = mCustomMinutes ; 549 minutes = mCustomMinutes ;
543 mRunningTimerText = mCustomText.stripWhiteSpace (); 550 mRunningTimerText = mCustomText.stripWhiteSpace ();
544 int in = mRunningTimerText.find( " " ); 551 int in = mRunningTimerText.find( " " );
545 mRunningTimerText = mRunningTimerText.left ( in ); 552 mRunningTimerText = mRunningTimerText.left ( in );
546 disp = mCustomText; 553 disp = mCustomText;
547 } 554 }
548 else { 555 else {
549 if ( minutes == 2 ) { 556 if ( minutes == 2 ) {
550 // ask time 557 // ask time
551 QDialog dia ( 0, ("Customize Timer" ), true ); 558 QDialog dia ( 0, ("Customize Timer" ), true );
552 QLabel lab (("Message Text:"), &dia ); 559 QLabel lab (("Message Text:"), &dia );
553 dia.setCaption(("KO/Pi Timer" )); 560 dia.setCaption(("KO/Pi Timer" ));
554 QVBoxLayout lay( &dia ); 561 QVBoxLayout lay( &dia );
555 lay.setMargin(5); 562 lay.setMargin(5);
556 lay.setSpacing(5); 563 lay.setSpacing(5);
557 lay.addWidget( &lab); 564 lay.addWidget( &lab);
558 QLineEdit lEdit( mCustomText, &dia ); 565 QLineEdit lEdit( mCustomText, &dia );
559 lay.addWidget( &lEdit); 566 lay.addWidget( &lEdit);
560 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia ); 567 QLabel lab2 (("Countdown time (1 min - 24 h):"), &dia );
561 lay.addWidget( &lab2); 568 lay.addWidget( &lab2);
562 QHBox hbox1 ( &dia ); 569 QHBox hbox1 ( &dia );
563 lay.addWidget( &hbox1); 570 lay.addWidget( &hbox1);
564 QLabel lab3 (("Hours"), &hbox1 ); 571 QLabel lab3 (("Hours"), &hbox1 );
565 QLabel lab4 (("Minutes"), &hbox1 ); 572 QLabel lab4 (("Minutes"), &hbox1 );
566 QHBox hbox ( &dia ); 573 QHBox hbox ( &dia );
567 QSpinBox spinh( 0, 24, 1,& hbox ); 574 QSpinBox spinh( 0, 24, 1,& hbox );
568 QFont fo = dia.font(); 575 QFont fo = dia.font();
569 fo.setPointSize( 36 ); 576 fo.setPointSize( 36 );
570 QSpinBox spinm( 0, 59, 1,&hbox ); 577 QSpinBox spinm( 0, 59, 1,&hbox );
571 spinm.setFont( fo ); 578 spinm.setFont( fo );
572 spinh.setFont( fo ); 579 spinh.setFont( fo );
573 spinh.setButtonSymbols( QSpinBox::PlusMinus ); 580 spinh.setButtonSymbols( QSpinBox::PlusMinus );
574 spinm.setButtonSymbols( QSpinBox::PlusMinus ); 581 spinm.setButtonSymbols( QSpinBox::PlusMinus );
575 spinh.upButton ()->setFixedSize( QSize( 48, 30 )); 582 spinh.upButton ()->setFixedSize( QSize( 48, 30 ));
576 spinh.downButton ()->setFixedSize( QSize( 48, 30 )); 583 spinh.downButton ()->setFixedSize( QSize( 48, 30 ));
577 //spinh.editor ()->setFixedSize( QSize( 50, 100 )); 584 //spinh.editor ()->setFixedSize( QSize( 50, 100 ));
578 spinh.setFixedSize( 100,62 ); 585 spinh.setFixedSize( 100,62 );
579 spinm.upButton ()->setFixedSize( QSize( 48, 30 )); 586 spinm.upButton ()->setFixedSize( QSize( 48, 30 ));
580 spinm.downButton ()->setFixedSize( QSize( 48, 30 )); 587 spinm.downButton ()->setFixedSize( QSize( 48, 30 ));
581 spinm.downButton ()->setGeometry( 50,50,50,50); 588 spinm.downButton ()->setGeometry( 50,50,50,50);
582 // spinm.setSuffix( " m" ); 589 // spinm.setSuffix( " m" );
583 //spinh.setSuffix( " h" ); 590 //spinh.setSuffix( " h" );
584 spinm.setWrapping ( true ); 591 spinm.setWrapping ( true );
585 //spinm.editor ()->setFixedSize( QSize( 50, 100 )); 592 //spinm.editor ()->setFixedSize( QSize( 50, 100 ));
586 spinm.setLineStep( 1 ); 593 spinm.setLineStep( 1 );
587 spinm.setFixedSize( 110,62 ); 594 spinm.setFixedSize( 110,62 );
588 lay.addWidget( &hbox); 595 lay.addWidget( &hbox);
589 QLabel lab5 ("Timer fires at:", &dia ); 596 QLabel lab5 ("Timer fires at:", &dia );
590 lab5.setAlignment( AlignCenter ); 597 lab5.setAlignment( AlignCenter );
591 lay.addWidget( &lab5); 598 lay.addWidget( &lab5);
592 KODateLabel dl ( &dia ); 599 KODateLabel dl ( &dia );
593 dl.setAlignment( AlignCenter ); 600 dl.setAlignment( AlignCenter );
594 dl.setFont( fo ); 601 dl.setFont( fo );
595 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) ); 602 connect ( &spinh, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_hours( int ) ) );
596 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) ); 603 connect ( &spinm, SIGNAL ( valueChanged (int)), &dl, SLOT ( slot_minutes( int ) ) );
597 lay.addWidget( &dl); 604 lay.addWidget( &dl);
598 spinh.setValue( mCustomMinutes/60 ); 605 spinh.setValue( mCustomMinutes/60 );
599 spinm.setValue( mCustomMinutes%60 ); 606 spinm.setValue( mCustomMinutes%60 );
600 QPushButton ok ( "Start timer", &dia); 607 QPushButton ok ( "Start timer", &dia);
601 ok.setDefault( true ); 608 ok.setDefault( true );
602 ok.setFont( fo ); 609 ok.setFont( fo );
603 spinh.setFocus(); 610 spinh.setFocus();
604 lay.addWidget( &ok); 611 lay.addWidget( &ok);
605 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) ); 612 connect ( &ok, SIGNAL (clicked()), &dia, SLOT ( accept() ) );
606 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() ); 613 dia.resize( dia.sizeHint().width(), dia.sizeHint().height() );
607 614
608 if ( !dia.exec() ) 615 if ( !dia.exec() )
609 return; 616 return;
610 mCustomText = lEdit.text(); 617 mCustomText = lEdit.text();
611 mCustomMinutes = spinh.value()*60+spinm.value(); 618 mCustomMinutes = spinh.value()*60+spinm.value();
612 if ( mCustomMinutes == 0 ) 619 if ( mCustomMinutes == 0 )
613 mCustomMinutes = 1; 620 mCustomMinutes = 1;
614 if ( mCustomMinutes > 1440 ) 621 if ( mCustomMinutes > 1440 )
615 mCustomMinutes = 1440; 622 mCustomMinutes = 1440;
616 mess += mCustomText; 623 mess += mCustomText;
617 disp = mCustomText; 624 disp = mCustomText;
618 minutes = mCustomMinutes; 625 minutes = mCustomMinutes;
619 mRunningTimerText = mCustomText.stripWhiteSpace (); 626 mRunningTimerText = mCustomText.stripWhiteSpace ();
620 int in = mRunningTimerText.find( " " ); 627 int in = mRunningTimerText.find( " " );
621 mRunningTimerText = mRunningTimerText.left ( in ); 628 mRunningTimerText = mRunningTimerText.left ( in );
622 } 629 }
623 else { 630 else {
624 mess += mTimerPopUp->text( minutes ); 631 mess += mTimerPopUp->text( minutes );
625 disp = mTimerPopUp->text( minutes ); 632 disp = mTimerPopUp->text( minutes );
626 mRunningTimerText = mTimerPopUp->text( minutes ); 633 mRunningTimerText = mTimerPopUp->text( minutes );
627 minutes -= 10; 634 minutes -= 10;
628 } 635 }
629 } 636 }
630 //minutes = 1; 637 //minutes = 1;
631 638
632 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 ); 639 mRunningTimer = QDateTime::currentDateTime().addSecs( minutes * 60 );
633 timerMesssage = mess; 640 timerMesssage = mess;
634 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8()); 641 AlarmServer::addAlarm ( mRunningTimer,"koalarm",timerMesssage.utf8());
635 mTimerStartLabel->setText( disp + "\n\nTimer started!" ); 642 mTimerStartLabel->setText( disp + "\n\nTimer started!" );
636 int w = mTimerStartLabel->sizeHint().width()+20; 643 int w = mTimerStartLabel->sizeHint().width()+20;
637 int h = mTimerStartLabel->sizeHint().height()+40 ; 644 int h = mTimerStartLabel->sizeHint().height()+40 ;
638 int dw = QApplication::desktop()->width(); 645 int dw = QApplication::desktop()->width();
639 int dh = QApplication::desktop()->height(); 646 int dh = QApplication::desktop()->height();
640 mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 647 mTimerStartLabel->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
641 mTimerStartLabel->show(); 648 mTimerStartLabel->show();
642 QTimer::singleShot( 5000, mTimerStartLabel, SLOT ( hide() ) ); 649 QTimer::singleShot( 5000, mTimerStartLabel, SLOT ( hide() ) );
643 mTimerTime = 1; 650 mTimerTime = 1;
644} 651}
645 652
646void SimpleAlarmDaemonImpl::confFontSize( int size ) 653void SimpleAlarmDaemonImpl::confFontSize( int size )
647{ 654{
648 655
649 mFontsizePopup->setItemChecked( mPopupFontSize, false ); 656 mFontsizePopup->setItemChecked( mPopupFontSize, false );
650 mPopupFontSize = size; 657 mPopupFontSize = size;
651 mFontsizePopup->setItemChecked( mPopupFontSize, true ); 658 mFontsizePopup->setItemChecked( mPopupFontSize, true );
652 QFont fon = mTimerPopUp->font(); 659 QFont fon = mTimerPopUp->font();
653 fon.setPointSize( mPopupFontSize ); 660 fon.setPointSize( mPopupFontSize );
654 mTimerPopUp->setFont( fon ); 661 mTimerPopUp->setFont( fon );
655 mPopUp->setFont( fon ); 662 mPopUp->setFont( fon );
656 fon.setBold( true ); 663 fon.setBold( true );
657 fon.setPointSize( mPopupFontSize * 2 ); 664 fon.setPointSize( mPopupFontSize * 2 );
658 mTimerStartLabel->setFont( fon ); 665 mTimerStartLabel->setFont( fon );
659} 666}
660void SimpleAlarmDaemonImpl::writeFile() 667void SimpleAlarmDaemonImpl::writeFile()
661{ 668{
662 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 669 QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
663 //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); 670 //QCopEnvelope e("QPE/Application/kopi", "-writeFile");
664} 671}
665void SimpleAlarmDaemonImpl::showWN() 672void SimpleAlarmDaemonImpl::showWN()
666{ 673{
667 QCopEnvelope e("QPE/Application/kopi", "-showWN"); 674 QCopEnvelope e("QPE/Application/kopi", "-showWN");
668} 675}
669void SimpleAlarmDaemonImpl::newTodo() 676void SimpleAlarmDaemonImpl::newTodo()
670{ 677{
671 QCopEnvelope e("QPE/Application/kopi", "-newTodo"); 678 QCopEnvelope e("QPE/Application/kopi", "-newTodo");
672} 679}
673 680
674void SimpleAlarmDaemonImpl::newEvent() 681void SimpleAlarmDaemonImpl::newEvent()
675{ 682{
676 QCopEnvelope e("QPE/Application/kopi", "-newEvent"); 683 QCopEnvelope e("QPE/Application/kopi", "-newEvent");
677 684
678} 685}
679void SimpleAlarmDaemonImpl::newMail() 686void SimpleAlarmDaemonImpl::newMail()
680{ 687{
681 QCopEnvelope e("QPE/Application/ompi", "newMail()"); 688 QCopEnvelope e("QPE/Application/ompi", "newMail()");
682} 689}
683void SimpleAlarmDaemonImpl::showAdd() 690void SimpleAlarmDaemonImpl::showAdd()
684{ 691{
685 QCopEnvelope e("QPE/Application/kapi", "raise()"); 692 QCopEnvelope e("QPE/Application/kapi", "raise()");
686} 693}
687void SimpleAlarmDaemonImpl::ringSync() 694void SimpleAlarmDaemonImpl::ringSync()
688{ 695{
689 QCopEnvelope e("QPE/Application/kopi", "-ringSync"); 696 QCopEnvelope e("QPE/Application/kopi", "-ringSync");
690 697
691} 698}
692void SimpleAlarmDaemonImpl::newCountdown() 699void SimpleAlarmDaemonImpl::newCountdown()
693{ 700{
694 //recieve("cal_alarm", 10 ); 701 //recieve("cal_alarm", 10 );
695} 702}
696void SimpleAlarmDaemonImpl::simulate() 703void SimpleAlarmDaemonImpl::simulate()
697{ 704{
698 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) ); 705 QTimer::singleShot( 2000, this, SLOT ( writeFile() ) );
699 QString filename = getenv("QPEDIR") ; 706 QString filename = getenv("QPEDIR") ;
700 filename += "/pics/kdepim/korganizer/koalarm.wav"; 707 filename += "/pics/kdepim/korganizer/koalarm.wav";
701 startAlarm("Alarm simulation", filename ); 708 startAlarm("Alarm simulation", filename );
702} 709}
703void SimpleAlarmDaemonImpl::showKO() 710void SimpleAlarmDaemonImpl::showKO()
704{ 711{
705 QCopEnvelope e("QPE/Application/kopi", "-showKO"); 712 QCopEnvelope e("QPE/Application/kopi", "-showKO");
706 // testing only 713 // testing only
707 //QCopEnvelope e("QPE/Application/kopi", "nextView()"); 714 //QCopEnvelope e("QPE/Application/kopi", "nextView()");
708 715
709} 716}
710void SimpleAlarmDaemonImpl::showTodo() 717void SimpleAlarmDaemonImpl::showTodo()
711{ 718{
712 QCopEnvelope e("QPE/Application/kopi", "-showTodo"); 719 QCopEnvelope e("QPE/Application/kopi", "-showTodo");
713 720
714} 721}
715void SimpleAlarmDaemonImpl::writeJournal() 722void SimpleAlarmDaemonImpl::writeJournal()
716{ 723{
717 QCopEnvelope e("QPE/Application/kopi", "-showJournal"); 724 QCopEnvelope e("QPE/Application/kopi", "-showJournal");
718 725
719} 726}
720 727
721void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * ) 728void SimpleAlarmDaemonImpl::mousePressEvent( QMouseEvent * )
722{ 729{
723 730
724 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() ))); 731 mPopUp->popup(mapToGlobal(QPoint (0, -mPopUp->height() )));
725 732
726} 733}
727 734
diff --git a/version b/version
index 4f24d24..fda8303 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "2.2.6"; version = "2.2.7";