author | gints <gints> | 2005-05-13 17:30:15 (UTC) |
---|---|---|
committer | gints <gints> | 2005-05-13 17:30:15 (UTC) |
commit | 4451abf402aa1dd967ef8b70a7eba1192f13afb0 (patch) (side-by-side diff) | |
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 @@ /* This file is part of the Opie Project Copyright (C) Maximilian Reiss <harlekin@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "today.h" #include <opie2/odebug.h> #include <opie2/opluginloader.h> +#include <opie2/opimcontact.h> +#include <opie2/ocontactaccessbackend_vcard.h> +#include <opie2/ocontactaccess.h> #include <opie2/oconfig.h> #include <opie2/oresource.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> -#include <qpe/contact.h> #include <qdir.h> #include <qtimer.h> #include <qwhatsthis.h> #include <qmessagebox.h> using namespace Opie::Ui; using Opie::Core::OPluginItem; using Opie::Core::OPluginLoader; using Opie::Core::OPluginManager; using Opie::Core::OConfig; struct TodayPlugin { TodayPlugin() : iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} QInterfacePtr<TodayPluginInterface> iface; TodayPluginObject *guiPart; OPluginItem oplugin; QWidget *guiBox; QString name; bool excludeRefresh; }; static QMap<QString, TodayPlugin> pluginList; Today::Today( QWidget* parent, const char* name, WFlags fl ) : TodayBase( parent, name, fl | WStyle_ContextHelp) { setCaption( tr("Today") ); connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); #if !defined(QT_NO_COP) QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); #endif setOwnerField(); m_big_box = 0l; m_bblayout = 0l; layout = new QVBoxLayout( this ); layout->addWidget( Frame ); layout->addWidget( OwnerField ); m_informationLabel = new QLabel( tr("No plugins activated"), this ); layout->addWidget( m_informationLabel ); m_sv = new QScrollView( this ); m_sv->setResizePolicy( QScrollView::AutoOneFit ); m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); m_sv->setFrameShape( QFrame::NoFrame ); layout->addWidget( m_sv ); layout->setStretchFactor( m_sv,4 ); m_refreshTimer = new QTimer( this ); connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); loadPlugins(); loadShellContent(); loadPluginWidgets(); } /** * Qcop receive method. */ void Today::channelReceived( const QCString &msg, const QByteArray & data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "message(QString)" ) { QString message; stream >> message; setOwnerField( message ); } } void Today::setRefreshTimer( int interval ) { disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); // 0 is "never" case if ( !interval == 0 ) { connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); m_refreshTimer->changeInterval( interval ); } } /** * Initialises the owner field with the default value, the username */ void Today::setOwnerField() { - QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); - if ( QFile::exists( file ) ) { - Contact cont = Contact::readVCard( file )[0]; + QString vfilename = Global::applicationFileName("addressbook", "businesscard.vcf"); + Opie::OPimContactAccess acc( "today", vfilename, + new Opie::OPimContactAccessBackend_VCard("today", vfilename ) ); + if ( acc.load() ) { + Opie::OPimContact cont = acc.allRecords()[0]; QString returnString = cont.fullName(); OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); } else { OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); } } /** * Set the owner field with a given QString, for example per qcop. */ void Today::setOwnerField( QString &message ) { if ( !message.isEmpty() ) { OwnerField->setText( "<b>" + message + "</b>" ); } } /** * Load the plugins */ void Today::loadPlugins() { m_pluginLoader = new OPluginLoader( "today", true ); m_pluginLoader->setAutoDelete( true ); m_manager = new OPluginManager( m_pluginLoader ); m_manager->load(); } void Today::loadShellContent() { Config cfg( "today" ); cfg.setGroup( "Plugins" ); cfg.setGroup( "General" ); m_iconSize = cfg.readNumEntry( "IconSize", 18 ); m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); // set the date in top label QDate date = QDate::currentDate(); DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); if ( m_hideBanner ) { Opiezilla->hide(); TodayLabel->hide(); } else { Opiezilla->show(); TodayLabel->show(); } } void Today::loadPluginWidgets() { /* * check if loading of Plugins crashed */ if( m_pluginLoader->isInSafeMode() ) { QMessageBox::information(this, tr("Today Error"), tr("<qt>The plugin '%1' caused Today to crash." " It could be that the plugin is not properly" " installed.<br>Today tries to continue loading" " plugins.</qt>") .arg( m_manager->crashedPlugin().name())); } |