author | zecke <zecke> | 2005-01-22 11:30:46 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-01-22 11:30:46 (UTC) |
commit | 8a0b6e6d1d5043466c4211b2d89da562ab9fd91c (patch) (side-by-side diff) | |
tree | 7be6947fe33013cb35b85e4fff6e0093b3557dab | |
parent | 55eccecc08f839878e5743d6e6be25af386b5a3f (diff) | |
download | opie-8a0b6e6d1d5043466c4211b2d89da562ab9fd91c.zip opie-8a0b6e6d1d5043466c4211b2d89da562ab9fd91c.tar.gz opie-8a0b6e6d1d5043466c4211b2d89da562ab9fd91c.tar.bz2 |
-Fix for #1533
Use OPimContactAccess to load the Owner Information. This should
fix the displaying of the contact for non latin1 encoded users.
To use OPimContactAccess OpieSecurity now depends on opiepim2
-rw-r--r-- | libopie2/opiesecurity/multiauthcommon.cpp | 19 | ||||
-rw-r--r-- | libopie2/opiesecurity/multiauthcommon.h | 3 | ||||
-rw-r--r-- | libopie2/opiesecurity/opiesecurity.pro | 1 |
3 files changed, 13 insertions, 10 deletions
diff --git a/libopie2/opiesecurity/multiauthcommon.cpp b/libopie2/opiesecurity/multiauthcommon.cpp index e563193..2760760 100644 --- a/libopie2/opiesecurity/multiauthcommon.cpp +++ b/libopie2/opiesecurity/multiauthcommon.cpp @@ -4,6 +4,8 @@ /* Opie */ #include <opie2/odebug.h> #include <opie2/oapplication.h> +#include <opie2/ocontactaccessbackend_vcard.h> +#include <opie2/ocontactaccess.h> /* Qt */ #include <qpe/qpeapplication.h> @@ -19,7 +21,7 @@ namespace Opie { namespace Security { -SecOwnerDlg::SecOwnerDlg( QWidget *parent, const char * name, Contact c, +SecOwnerDlg::SecOwnerDlg( QWidget *parent, const char * name, const QString& c, bool modal, bool fullscreen = FALSE ) : QDialog( parent, name, modal, fullscreen ? @@ -31,7 +33,7 @@ SecOwnerDlg::SecOwnerDlg( QWidget *parent, const char * name, Contact c, } // set up contents. QString text("<H3>" + tr("Please contact the owner (directions follow), or try again clicking of this screen (and waiting for the penalty time) if you are the legitimate owner") + "</H3>"); - text += c.toRichText(); + text += c; tv = new QTextView(this); tv->setText(text); @@ -63,11 +65,12 @@ int runPlugins() { // see if there is contact information. QString vfilename = Global::applicationFileName("addressbook", "businesscard.vcf"); - if (QFile::exists(vfilename)) { - Contact c; - c = Contact::readVCard( vfilename )[0]; - - oi = new SecOwnerDlg(0, 0, c, TRUE, TRUE); + Opie::OPimContactAccess acc( "multiauth", vfilename, + new Opie::OPimContactAccessBackend_VCard( "multiauth", vfilename ) ); + if ( acc.load() ) { + Opie::OPimContact contact = acc.allRecords()[0]; + if ( !contact.isEmpty() ) + oi = new SecOwnerDlg(0, 0, contact.toRichText(), TRUE, TRUE); } Config config("Security"); @@ -186,7 +189,7 @@ int runPlugins() { delete lib; } // end if plugin recognized } //end for - if(oi) delete oi; + delete oi; return 1; } diff --git a/libopie2/opiesecurity/multiauthcommon.h b/libopie2/opiesecurity/multiauthcommon.h index b728dae..42dff17 100644 --- a/libopie2/opiesecurity/multiauthcommon.h +++ b/libopie2/opiesecurity/multiauthcommon.h @@ -41,7 +41,6 @@ #include <qtextview.h> #include <qdialog.h> - namespace Opie { namespace Security { @@ -51,7 +50,7 @@ class SecOwnerDlg : public QDialog Q_OBJECT public: - SecOwnerDlg( QWidget *parent, const char * name, Contact c, + SecOwnerDlg( QWidget *parent, const char * name, const QString& owner, bool modal, bool fullscreen); void resizeEvent( QResizeEvent * ); diff --git a/libopie2/opiesecurity/opiesecurity.pro b/libopie2/opiesecurity/opiesecurity.pro index 7171e67..d4d7925 100644 --- a/libopie2/opiesecurity/opiesecurity.pro +++ b/libopie2/opiesecurity/opiesecurity.pro @@ -13,5 +13,6 @@ TARGET = opiesecurity2 VERSION = 0.0.2 INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include +LIBS += -lopiepim2 include( $(OPIEDIR)/include.pro ) |