summaryrefslogtreecommitdiff
authortille <tille>2002-07-06 15:41:52 (UTC)
committer tille <tille>2002-07-06 15:41:52 (UTC)
commitb83751deab22e8e25d21265bd59ab53766109ca2 (patch) (unidiff)
treea7708e017a899e25720b83680a4c55e131a8c99d
parent7fcf35f1632134cc9f0b3d38949864df3df59c4c (diff)
downloadopie-b83751deab22e8e25d21265bd59ab53766109ca2.zip
opie-b83751deab22e8e25d21265bd59ab53766109ca2.tar.gz
opie-b83751deab22e8e25d21265bd59ab53766109ca2.tar.bz2
no qDebug ;)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clockapplet/clock.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp
index ba079bf..52d285b 100644
--- a/core/applets/clockapplet/clock.cpp
+++ b/core/applets/clockapplet/clock.cpp
@@ -1,128 +1,127 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "clock.h" 21#include "clock.h"
22 22
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27 27
28#include <qmainwindow.h> 28#include <qmainwindow.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qfile.h> 35#include <qfile.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38 38
39LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) 39LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent )
40{ 40{
41 // If you want a sunken border around the clock do this: 41 // If you want a sunken border around the clock do this:
42 // setFrameStyle( QFrame::Panel | QFrame::Sunken ); 42 // setFrameStyle( QFrame::Panel | QFrame::Sunken );
43 setFont( QFont( "Helvetica", 10, QFont::Normal ) ); 43 setFont( QFont( "Helvetica", 10, QFont::Normal ) );
44 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); 44 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) );
45 connect( qApp, SIGNAL( clockChanged( bool ) ), 45 connect( qApp, SIGNAL( clockChanged( bool ) ),
46 this, SLOT( slotClockChanged( bool ) ) ); 46 this, SLOT( slotClockChanged( bool ) ) );
47 readConfig(); 47 readConfig();
48 timerId = 0; 48 timerId = 0;
49 timerEvent( 0 ); 49 timerEvent( 0 );
50 show(); 50 show();
51} 51}
52 52
53void LauncherClock::readConfig() { 53void LauncherClock::readConfig() {
54 Config config( "qpe" ); 54 Config config( "qpe" );
55 config.setGroup( "Time" ); 55 config.setGroup( "Time" );
56 ampmFormat = config.readBoolEntry( "AMPM", TRUE ); 56 ampmFormat = config.readBoolEntry( "AMPM", TRUE );
57 config.setGroup( "Date" ); 57 config.setGroup( "Date" );
58 format = config.readNumEntry("ClockApplet",0); 58 format = config.readNumEntry("ClockApplet",0);
59} 59}
60 60
61void LauncherClock::mouseReleaseEvent( QMouseEvent * ) 61void LauncherClock::mouseReleaseEvent( QMouseEvent * )
62{ 62{
63 QCString setTimeApp; 63 QCString setTimeApp;
64 if (QFile::exists(QPEApplication::qpeDir()+"bin/netsystemtime")) 64 if (QFile::exists(QPEApplication::qpeDir()+"bin/netsystemtime"))
65 setTimeApp="netsystemtime"; 65 setTimeApp="netsystemtime";
66 else setTimeApp="systemtime"; 66 else setTimeApp="systemtime";
67 qDebug("app "+setTimeApp);
68 QCopEnvelope e("QPE/Application/"+setTimeApp, "setDocument(QString)"); 67 QCopEnvelope e("QPE/Application/"+setTimeApp, "setDocument(QString)");
69 QString lf = QString::null; 68 QString lf = QString::null;
70 69
71 e << lf; 70 e << lf;
72 71
73} 72}
74 73
75 74
76void LauncherClock::timerEvent( QTimerEvent *e ) 75void LauncherClock::timerEvent( QTimerEvent *e )
77{ 76{
78 if ( !e || e->timerId() == timerId ) { 77 if ( !e || e->timerId() == timerId ) {
79 killTimer( timerId ); 78 killTimer( timerId );
80 changeTime(); 79 changeTime();
81 QTime t = QTime::currentTime(); 80 QTime t = QTime::currentTime();
82 int ms = (60 - t.second())*1000 - t.msec(); 81 int ms = (60 - t.second())*1000 - t.msec();
83 timerId = startTimer( ms ); 82 timerId = startTimer( ms );
84 } else { 83 } else {
85 QLabel::timerEvent( e ); 84 QLabel::timerEvent( e );
86 } 85 }
87} 86}
88 87
89void LauncherClock::updateTime( void ) 88void LauncherClock::updateTime( void )
90{ 89{
91 changeTime(); 90 changeTime();
92} 91}
93 92
94void LauncherClock::changeTime( void ) 93void LauncherClock::changeTime( void )
95{ 94{
96 QTime tm = QDateTime::currentDateTime().time(); 95 QTime tm = QDateTime::currentDateTime().time();
97 QString s; 96 QString s;
98 if( ampmFormat ) { 97 if( ampmFormat ) {
99 int hour = tm.hour(); 98 int hour = tm.hour();
100 if (hour == 0) 99 if (hour == 0)
101 hour = 12; 100 hour = 12;
102 if (hour > 12) 101 if (hour > 12)
103 hour -= 12; 102 hour -= 12;
104 s.sprintf( "%2d:%02d %s", hour, tm.minute(), 103 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
105 (tm.hour() >= 12) ? "PM" : "AM" ); 104 (tm.hour() >= 12) ? "PM" : "AM" );
106 } else 105 } else
107 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); 106 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
108 107
109 if (format==1) { 108 if (format==1) {
110 QDate dm = QDate::currentDate(); 109 QDate dm = QDate::currentDate();
111 QString d; 110 QString d;
112 d.sprintf("%d/%d ", dm.day(), dm.month()); 111 d.sprintf("%d/%d ", dm.day(), dm.month());
113 setText( d+s ); 112 setText( d+s );
114 } else if (format==2) { 113 } else if (format==2) {
115 QDate dm = QDate::currentDate(); 114 QDate dm = QDate::currentDate();
116 QString d; 115 QString d;
117 d.sprintf("%d/%d ", dm.month(), dm.day()); 116 d.sprintf("%d/%d ", dm.month(), dm.day());
118 setText( d+s ); 117 setText( d+s );
119 } else { 118 } else {
120 setText( s ); 119 setText( s );
121 } 120 }
122} 121}
123 122
124void LauncherClock::slotClockChanged( bool pm ) 123void LauncherClock::slotClockChanged( bool pm )
125{ 124{
126 readConfig(); 125 readConfig();
127 updateTime(); 126 updateTime();
128} 127}