summaryrefslogtreecommitdiffabout
path: root/kalarmd
authorzautrix <zautrix>2005-09-18 13:50:46 (UTC)
committer zautrix <zautrix>2005-09-18 13:50:46 (UTC)
commitc6e493d4e5b9eafcc3402c39e30c4283ce8cc8e5 (patch) (unidiff)
tree94e7bdc361b68a3a569eebe14f66458b3795dd6a /kalarmd
parente7cd095ea9e80e26c90cbc2d3bf36921b7541c19 (diff)
downloadkdepimpi-c6e493d4e5b9eafcc3402c39e30c4283ce8cc8e5.zip
kdepimpi-c6e493d4e5b9eafcc3402c39e30c4283ce8cc8e5.tar.gz
kdepimpi-c6e493d4e5b9eafcc3402c39e30c4283ce8cc8e5.tar.bz2
delay
Diffstat (limited to 'kalarmd') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp8
1 files changed, 0 insertions, 8 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 2acfacf..a0ac232 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -1,173 +1,165 @@
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();
71 int points = 16;
72 if ( QApplication::desktop()->width() < 480 )
73 points = 12;
74 fon.setPointSize( points );
75 //qDebug("point s %d ", fon.pointSize());
76 mTimerPopUp->setFont( fon );
77 mPopUp->setFont( fon );
78 mBeepPopUp = new QPopupMenu( this ); 70 mBeepPopUp = new QPopupMenu( this );
79 mSoundPopUp = new QPopupMenu( this ); 71 mSoundPopUp = new QPopupMenu( this );
80 mPausePopUp = new QPopupMenu( this ); 72 mPausePopUp = new QPopupMenu( this );
81 QPopupMenu* savePopUp = new QPopupMenu( this ); 73 QPopupMenu* savePopUp = new QPopupMenu( this );
82 savePopUp->insertItem( "Save", 0 ); 74 savePopUp->insertItem( "Save", 0 );
83 savePopUp->insertItem( "Load", 1 ); 75 savePopUp->insertItem( "Load", 1 );
84 mSoundPopUp->insertItem( "Buzzer", 0 ); 76 mSoundPopUp->insertItem( "Buzzer", 0 );
85 mSoundPopUp->insertItem( "Wav file", 1 ); 77 mSoundPopUp->insertItem( "Wav file", 1 );
86 mPausePopUp->insertItem( " 1 sec", 1 ); 78 mPausePopUp->insertItem( " 1 sec", 1 );
87 mPausePopUp->insertItem( " 2 sec", 2 ); 79 mPausePopUp->insertItem( " 2 sec", 2 );
88 mPausePopUp->insertItem( " 3 sec", 3 ); 80 mPausePopUp->insertItem( " 3 sec", 3 );
89 mPausePopUp->insertItem( " 5 sec", 5 ); 81 mPausePopUp->insertItem( " 5 sec", 5 );
90 mPausePopUp->insertItem( "10 sec", 10 ); 82 mPausePopUp->insertItem( "10 sec", 10 );
91 mPausePopUp->insertItem( "30 sec", 30 ); 83 mPausePopUp->insertItem( "30 sec", 30 );
92 mPausePopUp->insertItem( " 1 min", 60 ); 84 mPausePopUp->insertItem( " 1 min", 60 );
93 mPausePopUp->insertItem( " 5 min", 300 ); 85 mPausePopUp->insertItem( " 5 min", 300 );
94 mPausePopUp->insertItem( "10 min", 600 ); 86 mPausePopUp->insertItem( "10 min", 600 );
95 mSuspendPopUp = new QPopupMenu( this ); 87 mSuspendPopUp = new QPopupMenu( this );
96 mSuspendPopUp->insertItem( "Off", 0 ); 88 mSuspendPopUp->insertItem( "Off", 0 );
97 mSuspendPopUp->insertItem( " 1x", 1 ); 89 mSuspendPopUp->insertItem( " 1x", 1 );
98 mSuspendPopUp->insertItem( " 2x", 2 ); 90 mSuspendPopUp->insertItem( " 2x", 2 );
99 mSuspendPopUp->insertItem( " 3x", 3 ); 91 mSuspendPopUp->insertItem( " 3x", 3 );
100 mSuspendPopUp->insertItem( " 5x", 5 ); 92 mSuspendPopUp->insertItem( " 5x", 5 );
101 mSuspendPopUp->insertItem( "10x", 10 ); 93 mSuspendPopUp->insertItem( "10x", 10 );
102 mSuspendPopUp->insertItem( "20x", 20 ); 94 mSuspendPopUp->insertItem( "20x", 20 );
103 mSuspendPopUp->insertItem( "30x", 30 ); 95 mSuspendPopUp->insertItem( "30x", 30 );
104 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); 96 mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp );
105 mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); 97 mBeepPopUp->insertItem( "Beep interval",mPausePopUp );
106 mBeepPopUp->insertItem( "Replay",mSoundPopUp ); 98 mBeepPopUp->insertItem( "Replay",mSoundPopUp );
107 mBeepPopUp->insertItem( "Config",savePopUp ); 99 mBeepPopUp->insertItem( "Config",savePopUp );
108 mBeepPopUp->insertItem( "300", 300 ); 100 mBeepPopUp->insertItem( "300", 300 );
109 mBeepPopUp->insertItem( "180", 180 ); 101 mBeepPopUp->insertItem( "180", 180 );
110 mBeepPopUp->insertItem( "60", 60 ); 102 mBeepPopUp->insertItem( "60", 60 );
111 mBeepPopUp->insertItem( "30", 30 ); 103 mBeepPopUp->insertItem( "30", 30 );
112 mBeepPopUp->insertItem( "10", 10 ); 104 mBeepPopUp->insertItem( "10", 10 );
113 mBeepPopUp->insertItem( "3", 3 ); 105 mBeepPopUp->insertItem( "3", 3 );
114 mBeepPopUp->insertItem( "1", 1 ); 106 mBeepPopUp->insertItem( "1", 1 );
115 mBeepPopUp->insertItem( "Off", 0 ); 107 mBeepPopUp->insertItem( "Off", 0 );
116 mBeepPopUp->insertSeparator(); 108 mBeepPopUp->insertSeparator();
117 mBeepPopUp->insertItem( "Simulate", 1000 ); 109 mBeepPopUp->insertItem( "Simulate", 1000 );
118 mBeepPopUp->setCheckable( true ); 110 mBeepPopUp->setCheckable( true );
119 mPopUp->insertSeparator(); 111 mPopUp->insertSeparator();
120 mPopUp->insertItem( "Play beeps", mBeepPopUp ); 112 mPopUp->insertItem( "Play beeps", mBeepPopUp );
121 mPopUp->insertSeparator(); 113 mPopUp->insertSeparator();
122 mPopUp->insertItem( "Timer", mTimerPopUp ); 114 mPopUp->insertItem( "Timer", mTimerPopUp );
123 //mPopUp->insertSeparator(); 115 //mPopUp->insertSeparator();
124 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) ); 116 //mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
125 117
126 mPopUp->resize( mPopUp->sizeHint() ); 118 mPopUp->resize( mPopUp->sizeHint() );
127 mPlayBeeps = 60; 119 mPlayBeeps = 60;
128 mBeepPopUp->setItemChecked ( mPlayBeeps, true ); 120 mBeepPopUp->setItemChecked ( mPlayBeeps, true );
129 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) ); 121 connect ( mBeepPopUp, SIGNAL( activated ( int ) ), this, SLOT (slotPlayBeep( int ) ) );
130 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) ); 122 connect ( mTimerPopUp, SIGNAL( activated ( int ) ), this, SLOT (confTimer( int ) ) );
131 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); 123 connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) );
132 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); 124 connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) );
133 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); 125 connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) );
134 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); 126 connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) );
135 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); 127 connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) );
136 mTimerTime = 0; 128 mTimerTime = 0;
137 mCustomText = "Custom Text"; 129 mCustomText = "Custom Text";
138 mCustomMinutes = 7; 130 mCustomMinutes = 7;
139 mTimerPopupConf = 1; 131 mTimerPopupConf = 1;
140 fillTimerPopUp(); 132 fillTimerPopUp();
141 mPausePlay = 0; 133 mPausePlay = 0;
142 confPause( 1 ); 134 confPause( 1 );
143 mSuspend = 0; 135 mSuspend = 0;
144 confSuspend( 0 ); 136 confSuspend( 0 );
145 if ( QApplication::desktop()->width() < 480 ) { 137 if ( QApplication::desktop()->width() < 480 ) {
146 wavAlarm = false; 138 wavAlarm = false;
147 mSoundPopUp->setItemChecked ( 0, true ); 139 mSoundPopUp->setItemChecked ( 0, true );
148 } 140 }
149 else { 141 else {
150 wavAlarm = true; 142 wavAlarm = true;
151 mSoundPopUp->setItemChecked ( 1, true ); 143 mSoundPopUp->setItemChecked ( 1, true );
152 } 144 }
153 saveSlot( 1 ); 145 saveSlot( 1 );
154} 146}
155 147
156SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() 148SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl()
157{ 149{
158 //delete mPopUp; 150 //delete mPopUp;
159 delete mAlarmDialog; 151 delete mAlarmDialog;
160} 152}
161void SimpleAlarmDaemonImpl::saveSlot( int load ) 153void SimpleAlarmDaemonImpl::saveSlot( int load )
162{ 154{
163 QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; 155 QString fileName = QDir::homeDirPath() +"/.kopialarmrc";
164 //qDebug("save %d ", load ); 156 //qDebug("save %d ", load );
165 QFile file( fileName ); 157 QFile file( fileName );
166 if ( load ) { 158 if ( load ) {
167 if( !QFile::exists( fileName) ) 159 if( !QFile::exists( fileName) )
168 return; 160 return;
169 if (!file.open( IO_ReadOnly ) ) { 161 if (!file.open( IO_ReadOnly ) ) {
170 return ; 162 return ;
171 } 163 }
172 QString line; 164 QString line;
173 bool ok; 165 bool ok;