author | zecke <zecke> | 2004-10-16 00:01:01 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-16 00:01:01 (UTC) |
commit | df14f647ff1a60ca82e0fa9bd91458be146153b8 (patch) (unidiff) | |
tree | 4859961352851a4392e1442f2080c15bff8ad7bc /libopie2 | |
parent | 419f9710c488f56a7a117eb1529970d3371e0094 (diff) | |
download | opie-df14f647ff1a60ca82e0fa9bd91458be146153b8.zip opie-df14f647ff1a60ca82e0fa9bd91458be146153b8.tar.gz opie-df14f647ff1a60ca82e0fa9bd91458be146153b8.tar.bz2 |
Replace QPEApplication::qpeDir() + "/ with
QPEApplication::qpeDir() + "
as it is guranteed that qpeDir() will have '/' as the last
charachter
-rw-r--r-- | libopie2/opiecore/opluginloader.cpp | 4 | ||||
-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiesecurity/multiauthcommon.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/libopie2/opiecore/opluginloader.cpp b/libopie2/opiecore/opluginloader.cpp index 2a6e369..d33eac6 100644 --- a/libopie2/opiecore/opluginloader.cpp +++ b/libopie2/opiecore/opluginloader.cpp | |||
@@ -428,97 +428,97 @@ QUnknownInterface* OGenericPluginLoader::load( const OPluginItem& item, const QU | |||
428 | */ | 428 | */ |
429 | setSafeMode( pa, true ); | 429 | setSafeMode( pa, true ); |
430 | QLibrary *lib = Internal::OPluginLibraryHolder::self()->ref( pa ); | 430 | QLibrary *lib = Internal::OPluginLibraryHolder::self()->ref( pa ); |
431 | if ( !lib ) { | 431 | if ( !lib ) { |
432 | setSafeMode(); | 432 | setSafeMode(); |
433 | return 0l; | 433 | return 0l; |
434 | } | 434 | } |
435 | 435 | ||
436 | /** | 436 | /** |
437 | * try to load the plugin and just in case initialize the pointer to a pointer again | 437 | * try to load the plugin and just in case initialize the pointer to a pointer again |
438 | */ | 438 | */ |
439 | QUnknownInterface* iface=0; | 439 | QUnknownInterface* iface=0; |
440 | if ( lib->queryInterface( uuid, &iface ) == QS_OK ) { | 440 | if ( lib->queryInterface( uuid, &iface ) == QS_OK ) { |
441 | installTranslators( item.name() ); | 441 | installTranslators( item.name() ); |
442 | m_library.insert( iface, lib ); | 442 | m_library.insert( iface, lib ); |
443 | }else | 443 | }else |
444 | iface = 0; | 444 | iface = 0; |
445 | 445 | ||
446 | setSafeMode(); | 446 | setSafeMode(); |
447 | 447 | ||
448 | return iface; | 448 | return iface; |
449 | } | 449 | } |
450 | 450 | ||
451 | /** | 451 | /** |
452 | * @internal and reads in the safe mode | 452 | * @internal and reads in the safe mode |
453 | */ | 453 | */ |
454 | void OGenericPluginLoader::readConfig() { | 454 | void OGenericPluginLoader::readConfig() { |
455 | 455 | ||
456 | 456 | ||
457 | /* read the config for SafeMode */ | 457 | /* read the config for SafeMode */ |
458 | OConfig conf( m_dir + "-odpplugins" ); | 458 | OConfig conf( m_dir + "-odpplugins" ); |
459 | conf.setGroup( "General" ); | 459 | conf.setGroup( "General" ); |
460 | m_isSafeMode = conf.readBoolEntry( "SafeMode", false ); | 460 | m_isSafeMode = conf.readBoolEntry( "SafeMode", false ); |
461 | } | 461 | } |
462 | 462 | ||
463 | /** | 463 | /** |
464 | * @internal Enter or leave SafeMode | 464 | * @internal Enter or leave SafeMode |
465 | */ | 465 | */ |
466 | void OGenericPluginLoader::setSafeMode(const QString& str, bool b) { | 466 | void OGenericPluginLoader::setSafeMode(const QString& str, bool b) { |
467 | OConfig conf( m_dir + "-odpplugins" ); | 467 | OConfig conf( m_dir + "-odpplugins" ); |
468 | conf.setGroup( "General" ); | 468 | conf.setGroup( "General" ); |
469 | conf.writeEntry( "SafeMode", b ); | 469 | conf.writeEntry( "SafeMode", b ); |
470 | conf.writeEntry( "CrashedPlugin", str ); | 470 | conf.writeEntry( "CrashedPlugin", str ); |
471 | } | 471 | } |
472 | 472 | ||
473 | /** | 473 | /** |
474 | * @internal | 474 | * @internal |
475 | * | 475 | * |
476 | * Set the List of Plugin Dirs to lst. Currently only QPEApplication::qpeDir()+"/plugins/"+mytype | 476 | * Set the List of Plugin Dirs to lst. Currently only QPEApplication::qpeDir()+"plugins/"+mytype |
477 | * is used as plugin dir | 477 | * is used as plugin dir |
478 | */ | 478 | */ |
479 | void OGenericPluginLoader::setPluginDirs( const QStringList& lst ) { | 479 | void OGenericPluginLoader::setPluginDirs( const QStringList& lst ) { |
480 | m_plugDirs = lst; | 480 | m_plugDirs = lst; |
481 | } | 481 | } |
482 | 482 | ||
483 | /** | 483 | /** |
484 | * | 484 | * |
485 | * @internal | 485 | * @internal |
486 | * Set the Plugin Dir to str. Str will be the only element in the list of plugin dirs | 486 | * Set the Plugin Dir to str. Str will be the only element in the list of plugin dirs |
487 | */ | 487 | */ |
488 | void OGenericPluginLoader::setPluginDir( const QString& str) { | 488 | void OGenericPluginLoader::setPluginDir( const QString& str) { |
489 | m_plugDirs.clear(); | 489 | m_plugDirs.clear(); |
490 | m_plugDirs.append( str ); | 490 | m_plugDirs.append( str ); |
491 | } | 491 | } |
492 | 492 | ||
493 | 493 | ||
494 | /** | 494 | /** |
495 | * @internal | 495 | * @internal |
496 | */ | 496 | */ |
497 | bool OGenericPluginLoader::isSorted()const{ | 497 | bool OGenericPluginLoader::isSorted()const{ |
498 | return m_isSorted; | 498 | return m_isSorted; |
499 | } | 499 | } |
500 | 500 | ||
501 | /* | 501 | /* |
502 | * make libfoo.so.1.0.0 -> foo on UNIX | 502 | * make libfoo.so.1.0.0 -> foo on UNIX |
503 | * make libfoo.dylib -> foo on MAC OS X Unix | 503 | * make libfoo.dylib -> foo on MAC OS X Unix |
504 | * windows is obviously missing | 504 | * windows is obviously missing |
505 | */ | 505 | */ |
506 | /** | 506 | /** |
507 | * @internal | 507 | * @internal |
508 | */ | 508 | */ |
509 | QString OGenericPluginLoader::unlibify( const QString& str ) { | 509 | QString OGenericPluginLoader::unlibify( const QString& str ) { |
510 | QString st = str.mid( str.find( "lib" )+3 ); | 510 | QString st = str.mid( str.find( "lib" )+3 ); |
511 | #ifdef Q_OS_MACX | 511 | #ifdef Q_OS_MACX |
512 | return st.left( st.findRev( ".dylib" ) ); | 512 | return st.left( st.findRev( ".dylib" ) ); |
513 | #else | 513 | #else |
514 | return st.left( st.findRev( ".so" ) ); | 514 | return st.left( st.findRev( ".so" ) ); |
515 | #endif | 515 | #endif |
516 | } | 516 | } |
517 | 517 | ||
518 | /** | 518 | /** |
519 | * @internal | 519 | * @internal |
520 | * | 520 | * |
521 | * \brief method to return available plugins. Internal and for reeimplementations | 521 | * \brief method to return available plugins. Internal and for reeimplementations |
522 | * | 522 | * |
523 | *Return a List of Plugins for a dir and add positions and remove disabled. | 523 | *Return a List of Plugins for a dir and add positions and remove disabled. |
524 | * If a plugin is on the excluded list assign position -2 | 524 | * If a plugin is on the excluded list assign position -2 |
@@ -593,97 +593,97 @@ OPluginItem::List OGenericPluginLoader::plugins( const QString& _dir, bool sorte | |||
593 | } | 593 | } |
594 | 594 | ||
595 | return lst; | 595 | return lst; |
596 | } | 596 | } |
597 | 597 | ||
598 | /** | 598 | /** |
599 | * @internal generate a list of languages from $LANG | 599 | * @internal generate a list of languages from $LANG |
600 | */ | 600 | */ |
601 | QStringList OGenericPluginLoader::languageList() { | 601 | QStringList OGenericPluginLoader::languageList() { |
602 | if ( m_languages.isEmpty() ) { | 602 | if ( m_languages.isEmpty() ) { |
603 | /* | 603 | /* |
604 | * be_BY.CP1251 We will add, be_BY.CP1251,be_BY,be | 604 | * be_BY.CP1251 We will add, be_BY.CP1251,be_BY,be |
605 | * to our list of languages. | 605 | * to our list of languages. |
606 | * Also for de_DE@euro we will add de_DE@eurp, de_DE, de | 606 | * Also for de_DE@euro we will add de_DE@eurp, de_DE, de |
607 | * to our list of languages | 607 | * to our list of languages |
608 | */ | 608 | */ |
609 | QString str = ::getenv( "LANG" ); | 609 | QString str = ::getenv( "LANG" ); |
610 | m_languages += str; | 610 | m_languages += str; |
611 | int pos = str.find( '@' ); | 611 | int pos = str.find( '@' ); |
612 | if( pos > 0 ) | 612 | if( pos > 0 ) |
613 | m_languages += str.left( pos ); | 613 | m_languages += str.left( pos ); |
614 | 614 | ||
615 | 615 | ||
616 | pos = str.find( '.' ); | 616 | pos = str.find( '.' ); |
617 | if ( pos > 0 ) | 617 | if ( pos > 0 ) |
618 | m_languages += str.left( pos ); | 618 | m_languages += str.left( pos ); |
619 | 619 | ||
620 | int n_pos = str.find( '_' ); | 620 | int n_pos = str.find( '_' ); |
621 | if ( n_pos > 0 ) | 621 | if ( n_pos > 0 ) |
622 | m_languages += str.left( n_pos ); | 622 | m_languages += str.left( n_pos ); |
623 | 623 | ||
624 | } | 624 | } |
625 | return m_languages; | 625 | return m_languages; |
626 | } | 626 | } |
627 | 627 | ||
628 | /** | 628 | /** |
629 | * @internal | 629 | * @internal |
630 | * Tries to install languages using the languageList for the type | 630 | * Tries to install languages using the languageList for the type |
631 | */ | 631 | */ |
632 | void OGenericPluginLoader::installTranslators(const QString& type) { | 632 | void OGenericPluginLoader::installTranslators(const QString& type) { |
633 | QStringList lst = languageList(); | 633 | QStringList lst = languageList(); |
634 | 634 | ||
635 | /* | 635 | /* |
636 | * for each language and maybe later for each language dir... | 636 | * for each language and maybe later for each language dir... |
637 | * try to load a Translator | 637 | * try to load a Translator |
638 | */ | 638 | */ |
639 | for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 639 | for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
640 | QTranslator* trans = new QTranslator( qApp ); | 640 | QTranslator* trans = new QTranslator( qApp ); |
641 | QString tfn = QPEApplication::qpeDir()+"/i18n/" + *it + "/lib" + type + ".qm" ; | 641 | QString tfn = QPEApplication::qpeDir()+"i18n/" + *it + "/lib" + type + ".qm" ; |
642 | 642 | ||
643 | /* | 643 | /* |
644 | * If loaded then install else clean up and don't leak | 644 | * If loaded then install else clean up and don't leak |
645 | */ | 645 | */ |
646 | if ( trans->load( tfn ) ) | 646 | if ( trans->load( tfn ) ) |
647 | qApp->installTranslator( trans ); | 647 | qApp->installTranslator( trans ); |
648 | else | 648 | else |
649 | delete trans; | 649 | delete trans; |
650 | } | 650 | } |
651 | } | 651 | } |
652 | 652 | ||
653 | /** | 653 | /** |
654 | * \brief Simple c'tor. | 654 | * \brief Simple c'tor. |
655 | * | 655 | * |
656 | * Simple C'tor same as the one of the base class. Additional this | 656 | * Simple C'tor same as the one of the base class. Additional this |
657 | * class can cast for you if you nee it. | 657 | * class can cast for you if you nee it. |
658 | * | 658 | * |
659 | * | 659 | * |
660 | * @param name The name of your plugin class | 660 | * @param name The name of your plugin class |
661 | * @param sorted If plugins are sorted | 661 | * @param sorted If plugins are sorted |
662 | * | 662 | * |
663 | * @see OGenericPluginLoader | 663 | * @see OGenericPluginLoader |
664 | */ | 664 | */ |
665 | OPluginLoader::OPluginLoader( const QString& name, bool sorted ) | 665 | OPluginLoader::OPluginLoader( const QString& name, bool sorted ) |
666 | : OGenericPluginLoader( name, sorted ) | 666 | : OGenericPluginLoader( name, sorted ) |
667 | { | 667 | { |
668 | } | 668 | } |
669 | 669 | ||
670 | /** | 670 | /** |
671 | * d'tor | 671 | * d'tor |
672 | * @see OGenericPluginLoader::~OGenericPluginLoader | 672 | * @see OGenericPluginLoader::~OGenericPluginLoader |
673 | */ | 673 | */ |
674 | OPluginLoader::~OPluginLoader() { | 674 | OPluginLoader::~OPluginLoader() { |
675 | } | 675 | } |
676 | 676 | ||
677 | /** | 677 | /** |
678 | * \brief C'Tor using a OGenericPluginLoader | 678 | * \brief C'Tor using a OGenericPluginLoader |
679 | * The C'tor. Pass your OGenericPluginLoader to manage | 679 | * The C'tor. Pass your OGenericPluginLoader to manage |
680 | * OGenericPluginLoader::allAvailable plugins. | 680 | * OGenericPluginLoader::allAvailable plugins. |
681 | * | 681 | * |
682 | * | 682 | * |
683 | * @param loader A Pointer to your OGenericPluginLoader | 683 | * @param loader A Pointer to your OGenericPluginLoader |
684 | */ | 684 | */ |
685 | OPluginManager::OPluginManager( OGenericPluginLoader* loader) | 685 | OPluginManager::OPluginManager( OGenericPluginLoader* loader) |
686 | : m_loader( loader ), m_isSorted( false ) | 686 | : m_loader( loader ), m_isSorted( false ) |
687 | { | 687 | { |
688 | } | 688 | } |
689 | 689 | ||
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index 32bae0a..7e185a2 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -25,97 +25,97 @@ | |||
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "omanufacturerdb.h" | 29 | #include "omanufacturerdb.h" |
30 | 30 | ||
31 | #define OPIE_IMPROVE_GUI_LATENCY 1 | 31 | #define OPIE_IMPROVE_GUI_LATENCY 1 |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 36 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
37 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | 40 | ||
41 | 41 | ||
42 | /* QT */ | 42 | /* QT */ |
43 | #include <qapplication.h> | 43 | #include <qapplication.h> |
44 | #include <qfile.h> | 44 | #include <qfile.h> |
45 | #include <qtextstream.h> | 45 | #include <qtextstream.h> |
46 | 46 | ||
47 | using namespace Opie::Core; | 47 | using namespace Opie::Core; |
48 | namespace Opie { | 48 | namespace Opie { |
49 | namespace Net { | 49 | namespace Net { |
50 | 50 | ||
51 | OManufacturerDB* OManufacturerDB::_instance = 0; | 51 | OManufacturerDB* OManufacturerDB::_instance = 0; |
52 | 52 | ||
53 | OManufacturerDB* OManufacturerDB::instance() | 53 | OManufacturerDB* OManufacturerDB::instance() |
54 | { | 54 | { |
55 | if ( !OManufacturerDB::_instance ) | 55 | if ( !OManufacturerDB::_instance ) |
56 | { | 56 | { |
57 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; | 57 | odebug << "OManufacturerDB::instance(): creating OManufacturerDB..." << oendl; |
58 | _instance = new OManufacturerDB(); | 58 | _instance = new OManufacturerDB(); |
59 | } | 59 | } |
60 | return _instance; | 60 | return _instance; |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | OManufacturerDB::OManufacturerDB() | 64 | OManufacturerDB::OManufacturerDB() |
65 | { | 65 | { |
66 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 66 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
67 | Global::statusMessage( "Reading Manufacturers..." ); | 67 | Global::statusMessage( "Reading Manufacturers..." ); |
68 | #endif | 68 | #endif |
69 | QString filename( "/etc/manufacturers" ); | 69 | QString filename( "/etc/manufacturers" ); |
70 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 70 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
71 | if ( !QFile::exists( filename ) ) | 71 | if ( !QFile::exists( filename ) ) |
72 | { | 72 | { |
73 | filename = QPEApplication::qpeDir()+"/etc/manufacturers"; | 73 | filename = QPEApplication::qpeDir()+"etc/manufacturers"; |
74 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 74 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
75 | if ( !QFile::exists( filename ) ) | 75 | if ( !QFile::exists( filename ) ) |
76 | { | 76 | { |
77 | filename = "/usr/share/wellenreiter/manufacturers"; | 77 | filename = "/usr/share/wellenreiter/manufacturers"; |
78 | odebug << "OManufacturerDB: trying to read " << filename << oendl; | 78 | odebug << "OManufacturerDB: trying to read " << filename << oendl; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | QFile file( filename ); | 82 | QFile file( filename ); |
83 | bool hasFile = file.open( IO_ReadOnly ); | 83 | bool hasFile = file.open( IO_ReadOnly ); |
84 | if (!hasFile) | 84 | if (!hasFile) |
85 | { | 85 | { |
86 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; | 86 | owarn << "OManufacturerDB: no valid manufacturer list found." << oendl; |
87 | } | 87 | } |
88 | else | 88 | else |
89 | { | 89 | { |
90 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; | 90 | odebug << "OManufacturerDB: found manufacturer list in " << filename << oendl; |
91 | QTextStream s( &file ); | 91 | QTextStream s( &file ); |
92 | QString addr; | 92 | QString addr; |
93 | QString manu; | 93 | QString manu; |
94 | QString extManu; | 94 | QString extManu; |
95 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 95 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
96 | int counter = 0; | 96 | int counter = 0; |
97 | #endif | 97 | #endif |
98 | while (!s.atEnd()) | 98 | while (!s.atEnd()) |
99 | { | 99 | { |
100 | s >> addr; | 100 | s >> addr; |
101 | s >> manu; | 101 | s >> manu; |
102 | s >> extManu; | 102 | s >> extManu; |
103 | 103 | ||
104 | manufacturers.insert( addr, manu ); | 104 | manufacturers.insert( addr, manu ); |
105 | manufacturersExt.insert( addr, extManu ); | 105 | manufacturersExt.insert( addr, extManu ); |
106 | // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; | 106 | // odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; |
107 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 107 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
108 | counter++; | 108 | counter++; |
109 | if ( counter == 50 ) | 109 | if ( counter == 50 ) |
110 | { | 110 | { |
111 | qApp->processEvents(); | 111 | qApp->processEvents(); |
112 | counter = 0; | 112 | counter = 0; |
113 | } | 113 | } |
114 | #endif | 114 | #endif |
115 | } | 115 | } |
116 | odebug << "OManufacturerDB: manufacturer list completed." << oendl; | 116 | odebug << "OManufacturerDB: manufacturer list completed." << oendl; |
117 | #ifdef OPIE_IMPROVE_GUI_LATENCY | 117 | #ifdef OPIE_IMPROVE_GUI_LATENCY |
118 | Global::statusMessage( "Manufacturers Complete..." ); | 118 | Global::statusMessage( "Manufacturers Complete..." ); |
119 | #endif | 119 | #endif |
120 | } | 120 | } |
121 | } | 121 | } |
diff --git a/libopie2/opiesecurity/multiauthcommon.cpp b/libopie2/opiesecurity/multiauthcommon.cpp index 9de62d2..e563193 100644 --- a/libopie2/opiesecurity/multiauthcommon.cpp +++ b/libopie2/opiesecurity/multiauthcommon.cpp | |||
@@ -44,97 +44,97 @@ void SecOwnerDlg::resizeEvent( QResizeEvent * ) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | bool SecOwnerDlg::eventFilter(QObject *o, QEvent *e) | 46 | bool SecOwnerDlg::eventFilter(QObject *o, QEvent *e) |
47 | { | 47 | { |
48 | if (e->type() == QEvent::KeyPress || e->type() == QEvent::MouseButtonPress ) { | 48 | if (e->type() == QEvent::KeyPress || e->type() == QEvent::MouseButtonPress ) { |
49 | accept(); | 49 | accept(); |
50 | return TRUE; | 50 | return TRUE; |
51 | } | 51 | } |
52 | return QWidget::eventFilter(o, e); | 52 | return QWidget::eventFilter(o, e); |
53 | } | 53 | } |
54 | 54 | ||
55 | void SecOwnerDlg::mousePressEvent( QMouseEvent * ) { accept(); } | 55 | void SecOwnerDlg::mousePressEvent( QMouseEvent * ) { accept(); } |
56 | 56 | ||
57 | 57 | ||
58 | namespace Internal { | 58 | namespace Internal { |
59 | /// run plugins until we reach nbSuccessMin successes | 59 | /// run plugins until we reach nbSuccessMin successes |
60 | int runPlugins() { | 60 | int runPlugins() { |
61 | 61 | ||
62 | SecOwnerDlg *oi = 0; | 62 | SecOwnerDlg *oi = 0; |
63 | // see if there is contact information. | 63 | // see if there is contact information. |
64 | QString vfilename = Global::applicationFileName("addressbook", | 64 | QString vfilename = Global::applicationFileName("addressbook", |
65 | "businesscard.vcf"); | 65 | "businesscard.vcf"); |
66 | if (QFile::exists(vfilename)) { | 66 | if (QFile::exists(vfilename)) { |
67 | Contact c; | 67 | Contact c; |
68 | c = Contact::readVCard( vfilename )[0]; | 68 | c = Contact::readVCard( vfilename )[0]; |
69 | 69 | ||
70 | oi = new SecOwnerDlg(0, 0, c, TRUE, TRUE); | 70 | oi = new SecOwnerDlg(0, 0, c, TRUE, TRUE); |
71 | } | 71 | } |
72 | 72 | ||
73 | Config config("Security"); | 73 | Config config("Security"); |
74 | config.setGroup("Plugins"); | 74 | config.setGroup("Plugins"); |
75 | QStringList plugins = config.readListEntry("IncludePlugins", ','); | 75 | QStringList plugins = config.readListEntry("IncludePlugins", ','); |
76 | /* if there are no configured plugins, we simply return 0 to | 76 | /* if there are no configured plugins, we simply return 0 to |
77 | * let the user in: | 77 | * let the user in: |
78 | */ | 78 | */ |
79 | if (plugins.isEmpty() == true) { | 79 | if (plugins.isEmpty() == true) { |
80 | owarn << "No authentication plugin has been configured yet!" << oendl; | 80 | owarn << "No authentication plugin has been configured yet!" << oendl; |
81 | odebug << "Letting the user in..." << oendl; | 81 | odebug << "Letting the user in..." << oendl; |
82 | if(oi) delete oi; | 82 | if(oi) delete oi; |
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | config.setGroup("Misc"); | 85 | config.setGroup("Misc"); |
86 | int nbSuccessMin = config.readNumEntry("nbSuccessMin", 1); | 86 | int nbSuccessMin = config.readNumEntry("nbSuccessMin", 1); |
87 | int nbSuccess = 0; | 87 | int nbSuccess = 0; |
88 | 88 | ||
89 | /* tries to launch successively each plugin in $OPIEDIR/plugins/security | 89 | /* tries to launch successively each plugin in $OPIEDIR/plugins/security |
90 | * directory which file name is in Security.conf / [Misc] / IncludePlugins | 90 | * directory which file name is in Security.conf / [Misc] / IncludePlugins |
91 | */ | 91 | */ |
92 | QString path = QPEApplication::qpeDir() + "/plugins/security"; | 92 | QString path = QPEApplication::qpeDir() + "plugins/security"; |
93 | QStringList::Iterator libIt; | 93 | QStringList::Iterator libIt; |
94 | 94 | ||
95 | for ( libIt = plugins.begin(); libIt != plugins.end(); ++libIt ) { | 95 | for ( libIt = plugins.begin(); libIt != plugins.end(); ++libIt ) { |
96 | QInterfacePtr<MultiauthPluginInterface> iface; | 96 | QInterfacePtr<MultiauthPluginInterface> iface; |
97 | QLibrary *lib = new QLibrary( path + "/" + *libIt ); | 97 | QLibrary *lib = new QLibrary( path + "/" + *libIt ); |
98 | 98 | ||
99 | if ( lib->queryInterface( | 99 | if ( lib->queryInterface( |
100 | IID_MultiauthPluginInterface, | 100 | IID_MultiauthPluginInterface, |
101 | (QUnknownInterface**)&iface ) == QS_OK ) | 101 | (QUnknownInterface**)&iface ) == QS_OK ) |
102 | { | 102 | { |
103 | // the plugin is a true Multiauth plugin | 103 | // the plugin is a true Multiauth plugin |
104 | odebug << "Accepted plugin: " << QString( path + "/" + *libIt ) << oendl; | 104 | odebug << "Accepted plugin: " << QString( path + "/" + *libIt ) << oendl; |
105 | odebug << "Plugin name: " << iface->plugin()->pluginName() << oendl; | 105 | odebug << "Plugin name: " << iface->plugin()->pluginName() << oendl; |
106 | 106 | ||
107 | int resultCode; | 107 | int resultCode; |
108 | int tries = 0; | 108 | int tries = 0; |
109 | 109 | ||
110 | // perform authentication | 110 | // perform authentication |
111 | resultCode = iface->plugin()->authenticate(); | 111 | resultCode = iface->plugin()->authenticate(); |
112 | 112 | ||
113 | // display the result in command line | 113 | // display the result in command line |
114 | QString resultMessage; | 114 | QString resultMessage; |
115 | switch (resultCode) | 115 | switch (resultCode) |
116 | { | 116 | { |
117 | case MultiauthPluginObject::Success: | 117 | case MultiauthPluginObject::Success: |
118 | resultMessage = "Success!"; | 118 | resultMessage = "Success!"; |
119 | nbSuccess++; | 119 | nbSuccess++; |
120 | break; | 120 | break; |
121 | case MultiauthPluginObject::Failure: | 121 | case MultiauthPluginObject::Failure: |
122 | resultMessage = "Failure..."; | 122 | resultMessage = "Failure..."; |
123 | break; | 123 | break; |
124 | case MultiauthPluginObject::Skip: | 124 | case MultiauthPluginObject::Skip: |
125 | resultMessage = "Skip"; | 125 | resultMessage = "Skip"; |
126 | break; | 126 | break; |
127 | } | 127 | } |
128 | odebug << "Plugin result: " << resultMessage << oendl; | 128 | odebug << "Plugin result: " << resultMessage << oendl; |
129 | 129 | ||
130 | // if failure, wait, reperform, wait, reperform... until right | 130 | // if failure, wait, reperform, wait, reperform... until right |
131 | while (resultCode == MultiauthPluginObject::Failure) | 131 | while (resultCode == MultiauthPluginObject::Failure) |
132 | { | 132 | { |
133 | tries++; | 133 | tries++; |
134 | owarn << "This plugin has failed " << tries << " times already" << oendl; | 134 | owarn << "This plugin has failed " << tries << " times already" << oendl; |
135 | 135 | ||
136 | // displays owner information, if any | 136 | // displays owner information, if any |
137 | if (oi) | 137 | if (oi) |
138 | { | 138 | { |
139 | oi->exec(); | 139 | oi->exec(); |
140 | odebug << "Contact information displayed" << oendl; | 140 | odebug << "Contact information displayed" << oendl; |