-rw-r--r-- | core/applets/clockapplet/.cvsignore | 3 | ||||
-rw-r--r-- | core/applets/clockapplet/Makefile.in | 115 | ||||
-rw-r--r-- | core/applets/clockapplet/clock.cpp | 97 | ||||
-rw-r--r-- | core/applets/clockapplet/clock.h | 46 | ||||
-rw-r--r-- | core/applets/clockapplet/clockapplet.pro | 12 | ||||
-rw-r--r-- | core/applets/clockapplet/clockappletimpl.cpp | 65 | ||||
-rw-r--r-- | core/applets/clockapplet/clockappletimpl.h | 46 | ||||
-rw-r--r-- | core/applets/clockapplet/qpe-clockapplet.control | 9 | ||||
-rwxr-xr-x | core/applets/clockapplet/qpe-clockapplet.postinst | 2 | ||||
-rwxr-xr-x | core/applets/clockapplet/qpe-clockapplet.postrm | 2 |
10 files changed, 397 insertions, 0 deletions
diff --git a/core/applets/clockapplet/.cvsignore b/core/applets/clockapplet/.cvsignore new file mode 100644 index 0000000..edfa921 --- a/dev/null +++ b/core/applets/clockapplet/.cvsignore | |||
@@ -0,0 +1,3 @@ | |||
1 | moc_* | ||
2 | *.moc | ||
3 | Makefile | ||
diff --git a/core/applets/clockapplet/Makefile.in b/core/applets/clockapplet/Makefile.in new file mode 100644 index 0000000..fcf737e --- a/dev/null +++ b/core/applets/clockapplet/Makefile.in | |||
@@ -0,0 +1,115 @@ | |||
1 | ############################################################################# | ||
2 | |||
3 | ####### Compiler, tools and options | ||
4 | |||
5 | CXX =$(SYSCONF_CXX) $(QT_CXX_MT) | ||
6 | CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB) | ||
7 | CC =$(SYSCONF_CC) $(QT_C_MT) | ||
8 | CFLAGS =$(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB) | ||
9 | INCPATH =-I$(QPEDIR)/include | ||
10 | LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) | ||
11 | LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP) | ||
12 | MOC =$(SYSCONF_MOC) | ||
13 | UIC =$(SYSCONF_UIC) | ||
14 | |||
15 | ####### Target | ||
16 | |||
17 | DESTDIR = ../../plugins/applets/ | ||
18 | VER_MAJ = 1 | ||
19 | VER_MIN = 0 | ||
20 | VER_PATCH = 0 | ||
21 | TARGET= clockapplet | ||
22 | TARGET1 = lib$(TARGET).so.$(VER_MAJ) | ||
23 | |||
24 | ####### Files | ||
25 | |||
26 | HEADERS =clock.h \ | ||
27 | clockappletimpl.h | ||
28 | SOURCES =clock.cpp \ | ||
29 | clockappletimpl.cpp | ||
30 | OBJECTS =clock.o \ | ||
31 | clockappletimpl.o | ||
32 | INTERFACES = | ||
33 | UICDECLS = | ||
34 | UICIMPLS = | ||
35 | SRCMOC =moc_clock.cpp | ||
36 | OBJMOC =moc_clock.o | ||
37 | |||
38 | |||
39 | ####### Implicit rules | ||
40 | |||
41 | .SUFFIXES: .cpp .cxx .cc .C .c | ||
42 | |||
43 | .cpp.o: | ||
44 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
45 | |||
46 | .cxx.o: | ||
47 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
48 | |||
49 | .cc.o: | ||
50 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
51 | |||
52 | .C.o: | ||
53 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< | ||
54 | |||
55 | .c.o: | ||
56 | $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< | ||
57 | |||
58 | ####### Build rules | ||
59 | |||
60 | |||
61 | all: $(DESTDIR)$(SYSCONF_LINK_TARGET) | ||
62 | |||
63 | $(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) | ||
64 | $(SYSCONF_LINK_LIB) | ||
65 | |||
66 | moc: $(SRCMOC) | ||
67 | |||
68 | tmake: | ||
69 | tmake clockapplet.pro | ||
70 | |||
71 | clean: | ||
72 | -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) | ||
73 | -rm -f *~ core | ||
74 | -rm -f allmoc.cpp | ||
75 | |||
76 | ####### Extension Modules | ||
77 | |||
78 | listpromodules: | ||
79 | @echo | ||
80 | |||
81 | listallmodules: | ||
82 | @echo | ||
83 | |||
84 | listaddonpromodules: | ||
85 | @echo | ||
86 | |||
87 | listaddonentmodules: | ||
88 | @echo | ||
89 | |||
90 | |||
91 | REQUIRES= | ||
92 | |||
93 | ####### Sub-libraries | ||
94 | |||
95 | |||
96 | ###### Combined headers | ||
97 | |||
98 | |||
99 | |||
100 | ####### Compile | ||
101 | |||
102 | clock.o: clock.cpp \ | ||
103 | clock.h | ||
104 | |||
105 | clockappletimpl.o: clockappletimpl.cpp \ | ||
106 | clock.h \ | ||
107 | clockappletimpl.h | ||
108 | |||
109 | moc_clock.o: moc_clock.cpp \ | ||
110 | clock.h | ||
111 | |||
112 | moc_clock.cpp: clock.h | ||
113 | $(MOC) clock.h -o moc_clock.cpp | ||
114 | |||
115 | |||
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp new file mode 100644 index 0000000..178dcbe --- a/dev/null +++ b/core/applets/clockapplet/clock.cpp | |||
@@ -0,0 +1,97 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include "clock.h" | ||
22 | |||
23 | #include <qpe/global.h> | ||
24 | #include <qpe/qpeapplication.h> | ||
25 | #include <qpe/config.h> | ||
26 | |||
27 | #include <qmainwindow.h> | ||
28 | #include <qlayout.h> | ||
29 | #include <qpushbutton.h> | ||
30 | #include <qmessagebox.h> | ||
31 | #include <qdatetime.h> | ||
32 | #include <qtimer.h> | ||
33 | #include <qpopupmenu.h> | ||
34 | #include <stdlib.h> | ||
35 | |||
36 | |||
37 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) | ||
38 | { | ||
39 | // If you want a sunken border around the clock do this: | ||
40 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); | ||
41 | setFont( QFont( "Helvetica", 10, QFont::Normal ) ); | ||
42 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) ); | ||
43 | connect( qApp, SIGNAL( clockChanged( bool ) ), | ||
44 | this, SLOT( slotClockChanged( bool ) ) ); | ||
45 | Config config( "qpe" ); | ||
46 | config.setGroup( "Time" ); | ||
47 | ampmFormat = config.readBoolEntry( "AMPM", TRUE ); | ||
48 | timerId = 0; | ||
49 | timerEvent( 0 ); | ||
50 | show(); | ||
51 | } | ||
52 | |||
53 | void LauncherClock::mouseReleaseEvent( QMouseEvent * ) | ||
54 | { | ||
55 | Global::execute( "systemtime" ); | ||
56 | } | ||
57 | |||
58 | |||
59 | void LauncherClock::timerEvent( QTimerEvent *e ) | ||
60 | { | ||
61 | if ( !e || e->timerId() == timerId ) { | ||
62 | killTimer( timerId ); | ||
63 | changeTime(); | ||
64 | QTime t = QTime::currentTime(); | ||
65 | int ms = (60 - t.second())*1000 - t.msec(); | ||
66 | timerId = startTimer( ms ); | ||
67 | } else { | ||
68 | QLabel::timerEvent( e ); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | void LauncherClock::updateTime( void ) | ||
73 | { | ||
74 | changeTime(); | ||
75 | } | ||
76 | |||
77 | void LauncherClock::changeTime( void ) | ||
78 | { | ||
79 | QTime tm = QDateTime::currentDateTime().time(); | ||
80 | QString s; | ||
81 | if( ampmFormat ) { | ||
82 | int hour = tm.hour(); | ||
83 | if (hour == 0) | ||
84 | hour = 12; | ||
85 | if (hour > 12) | ||
86 | hour -= 12; | ||
87 | s.sprintf( "%2d%c%02d %s", hour, ':', tm.minute(), (tm.hour() >= 12) ? "PM" : "AM" ); | ||
88 | } else | ||
89 | s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); | ||
90 | setText( s ); | ||
91 | } | ||
92 | |||
93 | void LauncherClock::slotClockChanged( bool pm ) | ||
94 | { | ||
95 | ampmFormat = pm; | ||
96 | updateTime(); | ||
97 | } | ||
diff --git a/core/applets/clockapplet/clock.h b/core/applets/clockapplet/clock.h new file mode 100644 index 0000000..9670d90 --- a/dev/null +++ b/core/applets/clockapplet/clock.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef __LAUNCHER_CLOCK_H__ | ||
21 | #define __LAUNCHER_CLOCK_H__ | ||
22 | |||
23 | |||
24 | #include <qlabel.h> | ||
25 | #include <qdatetime.h> | ||
26 | |||
27 | class LauncherClock : public QLabel | ||
28 | { | ||
29 | Q_OBJECT | ||
30 | public: | ||
31 | LauncherClock( QWidget *parent ); | ||
32 | |||
33 | protected slots: | ||
34 | void updateTime( void ); | ||
35 | void slotClockChanged( bool pm ); | ||
36 | |||
37 | protected: | ||
38 | void mouseReleaseEvent( QMouseEvent * ); | ||
39 | void timerEvent( QTimerEvent * ); | ||
40 | void changeTime( void ); | ||
41 | bool ampmFormat; | ||
42 | int timerId; | ||
43 | }; | ||
44 | |||
45 | |||
46 | #endif // __LAUNCHER_CLOCK_H__ | ||
diff --git a/core/applets/clockapplet/clockapplet.pro b/core/applets/clockapplet/clockapplet.pro new file mode 100644 index 0000000..29a4e8b --- a/dev/null +++ b/core/applets/clockapplet/clockapplet.pro | |||
@@ -0,0 +1,12 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG += qt warn_on release | ||
3 | HEADERS= clock.h clockappletimpl.h | ||
4 | SOURCES= clock.cpp clockappletimpl.cpp | ||
5 | TARGET = clockapplet | ||
6 | DESTDIR = ../../plugins/applets | ||
7 | INCLUDEPATH += $(QPEDIR)/include | ||
8 | DEPENDPATH += ../$(QPEDIR)/include .. | ||
9 | LIBS += -lqpe | ||
10 | VERSION = 1.0.0 | ||
11 | |||
12 | TRANSLATIONS += ../../i18n/de/libclockapplet.ts | ||
diff --git a/core/applets/clockapplet/clockappletimpl.cpp b/core/applets/clockapplet/clockappletimpl.cpp new file mode 100644 index 0000000..8bf1baf --- a/dev/null +++ b/core/applets/clockapplet/clockappletimpl.cpp | |||
@@ -0,0 +1,65 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #include "clock.h" | ||
21 | #include "clockappletimpl.h" | ||
22 | |||
23 | |||
24 | ClockAppletImpl::ClockAppletImpl() | ||
25 | : clock(0), ref(0) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | ClockAppletImpl::~ClockAppletImpl() | ||
30 | { | ||
31 | delete clock; | ||
32 | } | ||
33 | |||
34 | QWidget *ClockAppletImpl::applet( QWidget *parent ) | ||
35 | { | ||
36 | if ( !clock ) | ||
37 | clock = new LauncherClock( parent ); | ||
38 | return clock; | ||
39 | } | ||
40 | |||
41 | int ClockAppletImpl::position() const | ||
42 | { | ||
43 | return 10; | ||
44 | } | ||
45 | |||
46 | #ifndef QT_NO_COMPONENT | ||
47 | QRESULT ClockAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
48 | { | ||
49 | *iface = 0; | ||
50 | if ( uuid == IID_QUnknown ) | ||
51 | *iface = this; | ||
52 | else if ( uuid == IID_TaskbarApplet ) | ||
53 | *iface = this; | ||
54 | |||
55 | if ( *iface ) | ||
56 | (*iface)->addRef(); | ||
57 | return QS_OK; | ||
58 | } | ||
59 | |||
60 | Q_EXPORT_INTERFACE() | ||
61 | { | ||
62 | Q_CREATE_INSTANCE( ClockAppletImpl ) | ||
63 | } | ||
64 | #endif | ||
65 | |||
diff --git a/core/applets/clockapplet/clockappletimpl.h b/core/applets/clockapplet/clockappletimpl.h new file mode 100644 index 0000000..0c0912e --- a/dev/null +++ b/core/applets/clockapplet/clockappletimpl.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef CLOCKAPPLETIMPL_H | ||
21 | #define CLOCKAPPLETIMPL_H | ||
22 | |||
23 | #include <qpe/taskbarappletinterface.h> | ||
24 | |||
25 | class LauncherClock; | ||
26 | |||
27 | class ClockAppletImpl : public TaskbarAppletInterface | ||
28 | { | ||
29 | public: | ||
30 | ClockAppletImpl(); | ||
31 | virtual ~ClockAppletImpl(); | ||
32 | |||
33 | #ifndef QT_NO_COMPONENT | ||
34 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
35 | Q_REFCOUNT | ||
36 | #endif | ||
37 | |||
38 | virtual QWidget *applet( QWidget *parent ); | ||
39 | virtual int position() const; | ||
40 | |||
41 | private: | ||
42 | LauncherClock *clock; | ||
43 | ulong ref; | ||
44 | }; | ||
45 | |||
46 | #endif | ||
diff --git a/core/applets/clockapplet/qpe-clockapplet.control b/core/applets/clockapplet/qpe-clockapplet.control new file mode 100644 index 0000000..9532ca8 --- a/dev/null +++ b/core/applets/clockapplet/qpe-clockapplet.control | |||
@@ -0,0 +1,9 @@ | |||
1 | Files: plugins/applets/libclockapplet.so* | ||
2 | Priority: optional | ||
3 | Section: qpe/taskbar | ||
4 | Maintainer: Warwick Allison <warwick@trolltech.com> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-3 | ||
7 | Depends: qpe-base ($QPE_VERSION) | ||
8 | Description: Clock applet | ||
9 | Clock applet for the Qtopia environment taskbar. | ||
diff --git a/core/applets/clockapplet/qpe-clockapplet.postinst b/core/applets/clockapplet/qpe-clockapplet.postinst new file mode 100755 index 0000000..ba76ffa --- a/dev/null +++ b/core/applets/clockapplet/qpe-clockapplet.postinst | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" | ||
diff --git a/core/applets/clockapplet/qpe-clockapplet.postrm b/core/applets/clockapplet/qpe-clockapplet.postrm new file mode 100755 index 0000000..ba76ffa --- a/dev/null +++ b/core/applets/clockapplet/qpe-clockapplet.postrm | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | /opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()" | ||