author | harlekin <harlekin> | 2002-10-24 11:52:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-24 11:52:25 (UTC) |
commit | 667da4143ff65ac9502d55fb09ca8223b16a8994 (patch) (unidiff) | |
tree | cc7f7762a8ba88f0e913515d572b788073066bce | |
parent | bb381ba95d321259295ff7fc02534281d21ded87 (diff) | |
download | opie-667da4143ff65ac9502d55fb09ca8223b16a8994.zip opie-667da4143ff65ac9502d55fb09ca8223b16a8994.tar.gz opie-667da4143ff65ac9502d55fb09ca8223b16a8994.tar.bz2 |
today refreshes itself now by a timer, important for fast load and on retail rom which might not get the pim signal we will have soon - closes bug #335
-rw-r--r-- | core/pim/today/changelog | 4 | ||||
-rw-r--r-- | core/pim/today/opie-today.control | 2 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 17 | ||||
-rw-r--r-- | core/pim/today/today.h | 4 | ||||
-rw-r--r-- | core/pim/today/todayconfig.cpp | 14 | ||||
-rw-r--r-- | core/pim/today/todayconfig.h | 1 |
6 files changed, 39 insertions, 3 deletions
diff --git a/core/pim/today/changelog b/core/pim/today/changelog index 25d63ef..eb2496a 100644 --- a/core/pim/today/changelog +++ b/core/pim/today/changelog | |||
@@ -1,105 +1,109 @@ | |||
1 | 0.5.2 | ||
2 | |||
3 | * refresh settings | ||
4 | |||
1 | 0.5.1 | 5 | 0.5.1 |
2 | 6 | ||
3 | * icons scalable and clickable again | 7 | * icons scalable and clickable again |
4 | 8 | ||
5 | 0.5 | 9 | 0.5 |
6 | 10 | ||
7 | * now fully plugin based | 11 | * now fully plugin based |
8 | 12 | ||
9 | 0.3.4 | 13 | 0.3.4 |
10 | 14 | ||
11 | * "fill our business card now a clickable label" | 15 | * "fill our business card now a clickable label" |
12 | * Several bugfixes regarding todo section. | 16 | * Several bugfixes regarding todo section. |
13 | 17 | ||
14 | 0.3.3 | 18 | 0.3.3 |
15 | 19 | ||
16 | * Changed the logo so it better scales to bigger display and also | 20 | * Changed the logo so it better scales to bigger display and also |
17 | made the "Today" string translatable. | 21 | made the "Today" string translatable. |
18 | * some am/pm fixes | 22 | * some am/pm fixes |
19 | * clickable labels now in libopie | 23 | * clickable labels now in libopie |
20 | 24 | ||
21 | 0.3.2 | 25 | 0.3.2 |
22 | 26 | ||
23 | * Autostart is now more configurable. You can decide how long | 27 | * Autostart is now more configurable. You can decide how long |
24 | the ipaq has to has been suspended, before autostart is triggered.(Opie | 28 | the ipaq has to has been suspended, before autostart is triggered.(Opie |
25 | only) | 29 | only) |
26 | * am/pm time optinal (autodetect) | 30 | * am/pm time optinal (autodetect) |
27 | 31 | ||
28 | 0.3.1 | 32 | 0.3.1 |
29 | 33 | ||
30 | * fixed the wrong color of the buttons | 34 | * fixed the wrong color of the buttons |
31 | * better translation (thanks carsten and others) | 35 | * better translation (thanks carsten and others) |
32 | * fixes memory leaks | 36 | * fixes memory leaks |
33 | * bugfixes in calendar part, now location and note are working again. | 37 | * bugfixes in calendar part, now location and note are working again. |
34 | 38 | ||
35 | 0.3.0 | 39 | 0.3.0 |
36 | 40 | ||
37 | * today uses now tododb from libopie. So major changes in the todo part: | 41 | * today uses now tododb from libopie. So major changes in the todo part: |
38 | - overdue items on top | 42 | - overdue items on top |
39 | - then sorted by date, then by priority | 43 | - then sorted by date, then by priority |
40 | * some cleanups | 44 | * some cleanups |
41 | * speed optimisations | 45 | * speed optimisations |
42 | 46 | ||
43 | 0.2.9 | 47 | 0.2.9 |
44 | 48 | ||
45 | * Many bugfixes. | 49 | * Many bugfixes. |
46 | * Today now apparently sorts the dates _allways_ right, i would assume it | 50 | * Today now apparently sorts the dates _allways_ right, i would assume it |
47 | to be a qt bug | 51 | to be a qt bug |
48 | 52 | ||
49 | 0.2.8 | 53 | 0.2.8 |
50 | 54 | ||
51 | * Appointments are now clickable (connection to datebook still missing) | 55 | * Appointments are now clickable (connection to datebook still missing) |
52 | * autostart support (opie only) | 56 | * autostart support (opie only) |
53 | 57 | ||
54 | 0.2.7 | 58 | 0.2.7 |
55 | 59 | ||
56 | * check if todolist.xml was changed before parsing it | 60 | * check if todolist.xml was changed before parsing it |
57 | * check only every 30 sec for changes. | 61 | * check only every 30 sec for changes. |
58 | * some visual stuff | 62 | * some visual stuff |
59 | * as usual many little improvements .-) | 63 | * as usual many little improvements .-) |
60 | 64 | ||
61 | 0.2.6 | 65 | 0.2.6 |
62 | 66 | ||
63 | * added scrollbars to dates and todo | 67 | * added scrollbars to dates and todo |
64 | * all day detection | 68 | * all day detection |
65 | * some smaller bugfixes | 69 | * some smaller bugfixes |
66 | 70 | ||
67 | 0.2.5 | 71 | 0.2.5 |
68 | 72 | ||
69 | * some other minor fixes regarding autoupdate | 73 | * some other minor fixes regarding autoupdate |
70 | * fixed segfault with todolist > 7 entries | 74 | * fixed segfault with todolist > 7 entries |
71 | * fixed the "ugly grey border around buttons" issue | 75 | * fixed the "ugly grey border around buttons" issue |
72 | * fixed the "empty calendar field" "bug" | 76 | * fixed the "empty calendar field" "bug" |
73 | * shown only later appointments as option | 77 | * shown only later appointments as option |
74 | 78 | ||
75 | 79 | ||
76 | 0.2.4 | 80 | 0.2.4 |
77 | 81 | ||
78 | * added support for email | 82 | * added support for email |
79 | * autoupdates after 1 min | 83 | * autoupdates after 1 min |
80 | * QCopEnvelope instead of system() | 84 | * QCopEnvelope instead of system() |
81 | * starting to use qvbox in gui | 85 | * starting to use qvbox in gui |
82 | 86 | ||
83 | 87 | ||
84 | 0.2.3 | 88 | 0.2.3 |
85 | 89 | ||
86 | * the 4 am release | 90 | * the 4 am release |
87 | * several bugfixes | 91 | * several bugfixes |
88 | 92 | ||
89 | 93 | ||
90 | 0.2.2 | 94 | 0.2.2 |
91 | 95 | ||
92 | * started working on calling other apps | 96 | * started working on calling other apps |
93 | * and finished it | 97 | * and finished it |
94 | 98 | ||
95 | 0.2.1 | 99 | 0.2.1 |
96 | 100 | ||
97 | * images no more inline | 101 | * images no more inline |
98 | * config dialog | 102 | * config dialog |
99 | 103 | ||
100 | 0.1.1 | 104 | 0.1.1 |
101 | 105 | ||
102 | * started changelog. | 106 | * started changelog. |
103 | * fixed segfault on empty/nonexistant todolist.xml | 107 | * fixed segfault on empty/nonexistant todolist.xml |
104 | * better handling for file location | 108 | * better handling for file location |
105 | 109 | ||
diff --git a/core/pim/today/opie-today.control b/core/pim/today/opie-today.control index 28087f9..267a195 100644 --- a/core/pim/today/opie-today.control +++ b/core/pim/today/opie-today.control | |||
@@ -1,16 +1,16 @@ | |||
1 | Files: bin/today apps/1Pim/today.desktop pics/today/* | 1 | Files: bin/today apps/1Pim/today.desktop pics/today/* |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/applications | 3 | Section: opie/applications |
4 | Maintainer: Maximilian Reiß <harlekin@handhelds.org> | 4 | Maintainer: Maximilian Reiß <harlekin@handhelds.org> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: 0.5.1-$SUB_VERSION | 6 | Version: 0.5.2-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) |
8 | License: GPL | 8 | License: GPL |
9 | Description: today screen | 9 | Description: today screen |
10 | This today screen app gives an overview of appointments | 10 | This today screen app gives an overview of appointments |
11 | and todos. | 11 | and todos. |
12 | It also shows incoming and outgoing mails from opiemail. | 12 | It also shows incoming and outgoing mails from opiemail. |
13 | When using Opie (opie.handhelds.org) today can be autostarted | 13 | When using Opie (opie.handhelds.org) today can be autostarted |
14 | on resume. | 14 | on resume. |
15 | It is highly configurable. | 15 | It is highly configurable. |
16 | 16 | ||
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index dd98824..8184730 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,337 +1,352 @@ | |||
1 | /* | 1 | /* |
2 | * today.cpp | 2 | * today.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | #include "today.h" | 18 | #include "today.h" |
19 | #include <opie/todayconfigwidget.h> | 19 | #include <opie/todayconfigwidget.h> |
20 | 20 | ||
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/contact.h> | 26 | #include <qpe/contact.h> |
27 | 27 | ||
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qhbox.h> | 35 | #include <qhbox.h> |
36 | #include <opie/otabwidget.h> | 36 | #include <opie/otabwidget.h> |
37 | #include <qdialog.h> | 37 | #include <qdialog.h> |
38 | #include <qwhatsthis.h> | 38 | #include <qwhatsthis.h> |
39 | 39 | ||
40 | 40 | ||
41 | struct TodayPlugin { | 41 | struct TodayPlugin { |
42 | QLibrary *library; | 42 | QLibrary *library; |
43 | TodayPluginInterface *iface; | 43 | TodayPluginInterface *iface; |
44 | TodayPluginObject *guiPart; | 44 | TodayPluginObject *guiPart; |
45 | QWidget *guiBox; | 45 | QWidget *guiBox; |
46 | QString name; | 46 | QString name; |
47 | bool active; | 47 | bool active; |
48 | int pos; | 48 | int pos; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static QValueList<TodayPlugin> pluginList; | 51 | static QValueList<TodayPlugin> pluginList; |
52 | 52 | ||
53 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 53 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
54 | : TodayBase( parent, name, fl ) { | 54 | : TodayBase( parent, name, fl ) { |
55 | 55 | ||
56 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 56 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
57 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 57 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
58 | 58 | ||
59 | #if defined(Q_WS_QWS) | 59 | #if defined(Q_WS_QWS) |
60 | #if !defined(QT_NO_COP) | 60 | #if !defined(QT_NO_COP) |
61 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 61 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
62 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 62 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
63 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 63 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
64 | #endif | 64 | #endif |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | setOwnerField(); | 67 | setOwnerField(); |
68 | m_refreshTimer = new QTimer( this ); | ||
69 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | ||
70 | m_refreshTimer->start( 15000 ); | ||
68 | refresh(); | 71 | refresh(); |
69 | showMaximized(); | 72 | showMaximized(); |
70 | } | 73 | } |
71 | 74 | ||
72 | /** | 75 | /** |
73 | * Qcop receive method. | 76 | * Qcop receive method. |
74 | */ | 77 | */ |
75 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 78 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
76 | QDataStream stream( data, IO_ReadOnly ); | 79 | QDataStream stream( data, IO_ReadOnly ); |
77 | if ( msg == "message(QString)" ) { | 80 | if ( msg == "message(QString)" ) { |
78 | QString message; | 81 | QString message; |
79 | stream >> message; | 82 | stream >> message; |
80 | setOwnerField( message ); | 83 | setOwnerField( message ); |
81 | } | 84 | } |
82 | } | 85 | } |
83 | 86 | ||
87 | void Today::setRefreshTimer( int interval ) { | ||
88 | |||
89 | if ( m_refreshTimerEnabled ) { | ||
90 | m_refreshTimer->changeInterval( interval ); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | |||
84 | /** | 95 | /** |
85 | * Initialises the owner field with the default value, the username | 96 | * Initialises the owner field with the default value, the username |
86 | */ | 97 | */ |
87 | void Today::setOwnerField() { | 98 | void Today::setOwnerField() { |
88 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); | 99 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); |
89 | if ( QFile::exists( file ) ) { | 100 | if ( QFile::exists( file ) ) { |
90 | Contact cont = Contact::readVCard( file )[0]; | 101 | Contact cont = Contact::readVCard( file )[0]; |
91 | QString returnString = cont.fullName(); | 102 | QString returnString = cont.fullName(); |
92 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); | 103 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); |
93 | } else { | 104 | } else { |
94 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); | 105 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); |
95 | } | 106 | } |
96 | } | 107 | } |
97 | 108 | ||
98 | /** | 109 | /** |
99 | * Set the owner field with a given QString, for example per qcop. | 110 | * Set the owner field with a given QString, for example per qcop. |
100 | */ | 111 | */ |
101 | void Today::setOwnerField( QString &message ) { | 112 | void Today::setOwnerField( QString &message ) { |
102 | if ( !message.isEmpty() ) { | 113 | if ( !message.isEmpty() ) { |
103 | OwnerField->setText( "<b>" + message + "</b>" ); | 114 | OwnerField->setText( "<b>" + message + "</b>" ); |
104 | } | 115 | } |
105 | } | 116 | } |
106 | 117 | ||
107 | 118 | ||
108 | /** | 119 | /** |
109 | * Init stuff needed for today. Reads the config file. | 120 | * Init stuff needed for today. Reads the config file. |
110 | */ | 121 | */ |
111 | void Today::init() { | 122 | void Today::init() { |
112 | // read config | 123 | // read config |
113 | Config cfg( "today" ); | 124 | Config cfg( "today" ); |
114 | cfg.setGroup( "Plugins" ); | ||
115 | 125 | ||
126 | cfg.setGroup( "Plugins" ); | ||
116 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 127 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
117 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); | 128 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); |
129 | |||
118 | cfg.setGroup( "General" ); | 130 | cfg.setGroup( "General" ); |
119 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 131 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
132 | m_refreshTimer->changeInterval( cfg.readNumEntry( "checkinterval", 15000 ) ); | ||
133 | |||
120 | } | 134 | } |
121 | 135 | ||
122 | 136 | ||
123 | /** | 137 | /** |
124 | * Load the plugins | 138 | * Load the plugins |
125 | */ | 139 | */ |
126 | void Today::loadPlugins() { | 140 | void Today::loadPlugins() { |
127 | 141 | ||
128 | QValueList<TodayPlugin>::Iterator tit; | 142 | QValueList<TodayPlugin>::Iterator tit; |
129 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | 143 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
130 | (*tit).library->unload(); | 144 | (*tit).library->unload(); |
131 | delete (*tit).library; | 145 | delete (*tit).library; |
132 | } | 146 | } |
133 | pluginList.clear(); | 147 | pluginList.clear(); |
134 | 148 | ||
135 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 149 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
136 | QDir dir( path, "lib*.so" ); | 150 | QDir dir( path, "lib*.so" ); |
137 | 151 | ||
138 | QStringList list = dir.entryList(); | 152 | QStringList list = dir.entryList(); |
139 | QStringList::Iterator it; | 153 | QStringList::Iterator it; |
140 | 154 | ||
141 | QMap<QString, TodayPlugin> tempList; | 155 | QMap<QString, TodayPlugin> tempList; |
142 | 156 | ||
143 | for ( it = list.begin(); it != list.end(); ++it ) { | 157 | for ( it = list.begin(); it != list.end(); ++it ) { |
144 | TodayPluginInterface *iface = 0; | 158 | TodayPluginInterface *iface = 0; |
145 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 159 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
146 | 160 | ||
147 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | 161 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); |
148 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 162 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
149 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); | 163 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); |
150 | qDebug( QString(*it) ); | 164 | qDebug( QString(*it) ); |
151 | TodayPlugin plugin; | 165 | TodayPlugin plugin; |
152 | plugin.library = lib; | 166 | plugin.library = lib; |
153 | plugin.iface = iface; | 167 | plugin.iface = iface; |
154 | plugin.name = QString(*it); | 168 | plugin.name = QString(*it); |
155 | 169 | ||
156 | // find out if plugins should be shown | 170 | // find out if plugins should be shown |
157 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 171 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
158 | plugin.active = true; | 172 | plugin.active = true; |
159 | } else { | 173 | } else { |
160 | plugin.active = false; | 174 | plugin.active = false; |
161 | } | 175 | } |
162 | plugin.guiPart = plugin.iface->guiPart(); | 176 | plugin.guiPart = plugin.iface->guiPart(); |
163 | 177 | ||
164 | // package the whole thing into a qwidget so it can be shown and hidden | 178 | // package the whole thing into a qwidget so it can be shown and hidden |
165 | plugin.guiBox = new QWidget( this ); | 179 | plugin.guiBox = new QWidget( this ); |
166 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 180 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
167 | QPixmap plugPix; | 181 | QPixmap plugPix; |
168 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); | 182 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); |
169 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 183 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
170 | plugIcon->setPixmap( plugPix ); | 184 | plugIcon->setPixmap( plugPix ); |
171 | QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); | 185 | QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); |
172 | plugIcon->setName( plugin.guiPart->appName() ); | 186 | plugIcon->setName( plugin.guiPart->appName() ); |
173 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); | 187 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); |
174 | // a scrollview for each plugin | 188 | // a scrollview for each plugin |
175 | QScrollView* sv = new QScrollView( plugin.guiBox ); | 189 | QScrollView* sv = new QScrollView( plugin.guiBox ); |
176 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); | 190 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); |
177 | // not sure if that is good .-) | 191 | // not sure if that is good .-) |
178 | sv->setMinimumHeight( 10 ); | 192 | sv->setMinimumHeight( 10 ); |
179 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 193 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
180 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 194 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
181 | sv->setFrameShape( QFrame::NoFrame ); | 195 | sv->setFrameShape( QFrame::NoFrame ); |
182 | sv->addChild( plugWidget ); | 196 | sv->addChild( plugWidget ); |
183 | // make sure the icon is on the top alligned | 197 | // make sure the icon is on the top alligned |
184 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | 198 | boxLayout->addWidget( plugIcon, 0, AlignTop ); |
185 | boxLayout->addWidget( sv, 0, AlignTop ); | 199 | boxLayout->addWidget( sv, 0, AlignTop ); |
186 | boxLayout->setStretchFactor( plugIcon, 1 ); | 200 | boxLayout->setStretchFactor( plugIcon, 1 ); |
187 | boxLayout->setStretchFactor( sv, 9 ); | 201 | boxLayout->setStretchFactor( sv, 9 ); |
188 | // "prebuffer" it in one more list, to get the sorting done | 202 | // "prebuffer" it in one more list, to get the sorting done |
189 | tempList.insert( plugin.name, plugin ); | 203 | tempList.insert( plugin.name, plugin ); |
190 | 204 | ||
191 | // on first start the list is off course empty | 205 | // on first start the list is off course empty |
192 | if ( m_allApplets.isEmpty() ) { | 206 | if ( m_allApplets.isEmpty() ) { |
193 | layout->addWidget( plugin.guiBox ); | 207 | layout->addWidget( plugin.guiBox ); |
194 | pluginList.append( plugin ); | 208 | pluginList.append( plugin ); |
195 | } | 209 | } |
196 | } else { | 210 | } else { |
197 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); | 211 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); |
198 | delete lib; | 212 | delete lib; |
199 | } | 213 | } |
200 | } | 214 | } |
201 | 215 | ||
202 | if ( !m_allApplets.isEmpty() ) { | 216 | if ( !m_allApplets.isEmpty() ) { |
203 | TodayPlugin tempPlugin; | 217 | TodayPlugin tempPlugin; |
204 | QStringList::Iterator stringit; | 218 | QStringList::Iterator stringit; |
205 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { | 219 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { |
206 | tempPlugin = ( tempList.find( *stringit ) ).data(); | 220 | tempPlugin = ( tempList.find( *stringit ) ).data(); |
207 | if ( !( (tempPlugin.name).isEmpty() ) ) { | 221 | if ( !( (tempPlugin.name).isEmpty() ) ) { |
208 | layout->addWidget( tempPlugin.guiBox ); | 222 | layout->addWidget( tempPlugin.guiBox ); |
209 | pluginList.append( tempPlugin ); | 223 | pluginList.append( tempPlugin ); |
210 | } | 224 | } |
211 | } | 225 | } |
212 | } | 226 | } |
213 | } | 227 | } |
214 | 228 | ||
215 | 229 | ||
216 | /** | 230 | /** |
217 | * Repaint method. Reread all fields. | 231 | * Repaint method. Reread all fields. |
218 | */ | 232 | */ |
219 | void Today::draw() { | 233 | void Today::draw() { |
220 | 234 | ||
221 | if ( pluginList.count() == 0 ) { | 235 | if ( pluginList.count() == 0 ) { |
222 | QLabel *noPlugins = new QLabel( this ); | 236 | QLabel *noPlugins = new QLabel( this ); |
223 | noPlugins->setText( tr( "No plugins found" ) ); | 237 | noPlugins->setText( tr( "No plugins found" ) ); |
224 | layout->addWidget( noPlugins ); | 238 | layout->addWidget( noPlugins ); |
225 | return; | 239 | return; |
226 | } | 240 | } |
227 | 241 | ||
228 | uint count = 0; | 242 | uint count = 0; |
229 | TodayPlugin plugin; | 243 | TodayPlugin plugin; |
230 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 244 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
231 | plugin = pluginList[i]; | 245 | plugin = pluginList[i]; |
232 | 246 | ||
233 | if ( plugin.active ) { | 247 | if ( plugin.active ) { |
234 | // qDebug( plugin.name + " is ACTIVE " ); | 248 | // qDebug( plugin.name + " is ACTIVE " ); |
235 | plugin.guiBox->show(); | 249 | plugin.guiBox->show(); |
236 | } else { | 250 | } else { |
237 | // qDebug( plugin.name + " is INACTIVE" ); | 251 | // qDebug( plugin.name + " is INACTIVE" ); |
238 | plugin.guiBox->hide(); | 252 | plugin.guiBox->hide(); |
239 | } | 253 | } |
240 | count++; | 254 | count++; |
241 | } | 255 | } |
242 | 256 | ||
243 | if ( count == 0 ) { | 257 | if ( count == 0 ) { |
244 | QLabel *noPluginsActive = new QLabel( this ); | 258 | QLabel *noPluginsActive = new QLabel( this ); |
245 | noPluginsActive->setText( tr( "No plugins activated" ) ); | 259 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
246 | layout->addWidget( noPluginsActive ); | 260 | layout->addWidget( noPluginsActive ); |
247 | } | 261 | } |
248 | layout->addStretch(0); | 262 | layout->addStretch(0); |
249 | } | 263 | } |
250 | 264 | ||
251 | 265 | ||
252 | /** | 266 | /** |
253 | * The method for the configuration dialog. | 267 | * The method for the configuration dialog. |
254 | */ | 268 | */ |
255 | void Today::startConfig() { | 269 | void Today::startConfig() { |
256 | 270 | ||
257 | TodayConfig conf( this, "dialog", true ); | 271 | TodayConfig conf( this, "dialog", true ); |
258 | 272 | ||
259 | TodayPlugin plugin; | 273 | TodayPlugin plugin; |
260 | QList<TodayConfigWidget> configWidgetList; | 274 | QList<TodayConfigWidget> configWidgetList; |
261 | 275 | ||
262 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { | 276 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { |
263 | plugin = pluginList[i]; | 277 | plugin = pluginList[i]; |
264 | 278 | ||
265 | // load the config widgets in the tabs | 279 | // load the config widgets in the tabs |
266 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | 280 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
267 | TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); | 281 | TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); |
268 | configWidgetList.append( widget ); | 282 | configWidgetList.append( widget ); |
269 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() | 283 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() |
270 | , plugin.guiPart->appName() ); | 284 | , plugin.guiPart->appName() ); |
271 | } | 285 | } |
272 | // set the order/activate tab | 286 | // set the order/activate tab |
273 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), | 287 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), |
274 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); | 288 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); |
275 | } | 289 | } |
276 | 290 | ||
277 | if ( conf.exec() == QDialog::Accepted ) { | 291 | if ( conf.exec() == QDialog::Accepted ) { |
278 | conf.writeConfig(); | 292 | conf.writeConfig(); |
279 | TodayConfigWidget *confWidget; | 293 | TodayConfigWidget *confWidget; |
280 | for ( confWidget = configWidgetList.first(); confWidget != 0; | 294 | for ( confWidget = configWidgetList.first(); confWidget != 0; |
281 | confWidget = configWidgetList.next() ) { | 295 | confWidget = configWidgetList.next() ) { |
282 | confWidget->writeConfig(); | 296 | confWidget->writeConfig(); |
283 | } | 297 | } |
284 | refresh(); | 298 | refresh(); |
285 | } | 299 | } |
286 | } | 300 | } |
287 | 301 | ||
288 | 302 | ||
289 | /** | 303 | /** |
290 | * Refresh for the view. Reload all applets | 304 | * Refresh for the view. Reload all applets |
291 | * | 305 | * |
292 | */ | 306 | */ |
293 | void Today::refresh() { | 307 | void Today::refresh() { |
294 | init(); | 308 | init(); |
295 | 309 | ||
310 | qDebug(" refresh "); | ||
296 | // set the date in top label | 311 | // set the date in top label |
297 | QDate date = QDate::currentDate(); | 312 | QDate date = QDate::currentDate(); |
298 | QString time = ( tr( date.toString() ) ); | 313 | QString time = ( tr( date.toString() ) ); |
299 | 314 | ||
300 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | 315 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); |
301 | 316 | ||
302 | if ( layout ) { | 317 | if ( layout ) { |
303 | delete layout; | 318 | delete layout; |
304 | } | 319 | } |
305 | layout = new QVBoxLayout( this ); | 320 | layout = new QVBoxLayout( this ); |
306 | layout->addWidget( Frame ); | 321 | layout->addWidget( Frame ); |
307 | layout->addWidget( OwnerField ); | 322 | layout->addWidget( OwnerField ); |
308 | 323 | ||
309 | loadPlugins(); | 324 | loadPlugins(); |
310 | draw(); | 325 | draw(); |
311 | } | 326 | } |
312 | 327 | ||
313 | void Today::startAddressbook() { | 328 | void Today::startAddressbook() { |
314 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 329 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
315 | e << QString( "addressbook" ); | 330 | e << QString( "addressbook" ); |
316 | } | 331 | } |
317 | 332 | ||
318 | 333 | ||
319 | void Today::startApplication() { | 334 | void Today::startApplication() { |
320 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 335 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
321 | e << QString( sender()->name() ); | 336 | e << QString( sender()->name() ); |
322 | } | 337 | } |
323 | 338 | ||
324 | /** | 339 | /** |
325 | * launch addressbook (personal card) | 340 | * launch addressbook (personal card) |
326 | */ | 341 | */ |
327 | void Today::editCard() { | 342 | void Today::editCard() { |
328 | startAddressbook(); | 343 | startAddressbook(); |
329 | while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { | 344 | while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { |
330 | qApp->processEvents(); | 345 | qApp->processEvents(); |
331 | } | 346 | } |
332 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); | 347 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); |
333 | } | 348 | } |
334 | 349 | ||
335 | Today::~Today() { | 350 | Today::~Today() { |
336 | } | 351 | } |
337 | 352 | ||
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 6f13df6..4485a0b 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -1,73 +1,77 @@ | |||
1 | /* | 1 | /* |
2 | * today.h | 2 | * today.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | #ifndef TODAY_H | 18 | #ifndef TODAY_H |
19 | #define TODAY_H | 19 | #define TODAY_H |
20 | 20 | ||
21 | #include <opie/tododb.h> | 21 | #include <opie/tododb.h> |
22 | 22 | ||
23 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
24 | #include <qlist.h> | 24 | #include <qlist.h> |
25 | #include <qhbox.h> | 25 | #include <qhbox.h> |
26 | 26 | ||
27 | #include <qpe/qlibrary.h> | 27 | #include <qpe/qlibrary.h> |
28 | #include <qpe/event.h> | 28 | #include <qpe/event.h> |
29 | 29 | ||
30 | #include "todayconfig.h" | 30 | #include "todayconfig.h" |
31 | #include "todaybase.h" | 31 | #include "todaybase.h" |
32 | #include <opie/todayplugininterface.h> | 32 | #include <opie/todayplugininterface.h> |
33 | 33 | ||
34 | class QVBoxLayout; | 34 | class QVBoxLayout; |
35 | class OClickableLabel; | 35 | class OClickableLabel; |
36 | 36 | ||
37 | 37 | ||
38 | class Today : public TodayBase { | 38 | class Today : public TodayBase { |
39 | 39 | ||
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | 41 | ||
42 | public: | 42 | public: |
43 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 43 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
44 | ~Today(); | 44 | ~Today(); |
45 | 45 | ||
46 | private slots: | 46 | private slots: |
47 | void startConfig(); | 47 | void startConfig(); |
48 | void startAddressbook(); | 48 | void startAddressbook(); |
49 | void startApplication(); | 49 | void startApplication(); |
50 | void editCard(); | 50 | void editCard(); |
51 | void refresh(); | 51 | void refresh(); |
52 | 52 | ||
53 | private: | 53 | private: |
54 | void init(); | 54 | void init(); |
55 | void setOwnerField(); | 55 | void setOwnerField(); |
56 | void setOwnerField(QString &string); | 56 | void setOwnerField(QString &string); |
57 | void loadPlugins(); | 57 | void loadPlugins(); |
58 | void draw(); | 58 | void draw(); |
59 | void setRefreshTimer( int ); | ||
59 | 60 | ||
60 | private slots: | 61 | private slots: |
61 | void channelReceived(const QCString &msg, const QByteArray & data); | 62 | void channelReceived(const QCString &msg, const QByteArray & data); |
62 | 63 | ||
63 | private: | 64 | private: |
64 | TodayConfig *conf; | 65 | TodayConfig *conf; |
65 | QStringList m_excludeApplets; | 66 | QStringList m_excludeApplets; |
66 | QStringList m_allApplets; | 67 | QStringList m_allApplets; |
67 | 68 | ||
69 | QTimer *m_refreshTimer; | ||
70 | |||
71 | bool m_refreshTimerEnabled; | ||
68 | int m_newStart; | 72 | int m_newStart; |
69 | int m_iconSize; | 73 | int m_iconSize; |
70 | int m_maxCharClip; | 74 | int m_maxCharClip; |
71 | }; | 75 | }; |
72 | 76 | ||
73 | #endif | 77 | #endif |
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index f9dd8f7..db1141a 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -1,247 +1,259 @@ | |||
1 | /* | 1 | /* |
2 | * todayconfig.cpp | 2 | * todayconfig.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "todayconfig.h" | 17 | #include "todayconfig.h" |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
21 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
22 | 22 | ||
23 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
26 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qheader.h> | 28 | #include <qheader.h> |
29 | #include <qhbox.h> | 29 | #include <qhbox.h> |
30 | #include <qvbox.h> | 30 | #include <qvbox.h> |
31 | #include <qtoolbutton.h> | 31 | #include <qtoolbutton.h> |
32 | #include <qtooltip.h> | 32 | #include <qtooltip.h> |
33 | #include <qwhatsthis.h> | 33 | #include <qwhatsthis.h> |
34 | 34 | ||
35 | class ToolButton : public QToolButton { | 35 | class ToolButton : public QToolButton { |
36 | 36 | ||
37 | public: | 37 | public: |
38 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 38 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
39 | : QToolButton( parent, name ) { | 39 | : QToolButton( parent, name ) { |
40 | setPixmap( Resource::loadPixmap( icon ) ); | 40 | setPixmap( Resource::loadPixmap( icon ) ); |
41 | setAutoRaise( TRUE ); | 41 | setAutoRaise( TRUE ); |
42 | setFocusPolicy( QWidget::NoFocus ); | 42 | setFocusPolicy( QWidget::NoFocus ); |
43 | setToggleButton( t ); | 43 | setToggleButton( t ); |
44 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 44 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
45 | } | 45 | } |
46 | }; | 46 | }; |
47 | 47 | ||
48 | 48 | ||
49 | /** | 49 | /** |
50 | * The class has currently quite some duplicate code. | 50 | * The class has currently quite some duplicate code. |
51 | * By that way it would be real easy to have it as seperate app in settings tab | 51 | * By that way it would be real easy to have it as seperate app in settings tab |
52 | * | 52 | * |
53 | */ | 53 | */ |
54 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) | 54 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) |
55 | : QDialog( parent, name, modal, WStyle_ContextHelp ) { | 55 | : QDialog( parent, name, modal, WStyle_ContextHelp ) { |
56 | 56 | ||
57 | setCaption( tr( "Today config" ) ); | 57 | setCaption( tr( "Today config" ) ); |
58 | 58 | ||
59 | QVBoxLayout *layout = new QVBoxLayout( this ); | 59 | QVBoxLayout *layout = new QVBoxLayout( this ); |
60 | TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 60 | TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
61 | layout->addWidget( TabWidget3 ); | 61 | layout->addWidget( TabWidget3 ); |
62 | 62 | ||
63 | tab_2 = new QWidget( TabWidget3, "tab_2" ); | 63 | tab_2 = new QWidget( TabWidget3, "tab_2" ); |
64 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); | 64 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); |
65 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); | 65 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); |
66 | tab2Layout->addWidget( l ); | 66 | tab2Layout->addWidget( l ); |
67 | QHBox *hbox1 = new QHBox( tab_2 ); | 67 | QHBox *hbox1 = new QHBox( tab_2 ); |
68 | m_appletListView = new QListView( hbox1 ); | 68 | m_appletListView = new QListView( hbox1 ); |
69 | m_appletListView->addColumn( "PluginList" ); | 69 | m_appletListView->addColumn( "PluginList" ); |
70 | m_appletListView->header()->hide(); | 70 | m_appletListView->header()->hide(); |
71 | m_appletListView->setSorting( -1 ); | 71 | m_appletListView->setSorting( -1 ); |
72 | QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin ore use the arrow buttons on the right to change the appearance order" ) ); | 72 | QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin ore use the arrow buttons on the right to change the appearance order" ) ); |
73 | QVBox *vbox1 = new QVBox( hbox1 ); | 73 | QVBox *vbox1 = new QVBox( hbox1 ); |
74 | new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); | 74 | new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); |
75 | new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); | 75 | new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); |
76 | tab2Layout->addWidget( hbox1 ); | 76 | tab2Layout->addWidget( hbox1 ); |
77 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); | 77 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); |
78 | 78 | ||
79 | tab_3 = new QWidget( TabWidget3, "tab_3" ); | 79 | tab_3 = new QWidget( TabWidget3, "tab_3" ); |
80 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); | 80 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); |
81 | tab3Layout->setMargin( 20 ); | 81 | tab3Layout->setMargin( 20 ); |
82 | QHBox *hbox_auto = new QHBox( tab_3 ); | 82 | QHBox *hbox_auto = new QHBox( tab_3 ); |
83 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); | 83 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); |
84 | TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); | 84 | TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); |
85 | QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) ); | 85 | QWhatsThis::add( TextLabel2 , tr( "Check this if today should be autostarted on resume." ) ); |
86 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); | 86 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); |
87 | QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) ); | 87 | QWhatsThis::add( CheckBoxAuto, tr( "Check this if today should be autostarted on resume." ) ); |
88 | QHBox *hbox_inactive = new QHBox( tab_3 ); | 88 | QHBox *hbox_inactive = new QHBox( tab_3 ); |
89 | TimeLabel = new QLabel( hbox_inactive, "TimeLabel" ); | 89 | TimeLabel = new QLabel( hbox_inactive, "TimeLabel" ); |
90 | TimeLabel->setText( tr( "minutes inactive" ) ); | 90 | TimeLabel->setText( tr( "minutes inactive" ) ); |
91 | QWhatsThis::add( TimeLabel , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); | 91 | QWhatsThis::add( TimeLabel , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); |
92 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" ); | 92 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" ); |
93 | QWhatsThis::add( SpinBoxTime , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); | 93 | QWhatsThis::add( SpinBoxTime , tr( "How many minutes has the PDA been suspended before the autostart feature kicks in on resume" ) ); |
94 | QHBox *hbox_iconSize = new QHBox( tab_3 ); | 94 | QHBox *hbox_iconSize = new QHBox( tab_3 ); |
95 | QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" ); | 95 | QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" ); |
96 | iconSizeLabel->setText( tr( "Icon size" ) ); | 96 | iconSizeLabel->setText( tr( "Icon size" ) ); |
97 | QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) ); | 97 | QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) ); |
98 | SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" ); | 98 | SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" ); |
99 | SpinBoxIconSize->setMaxValue( 32 ); | 99 | SpinBoxIconSize->setMaxValue( 32 ); |
100 | QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) ); | 100 | QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) ); |
101 | 101 | ||
102 | QHBox *hbox_refresh = new QHBox( tab_3 ); | ||
103 | QLabel *refreshLabel = new QLabel( hbox_refresh ); | ||
104 | refreshLabel->setText( tr( "Refresh" ) ); | ||
105 | QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) ); | ||
106 | SpinRefresh = new QSpinBox( hbox_refresh ); | ||
107 | SpinRefresh->setMinValue( 2 ); | ||
108 | SpinRefresh->setSuffix( tr( " seconds" ) ); | ||
109 | QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) ); | ||
110 | |||
102 | tab3Layout->addWidget( hbox_auto ); | 111 | tab3Layout->addWidget( hbox_auto ); |
103 | tab3Layout->addWidget( hbox_inactive ); | 112 | tab3Layout->addWidget( hbox_inactive ); |
104 | tab3Layout->addWidget( hbox_iconSize ); | 113 | tab3Layout->addWidget( hbox_iconSize ); |
114 | tab3Layout->addWidget( hbox_refresh ); | ||
105 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); | 115 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); |
106 | 116 | ||
107 | m_applets_changed = false; | 117 | m_applets_changed = false; |
108 | 118 | ||
109 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); | 119 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); |
110 | 120 | ||
111 | readConfig(); | 121 | readConfig(); |
112 | showMaximized(); | 122 | showMaximized(); |
113 | } | 123 | } |
114 | 124 | ||
115 | 125 | ||
116 | /** | 126 | /** |
117 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 127 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
118 | * If registered against that today ist started on each resume. | 128 | * If registered against that today ist started on each resume. |
119 | */ | 129 | */ |
120 | void TodayConfig::setAutoStart() { | 130 | void TodayConfig::setAutoStart() { |
121 | Config cfg( "today" ); | 131 | Config cfg( "today" ); |
122 | cfg.setGroup( "Autostart" ); | 132 | cfg.setGroup( "Autostart" ); |
123 | if ( m_autoStart ) { | 133 | if ( m_autoStart ) { |
124 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); | 134 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); |
125 | e << QString( "add" ); | 135 | e << QString( "add" ); |
126 | e << QString( "today" ); | 136 | e << QString( "today" ); |
127 | e << QString( "%1" ).arg( m_autoStartTimer ); | 137 | e << QString( "%1" ).arg( m_autoStartTimer ); |
128 | } else { | 138 | } else { |
129 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); | 139 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); |
130 | e << QString( "remove" ); | 140 | e << QString( "remove" ); |
131 | e << QString( "today" ); | 141 | e << QString( "today" ); |
132 | } | 142 | } |
133 | } | 143 | } |
134 | 144 | ||
135 | /** | 145 | /** |
136 | * Read the config part | 146 | * Read the config part |
137 | */ | 147 | */ |
138 | void TodayConfig::readConfig() { | 148 | void TodayConfig::readConfig() { |
139 | Config cfg( "today" ); | 149 | Config cfg( "today" ); |
140 | cfg.setGroup( "Autostart" ); | 150 | cfg.setGroup( "Autostart" ); |
141 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); | 151 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); |
142 | CheckBoxAuto->setChecked( m_autoStart ); | 152 | CheckBoxAuto->setChecked( m_autoStart ); |
143 | m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); | 153 | m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); |
144 | SpinBoxTime->setValue( m_autoStartTimer ); | 154 | SpinBoxTime->setValue( m_autoStartTimer ); |
145 | 155 | ||
146 | cfg.setGroup( "General" ); | 156 | cfg.setGroup( "General" ); |
147 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 157 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
148 | SpinBoxIconSize->setValue( m_iconSize ); | 158 | SpinBoxIconSize->setValue( m_iconSize ); |
159 | SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); | ||
160 | |||
149 | 161 | ||
150 | cfg.setGroup( "Plugins" ); | 162 | cfg.setGroup( "Plugins" ); |
151 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 163 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
152 | } | 164 | } |
153 | 165 | ||
154 | /** | 166 | /** |
155 | * Write the config part | 167 | * Write the config part |
156 | */ | 168 | */ |
157 | void TodayConfig::writeConfig() { | 169 | void TodayConfig::writeConfig() { |
158 | Config cfg( "today" ); | 170 | Config cfg( "today" ); |
159 | cfg.setGroup( "Plugins" ); | 171 | cfg.setGroup( "Plugins" ); |
160 | if ( m_applets_changed ) { | 172 | if ( m_applets_changed ) { |
161 | QStringList exclude; | 173 | QStringList exclude; |
162 | QStringList include; | 174 | QStringList include; |
163 | QStringList all_applets; | 175 | QStringList all_applets; |
164 | 176 | ||
165 | QListViewItemIterator list_it( m_appletListView ); | 177 | QListViewItemIterator list_it( m_appletListView ); |
166 | 178 | ||
167 | // this makes sure the names get saved in the order selected | 179 | // this makes sure the names get saved in the order selected |
168 | for ( ; list_it.current(); ++list_it ) { | 180 | for ( ; list_it.current(); ++list_it ) { |
169 | QMap <QString, QCheckListItem *>::Iterator it; | 181 | QMap <QString, QCheckListItem *>::Iterator it; |
170 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { | 182 | for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { |
171 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { | 183 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { |
172 | exclude << it.key(); | 184 | exclude << it.key(); |
173 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ | 185 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ |
174 | include << it.key(); | 186 | include << it.key(); |
175 | } | 187 | } |
176 | if ( list_it.current() == (*it) ) { | 188 | if ( list_it.current() == (*it) ) { |
177 | all_applets << it.key(); | 189 | all_applets << it.key(); |
178 | } | 190 | } |
179 | } | 191 | } |
180 | } | 192 | } |
181 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 193 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
182 | cfg.writeEntry( "IncludeApplets", include, ',' ); | 194 | cfg.writeEntry( "IncludeApplets", include, ',' ); |
183 | cfg.writeEntry( "AllApplets", all_applets, ',' ); | 195 | cfg.writeEntry( "AllApplets", all_applets, ',' ); |
184 | } | 196 | } |
185 | 197 | ||
186 | cfg.setGroup( "Autostart" ); | 198 | cfg.setGroup( "Autostart" ); |
187 | m_autoStart = CheckBoxAuto->isChecked(); | 199 | m_autoStart = CheckBoxAuto->isChecked(); |
188 | cfg.writeEntry( "autostart", m_autoStart ); | 200 | cfg.writeEntry( "autostart", m_autoStart ); |
189 | m_autoStartTimer = SpinBoxTime->value(); | 201 | m_autoStartTimer = SpinBoxTime->value(); |
190 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); | 202 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); |
191 | m_iconSize = SpinBoxIconSize->value(); | 203 | m_iconSize = SpinBoxIconSize->value(); |
192 | 204 | ||
193 | cfg.setGroup( "General" ); | 205 | cfg.setGroup( "General" ); |
194 | cfg.writeEntry( "IconSize", m_iconSize ); | 206 | cfg.writeEntry( "IconSize", m_iconSize ); |
195 | 207 | cfg.writeEntry( "checkinterval", SpinRefresh->value()*1000 ); | |
196 | 208 | ||
197 | // set autostart settings | 209 | // set autostart settings |
198 | setAutoStart(); | 210 | setAutoStart(); |
199 | } | 211 | } |
200 | 212 | ||
201 | 213 | ||
202 | void TodayConfig::moveSelectedUp() { | 214 | void TodayConfig::moveSelectedUp() { |
203 | QListViewItem *item = m_appletListView->selectedItem(); | 215 | QListViewItem *item = m_appletListView->selectedItem(); |
204 | if ( item && item->itemAbove() ) { | 216 | if ( item && item->itemAbove() ) { |
205 | item->itemAbove()->moveItem( item ); | 217 | item->itemAbove()->moveItem( item ); |
206 | } | 218 | } |
207 | } | 219 | } |
208 | 220 | ||
209 | 221 | ||
210 | void TodayConfig::moveSelectedDown() { | 222 | void TodayConfig::moveSelectedDown() { |
211 | QListViewItem *item = m_appletListView->selectedItem(); | 223 | QListViewItem *item = m_appletListView->selectedItem(); |
212 | if ( item && item->itemBelow() ) { | 224 | if ( item && item->itemBelow() ) { |
213 | item->moveItem( item->itemBelow() ); | 225 | item->moveItem( item->itemBelow() ); |
214 | } | 226 | } |
215 | } | 227 | } |
216 | 228 | ||
217 | 229 | ||
218 | /** | 230 | /** |
219 | * Set up the icons in the order/active tab | 231 | * Set up the icons in the order/active tab |
220 | */ | 232 | */ |
221 | void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) { | 233 | void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) { |
222 | 234 | ||
223 | QCheckListItem *item; | 235 | QCheckListItem *item; |
224 | item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); | 236 | item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); |
225 | 237 | ||
226 | if ( !icon.isNull() ) { | 238 | if ( !icon.isNull() ) { |
227 | item->setPixmap( 0, icon ); | 239 | item->setPixmap( 0, icon ); |
228 | } | 240 | } |
229 | 241 | ||
230 | if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { | 242 | if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { |
231 | item->setOn( TRUE ); | 243 | item->setOn( TRUE ); |
232 | } | 244 | } |
233 | 245 | ||
234 | m_applets[libName] = item; | 246 | m_applets[libName] = item; |
235 | 247 | ||
236 | // kind of hack to get the first tab as default. | 248 | // kind of hack to get the first tab as default. |
237 | TabWidget3->setCurrentTab( tab_2 ); | 249 | TabWidget3->setCurrentTab( tab_2 ); |
238 | } | 250 | } |
239 | 251 | ||
240 | void TodayConfig::appletChanged() { | 252 | void TodayConfig::appletChanged() { |
241 | m_applets_changed = true; | 253 | m_applets_changed = true; |
242 | } | 254 | } |
243 | 255 | ||
244 | 256 | ||
245 | TodayConfig::~TodayConfig() { | 257 | TodayConfig::~TodayConfig() { |
246 | } | 258 | } |
247 | 259 | ||
diff --git a/core/pim/today/todayconfig.h b/core/pim/today/todayconfig.h index 827e106..68483c2 100644 --- a/core/pim/today/todayconfig.h +++ b/core/pim/today/todayconfig.h | |||
@@ -1,73 +1,74 @@ | |||
1 | /* | 1 | /* |
2 | * todayconfig.h | 2 | * todayconfig.h |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #ifndef TODAYCONFIG_H | 17 | #ifndef TODAYCONFIG_H |
18 | #define TODAYCONFIG_H | 18 | #define TODAYCONFIG_H |
19 | 19 | ||
20 | #include <qvariant.h> | 20 | #include <qvariant.h> |
21 | #include <qdialog.h> | 21 | #include <qdialog.h> |
22 | #include <qlistview.h> | 22 | #include <qlistview.h> |
23 | #include <opie/otabwidget.h> | 23 | #include <opie/otabwidget.h> |
24 | 24 | ||
25 | class QCheckBox; | 25 | class QCheckBox; |
26 | class QLabel; | 26 | class QLabel; |
27 | class QSpinBox; | 27 | class QSpinBox; |
28 | class QTabWidget; | 28 | class QTabWidget; |
29 | 29 | ||
30 | class TodayConfig : public QDialog { | 30 | class TodayConfig : public QDialog { |
31 | 31 | ||
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | 33 | ||
34 | public: | 34 | public: |
35 | TodayConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE ); | 35 | TodayConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE ); |
36 | ~TodayConfig(); | 36 | ~TodayConfig(); |
37 | 37 | ||
38 | OTabWidget* TabWidget3; | 38 | OTabWidget* TabWidget3; |
39 | 39 | ||
40 | void writeConfig(); | 40 | void writeConfig(); |
41 | void pluginManagement( QString libName, QString name, QPixmap icon ); | 41 | void pluginManagement( QString libName, QString name, QPixmap icon ); |
42 | 42 | ||
43 | 43 | ||
44 | protected slots: | 44 | protected slots: |
45 | void appletChanged(); | 45 | void appletChanged(); |
46 | void moveSelectedUp(); | 46 | void moveSelectedUp(); |
47 | void moveSelectedDown(); | 47 | void moveSelectedDown(); |
48 | 48 | ||
49 | private: | 49 | private: |
50 | void setAutoStart(); | 50 | void setAutoStart(); |
51 | void readConfig(); | 51 | void readConfig(); |
52 | 52 | ||
53 | QListView* m_appletListView; | 53 | QListView* m_appletListView; |
54 | QMap<QString,QCheckListItem*> m_applets; | 54 | QMap<QString,QCheckListItem*> m_applets; |
55 | 55 | ||
56 | int m_autoStart; | 56 | int m_autoStart; |
57 | int m_autoStartTimer; | 57 | int m_autoStartTimer; |
58 | int m_iconSize; | 58 | int m_iconSize; |
59 | QStringList m_excludeApplets; | 59 | QStringList m_excludeApplets; |
60 | bool m_applets_changed; | 60 | bool m_applets_changed; |
61 | 61 | ||
62 | QLabel* TextLabel2; | 62 | QLabel* TextLabel2; |
63 | QCheckBox* CheckBoxAuto; | 63 | QCheckBox* CheckBoxAuto; |
64 | QWidget* tab_2; | 64 | QWidget* tab_2; |
65 | QWidget* tab_3; | 65 | QWidget* tab_3; |
66 | QLabel* TextLabel1; | 66 | QLabel* TextLabel1; |
67 | QSpinBox* SpinBox7; | 67 | QSpinBox* SpinBox7; |
68 | QLabel* TimeLabel; | 68 | QLabel* TimeLabel; |
69 | QSpinBox* SpinBoxTime; | 69 | QSpinBox* SpinBoxTime; |
70 | QSpinBox* SpinRefresh; | ||
70 | QSpinBox* SpinBoxIconSize; | 71 | QSpinBox* SpinBoxIconSize; |
71 | }; | 72 | }; |
72 | 73 | ||
73 | #endif | 74 | #endif |