summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 67b23e1..450ecb7 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -11,54 +11,56 @@
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include "today.h" 31#include "today.h"
32 32
33#include <opie2/odebug.h> 33#include <opie2/odebug.h>
34#include <opie2/opluginloader.h> 34#include <opie2/opluginloader.h>
35#include <opie2/opimcontact.h>
36#include <opie2/ocontactaccessbackend_vcard.h>
37#include <opie2/ocontactaccess.h>
35#include <opie2/oconfig.h> 38#include <opie2/oconfig.h>
36#include <opie2/oresource.h> 39#include <opie2/oresource.h>
37 40
38#include <qpe/qcopenvelope_qws.h> 41#include <qpe/qcopenvelope_qws.h>
39#include <qpe/qpeapplication.h> 42#include <qpe/qpeapplication.h>
40#include <qpe/contact.h>
41 43
42#include <qdir.h> 44#include <qdir.h>
43#include <qtimer.h> 45#include <qtimer.h>
44#include <qwhatsthis.h> 46#include <qwhatsthis.h>
45#include <qmessagebox.h> 47#include <qmessagebox.h>
46 48
47using namespace Opie::Ui; 49using namespace Opie::Ui;
48using Opie::Core::OPluginItem; 50using Opie::Core::OPluginItem;
49using Opie::Core::OPluginLoader; 51using Opie::Core::OPluginLoader;
50using Opie::Core::OPluginManager; 52using Opie::Core::OPluginManager;
51using Opie::Core::OConfig; 53using Opie::Core::OConfig;
52 54
53 55
54struct TodayPlugin { 56struct TodayPlugin {
55TodayPlugin() : iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} 57TodayPlugin() : iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
56 QInterfacePtr<TodayPluginInterface> iface; 58 QInterfacePtr<TodayPluginInterface> iface;
57 TodayPluginObject *guiPart; 59 TodayPluginObject *guiPart;
58 OPluginItem oplugin; 60 OPluginItem oplugin;
59 QWidget *guiBox; 61 QWidget *guiBox;
60 QString name; 62 QString name;
61 bool excludeRefresh; 63 bool excludeRefresh;
62}; 64};
63 65
64static QMap<QString, TodayPlugin> pluginList; 66static QMap<QString, TodayPlugin> pluginList;
@@ -111,51 +113,53 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
111void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 113void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
112 QDataStream stream( data, IO_ReadOnly ); 114 QDataStream stream( data, IO_ReadOnly );
113 if ( msg == "message(QString)" ) { 115 if ( msg == "message(QString)" ) {
114 QString message; 116 QString message;
115 stream >> message; 117 stream >> message;
116 setOwnerField( message ); 118 setOwnerField( message );
117 } 119 }
118} 120}
119 121
120void Today::setRefreshTimer( int interval ) { 122void Today::setRefreshTimer( int interval ) {
121 123
122 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 124 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
123 // 0 is "never" case 125 // 0 is "never" case
124 if ( !interval == 0 ) { 126 if ( !interval == 0 ) {
125 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 127 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
126 m_refreshTimer->changeInterval( interval ); 128 m_refreshTimer->changeInterval( interval );
127 } 129 }
128} 130}
129 131
130 132
131/** 133/**
132 * Initialises the owner field with the default value, the username 134 * Initialises the owner field with the default value, the username
133 */ 135 */
134void Today::setOwnerField() { 136void Today::setOwnerField() {
135 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 137 QString vfilename = Global::applicationFileName("addressbook", "businesscard.vcf");
136 if ( QFile::exists( file ) ) { 138 Opie::OPimContactAccess acc( "today", vfilename,
137 Contact cont = Contact::readVCard( file )[0]; 139 new Opie::OPimContactAccessBackend_VCard("today", vfilename ) );
140 if ( acc.load() ) {
141 Opie::OPimContact cont = acc.allRecords()[0];
138 QString returnString = cont.fullName(); 142 QString returnString = cont.fullName();
139 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 143 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
140 } else { 144 } else {
141 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 145 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
142 } 146 }
143} 147}
144 148
145/** 149/**
146 * Set the owner field with a given QString, for example per qcop. 150 * Set the owner field with a given QString, for example per qcop.
147 */ 151 */
148void Today::setOwnerField( QString &message ) { 152void Today::setOwnerField( QString &message ) {
149 if ( !message.isEmpty() ) { 153 if ( !message.isEmpty() ) {
150 OwnerField->setText( "<b>" + message + "</b>" ); 154 OwnerField->setText( "<b>" + message + "</b>" );
151 } 155 }
152} 156}
153 157
154 158
155/** 159/**
156 * Load the plugins 160 * Load the plugins
157 */ 161 */
158void Today::loadPlugins() { 162void Today::loadPlugins() {
159 m_pluginLoader = new OPluginLoader( "today", true ); 163 m_pluginLoader = new OPluginLoader( "today", true );
160 m_pluginLoader->setAutoDelete( true ); 164 m_pluginLoader->setAutoDelete( true );
161 165