summaryrefslogtreecommitdiff
path: root/core/pim/today
authorharlekin <harlekin>2002-10-24 11:52:25 (UTC)
committer harlekin <harlekin>2002-10-24 11:52:25 (UTC)
commit667da4143ff65ac9502d55fb09ca8223b16a8994 (patch) (unidiff)
treecc7f7762a8ba88f0e913515d572b788073066bce /core/pim/today
parentbb381ba95d321259295ff7fc02534281d21ded87 (diff)
downloadopie-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
Diffstat (limited to 'core/pim/today') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/changelog4
-rw-r--r--core/pim/today/opie-today.control2
-rw-r--r--core/pim/today/today.cpp17
-rw-r--r--core/pim/today/today.h4
-rw-r--r--core/pim/today/todayconfig.cpp14
-rw-r--r--core/pim/today/todayconfig.h1
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,12 +1,16 @@
10.5.2
2
3* refresh settings
4
10.5.1 50.5.1
2 6
3* icons scalable and clickable again 7* icons scalable and clickable again
4 8
50.5 90.5
6 10
7* now fully plugin based 11* now fully plugin based
8 12
90.3.4 130.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.
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 @@
1Files: bin/today apps/1Pim/today.desktop pics/today/* 1Files: bin/today apps/1Pim/today.desktop pics/today/*
2Priority: optional 2Priority: optional
3Section: opie/applications 3Section: opie/applications
4Maintainer: Maximilian Reiß <harlekin@handhelds.org> 4Maintainer: Maximilian Reiß <harlekin@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: 0.5.1-$SUB_VERSION 6Version: 0.5.2-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION)
8License: GPL 8License: GPL
9Description: today screen 9Description: 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
@@ -56,40 +56,51 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
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 */
75void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 78void 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
87void 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 */
87void Today::setOwnerField() { 98void 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 }
@@ -102,30 +113,33 @@ 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 */
111void Today::init() { 122void 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 */
126void Today::loadPlugins() { 140void 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;
@@ -284,24 +298,25 @@ void Today::startConfig() {
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 */
293void Today::refresh() { 307void 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 );
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
@@ -47,27 +47,31 @@ 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
53private: 53private:
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
60private slots: 61private 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
@@ -90,27 +90,37 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal )
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/**
@@ -137,24 +147,26 @@ void TodayConfig::setAutoStart() {
137 */ 147 */
138void TodayConfig::readConfig() { 148void 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 */
157void TodayConfig::writeConfig() { 169void 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 ) {
@@ -183,25 +195,25 @@ void TodayConfig::writeConfig() {
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
202void TodayConfig::moveSelectedUp() { 214void 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}
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
@@ -58,16 +58,17 @@ private:
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