author | gints <gints> | 2005-05-13 17:30:15 (UTC) |
---|---|---|
committer | gints <gints> | 2005-05-13 17:30:15 (UTC) |
commit | 4451abf402aa1dd967ef8b70a7eba1192f13afb0 (patch) (unidiff) | |
tree | 985405c7a3fe121103114eaebf3f87603894672d | |
parent | b010c50f099d197c0a89755eeef4dc1e40559a83 (diff) | |
download | opie-4451abf402aa1dd967ef8b70a7eba1192f13afb0.zip opie-4451abf402aa1dd967ef8b70a7eba1192f13afb0.tar.gz opie-4451abf402aa1dd967ef8b70a7eba1192f13afb0.tar.bz2 |
Remove latinism in today owner information - bug 1655
-rw-r--r-- | core/pim/today/today.cpp | 12 |
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 | |||
@@ -1,201 +1,205 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> | 4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
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 | ||
47 | using namespace Opie::Ui; | 49 | using namespace Opie::Ui; |
48 | using Opie::Core::OPluginItem; | 50 | using Opie::Core::OPluginItem; |
49 | using Opie::Core::OPluginLoader; | 51 | using Opie::Core::OPluginLoader; |
50 | using Opie::Core::OPluginManager; | 52 | using Opie::Core::OPluginManager; |
51 | using Opie::Core::OConfig; | 53 | using Opie::Core::OConfig; |
52 | 54 | ||
53 | 55 | ||
54 | struct TodayPlugin { | 56 | struct TodayPlugin { |
55 | TodayPlugin() : iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} | 57 | TodayPlugin() : 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 | ||
64 | static QMap<QString, TodayPlugin> pluginList; | 66 | static QMap<QString, TodayPlugin> pluginList; |
65 | 67 | ||
66 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 68 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
67 | : TodayBase( parent, name, fl | WStyle_ContextHelp) { | 69 | : TodayBase( parent, name, fl | WStyle_ContextHelp) { |
68 | 70 | ||
69 | setCaption( tr("Today") ); | 71 | setCaption( tr("Today") ); |
70 | connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 72 | connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
71 | connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 73 | connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
72 | 74 | ||
73 | #if !defined(QT_NO_COP) | 75 | #if !defined(QT_NO_COP) |
74 | 76 | ||
75 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 77 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
76 | connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 78 | connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
77 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); | 79 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); |
78 | #endif | 80 | #endif |
79 | 81 | ||
80 | setOwnerField(); | 82 | setOwnerField(); |
81 | m_big_box = 0l; | 83 | m_big_box = 0l; |
82 | m_bblayout = 0l; | 84 | m_bblayout = 0l; |
83 | 85 | ||
84 | layout = new QVBoxLayout( this ); | 86 | layout = new QVBoxLayout( this ); |
85 | layout->addWidget( Frame ); | 87 | layout->addWidget( Frame ); |
86 | layout->addWidget( OwnerField ); | 88 | layout->addWidget( OwnerField ); |
87 | 89 | ||
88 | 90 | ||
89 | m_informationLabel = new QLabel( tr("No plugins activated"), this ); | 91 | m_informationLabel = new QLabel( tr("No plugins activated"), this ); |
90 | layout->addWidget( m_informationLabel ); | 92 | layout->addWidget( m_informationLabel ); |
91 | 93 | ||
92 | m_sv = new QScrollView( this ); | 94 | m_sv = new QScrollView( this ); |
93 | m_sv->setResizePolicy( QScrollView::AutoOneFit ); | 95 | m_sv->setResizePolicy( QScrollView::AutoOneFit ); |
94 | m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 96 | m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
95 | m_sv->setFrameShape( QFrame::NoFrame ); | 97 | m_sv->setFrameShape( QFrame::NoFrame ); |
96 | 98 | ||
97 | layout->addWidget( m_sv ); | 99 | layout->addWidget( m_sv ); |
98 | layout->setStretchFactor( m_sv,4 ); | 100 | layout->setStretchFactor( m_sv,4 ); |
99 | 101 | ||
100 | m_refreshTimer = new QTimer( this ); | 102 | m_refreshTimer = new QTimer( this ); |
101 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 103 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
102 | 104 | ||
103 | loadPlugins(); | 105 | loadPlugins(); |
104 | loadShellContent(); | 106 | loadShellContent(); |
105 | loadPluginWidgets(); | 107 | loadPluginWidgets(); |
106 | } | 108 | } |
107 | 109 | ||
108 | /** | 110 | /** |
109 | * Qcop receive method. | 111 | * Qcop receive method. |
110 | */ | 112 | */ |
111 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 113 | void 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 | ||
120 | void Today::setRefreshTimer( int interval ) { | 122 | void 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 | */ |
134 | void Today::setOwnerField() { | 136 | void 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 | */ |
148 | void Today::setOwnerField( QString &message ) { | 152 | void 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 | */ |
158 | void Today::loadPlugins() { | 162 | void 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 | ||
162 | m_manager = new OPluginManager( m_pluginLoader ); | 166 | m_manager = new OPluginManager( m_pluginLoader ); |
163 | m_manager->load(); | 167 | m_manager->load(); |
164 | } | 168 | } |
165 | 169 | ||
166 | void Today::loadShellContent() { | 170 | void Today::loadShellContent() { |
167 | Config cfg( "today" ); | 171 | Config cfg( "today" ); |
168 | cfg.setGroup( "Plugins" ); | 172 | cfg.setGroup( "Plugins" ); |
169 | 173 | ||
170 | 174 | ||
171 | cfg.setGroup( "General" ); | 175 | cfg.setGroup( "General" ); |
172 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 176 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
173 | m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); | 177 | m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); |
174 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); | 178 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); |
175 | 179 | ||
176 | // set the date in top label | 180 | // set the date in top label |
177 | QDate date = QDate::currentDate(); | 181 | QDate date = QDate::currentDate(); |
178 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); | 182 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); |
179 | 183 | ||
180 | if ( m_hideBanner ) { | 184 | if ( m_hideBanner ) { |
181 | Opiezilla->hide(); | 185 | Opiezilla->hide(); |
182 | TodayLabel->hide(); | 186 | TodayLabel->hide(); |
183 | } else { | 187 | } else { |
184 | Opiezilla->show(); | 188 | Opiezilla->show(); |
185 | TodayLabel->show(); | 189 | TodayLabel->show(); |
186 | } | 190 | } |
187 | } | 191 | } |
188 | 192 | ||
189 | void Today::loadPluginWidgets() { | 193 | void Today::loadPluginWidgets() { |
190 | /* | 194 | /* |
191 | * check if loading of Plugins crashed | 195 | * check if loading of Plugins crashed |
192 | */ | 196 | */ |
193 | if( m_pluginLoader->isInSafeMode() ) { | 197 | if( m_pluginLoader->isInSafeMode() ) { |
194 | QMessageBox::information(this, tr("Today Error"), | 198 | QMessageBox::information(this, tr("Today Error"), |
195 | tr("<qt>The plugin '%1' caused Today to crash." | 199 | tr("<qt>The plugin '%1' caused Today to crash." |
196 | " It could be that the plugin is not properly" | 200 | " It could be that the plugin is not properly" |
197 | " installed.<br>Today tries to continue loading" | 201 | " installed.<br>Today tries to continue loading" |
198 | " plugins.</qt>") | 202 | " plugins.</qt>") |
199 | .arg( m_manager->crashedPlugin().name())); | 203 | .arg( m_manager->crashedPlugin().name())); |
200 | } | 204 | } |
201 | 205 | ||