summaryrefslogtreecommitdiff
authorzecke <zecke>2005-01-22 11:30:46 (UTC)
committer zecke <zecke>2005-01-22 11:30:46 (UTC)
commit8a0b6e6d1d5043466c4211b2d89da562ab9fd91c (patch) (unidiff)
tree7be6947fe33013cb35b85e4fff6e0093b3557dab
parent55eccecc08f839878e5743d6e6be25af386b5a3f (diff)
downloadopie-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
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiesecurity/multiauthcommon.cpp19
-rw-r--r--libopie2/opiesecurity/multiauthcommon.h3
-rw-r--r--libopie2/opiesecurity/opiesecurity.pro1
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
@@ -1,12 +1,14 @@
1#include "multiauthplugininterface.h" 1#include "multiauthplugininterface.h"
2#include "multiauthcommon.h" 2#include "multiauthcommon.h"
3 3
4/* Opie */ 4/* Opie */
5#include <opie2/odebug.h> 5#include <opie2/odebug.h>
6#include <opie2/oapplication.h> 6#include <opie2/oapplication.h>
7#include <opie2/ocontactaccessbackend_vcard.h>
8#include <opie2/ocontactaccess.h>
7 9
8/* Qt */ 10/* Qt */
9#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
10#include <qpe/qlibrary.h> 12#include <qpe/qlibrary.h>
11#include <qpe/qcom.h> 13#include <qpe/qcom.h>
12#include <qtextview.h> 14#include <qtextview.h>
@@ -16,25 +18,25 @@
16#include <unistd.h> 18#include <unistd.h>
17#include <qpe/config.h> 19#include <qpe/config.h>
18 20
19namespace Opie { 21namespace Opie {
20namespace Security { 22namespace Security {
21 23
22SecOwnerDlg::SecOwnerDlg( QWidget *parent, const char * name, Contact c, 24SecOwnerDlg::SecOwnerDlg( QWidget *parent, const char * name, const QString& c,
23 bool modal, bool fullscreen = FALSE ) 25 bool modal, bool fullscreen = FALSE )
24: QDialog( parent, name, modal, 26: QDialog( parent, name, modal,
25 fullscreen ? 27 fullscreen ?
26 WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop : 0 ) 28 WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop : 0 )
27{ 29{
28 if ( fullscreen ) { 30 if ( fullscreen ) {
29 QRect desk = qApp->desktop()->geometry(); 31 QRect desk = qApp->desktop()->geometry();
30 setGeometry( 0, 0, desk.width(), desk.height() ); 32 setGeometry( 0, 0, desk.width(), desk.height() );
31 } 33 }
32 // set up contents. 34 // set up contents.
33 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>"); 35 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>");
34 text += c.toRichText(); 36 text += c;
35 tv = new QTextView(this); 37 tv = new QTextView(this);
36 tv->setText(text); 38 tv->setText(text);
37 39
38 tv->viewport()->installEventFilter(this); 40 tv->viewport()->installEventFilter(this);
39} 41}
40 42
@@ -60,17 +62,18 @@ namespace Internal {
60int runPlugins() { 62int runPlugins() {
61 63
62 SecOwnerDlg *oi = 0; 64 SecOwnerDlg *oi = 0;
63 // see if there is contact information. 65 // see if there is contact information.
64 QString vfilename = Global::applicationFileName("addressbook", 66 QString vfilename = Global::applicationFileName("addressbook",
65 "businesscard.vcf"); 67 "businesscard.vcf");
66 if (QFile::exists(vfilename)) { 68 Opie::OPimContactAccess acc( "multiauth", vfilename,
67 Contact c; 69 new Opie::OPimContactAccessBackend_VCard( "multiauth", vfilename ) );
68 c = Contact::readVCard( vfilename )[0]; 70 if ( acc.load() ) {
69 71 Opie::OPimContact contact = acc.allRecords()[0];
70 oi = new SecOwnerDlg(0, 0, c, TRUE, TRUE); 72 if ( !contact.isEmpty() )
73 oi = new SecOwnerDlg(0, 0, contact.toRichText(), TRUE, TRUE);
71 } 74 }
72 75
73 Config config("Security"); 76 Config config("Security");
74 config.setGroup("Plugins"); 77 config.setGroup("Plugins");
75 QStringList plugins = config.readListEntry("IncludePlugins", ','); 78 QStringList plugins = config.readListEntry("IncludePlugins", ',');
76 /* if there are no configured plugins, we simply return 0 to 79 /* if there are no configured plugins, we simply return 0 to
@@ -183,13 +186,13 @@ int runPlugins() {
183 } 186 }
184 } else { 187 } else {
185 owarn << "Could not recognize plugin " << QString( path + "/" + *libIt ) << oendl; 188 owarn << "Could not recognize plugin " << QString( path + "/" + *libIt ) << oendl;
186 delete lib; 189 delete lib;
187 } // end if plugin recognized 190 } // end if plugin recognized
188 } //end for 191 } //end for
189 if(oi) delete oi; 192 delete oi;
190 return 1; 193 return 1;
191} 194}
192 195
193} 196}
194} 197}
195} 198}
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
@@ -38,23 +38,22 @@
38/* OwnerDialog stuff */ 38/* OwnerDialog stuff */
39#include <qpe/global.h> 39#include <qpe/global.h>
40#include <qpe/contact.h> 40#include <qpe/contact.h>
41#include <qtextview.h> 41#include <qtextview.h>
42#include <qdialog.h> 42#include <qdialog.h>
43 43
44
45namespace Opie { 44namespace Opie {
46namespace Security { 45namespace Security {
47 46
48/// QDialog simply showing the owner information 47/// QDialog simply showing the owner information
49class SecOwnerDlg : public QDialog 48class SecOwnerDlg : public QDialog
50{ 49{
51 Q_OBJECT 50 Q_OBJECT
52 public: 51 public:
53 52
54 SecOwnerDlg( QWidget *parent, const char * name, Contact c, 53 SecOwnerDlg( QWidget *parent, const char * name, const QString& owner,
55 bool modal, bool fullscreen); 54 bool modal, bool fullscreen);
56 55
57 void resizeEvent( QResizeEvent * ); 56 void resizeEvent( QResizeEvent * );
58 bool eventFilter(QObject *o, QEvent *e); 57 bool eventFilter(QObject *o, QEvent *e);
59 void mousePressEvent( QMouseEvent * ); 58 void mousePressEvent( QMouseEvent * );
60 59
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
@@ -10,8 +10,9 @@ SOURCES = multiauthcommon.cpp \
10 multiauthmainwindow.cpp \ 10 multiauthmainwindow.cpp \
11 multiauthpassword.cpp 11 multiauthpassword.cpp
12TARGET = opiesecurity2 12TARGET = opiesecurity2
13VERSION = 0.0.2 13VERSION = 0.0.2
14INCLUDEPATH += $(OPIEDIR)/include 14INCLUDEPATH += $(OPIEDIR)/include
15DEPENDPATH += $(OPIEDIR)/include 15DEPENDPATH += $(OPIEDIR)/include
16LIBS += -lopiepim2
16 17
17include( $(OPIEDIR)/include.pro ) 18include( $(OPIEDIR)/include.pro )