author | zautrix <zautrix> | 2004-10-19 23:51:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-19 23:51:51 (UTC) |
commit | a9119c4edc272815121ddc863963b5289bb95b13 (patch) (side-by-side diff) | |
tree | f515514cda0e212da6722ef8baf5d378e08d34eb | |
parent | f013ff3c0108100c6dbf037a05502ed493361fbf (diff) | |
download | kdepimpi-a9119c4edc272815121ddc863963b5289bb95b13.zip kdepimpi-a9119c4edc272815121ddc863963b5289bb95b13.tar.gz kdepimpi-a9119c4edc272815121ddc863963b5289bb95b13.tar.bz2 |
more fixes
-rw-r--r-- | pwmanager/pwmanager/getmasterpwwnd_emb.cpp | 11 | ||||
-rw-r--r-- | pwmanager/pwmanager/main.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwminit.cpp | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp index 7f4ccef..8b6dfbc 100644 --- a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp +++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp @@ -3,164 +3,169 @@ Copyright (c) 2004 Ulf Schenk This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. $Id$ */ #include "getmasterpwwnd_emb.h" #include "klocale.h" /* #include <qvariant.h> #include <qpushbutton.h> #include <qlabel.h> #include <qlineedit.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> */ #include <qwidget.h> #include <qlayout.h> #include <qlabel.h> #include <qlineedit.h> #include <qpushbutton.h> /* * Constructs a getMasterPwWnd as a child of 'parent', with the * name 'name' */ getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent, name, true ) { QWidget *page = plainPage(); QVBoxLayout *pageLayout = new QVBoxLayout( page ); pwLineEdit = new QLineEdit( page, "pwLineEdit" ); pwLineEdit->setEchoMode( QLineEdit::Password ); QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); pageLayout->addWidget(textLabel1); pageLayout->addWidget(pwLineEdit); QWidget* numberBox = new QWidget( page ); - numberBox->setFixedHeight(100); - numberBox->setFixedWidth(100); +#ifndef DESKTOP_VERSION + numberBox->setFixedHeight(150); + numberBox->setFixedWidth(150); +#endif QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 ); numberLayout->setMargin( 0 ); numberLayout->setSpacing( 0 ); QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); numberLayout->addWidget( p1, 0, 0 ); QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); numberLayout->addWidget( p2, 0, 1 ); QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); numberLayout->addWidget( p3, 0, 2 ); QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); numberLayout->addWidget( p4, 1, 0 ); QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); numberLayout->addWidget( p5, 1, 1 ); QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); numberLayout->addWidget( p6, 1, 2 ); QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); numberLayout->addWidget( p7, 2, 0 ); QPushButton* p8 = new QPushButton( i18n("8"), numberBox ); numberLayout->addWidget( p8, 2, 1 ); QPushButton* p9 = new QPushButton( i18n("9"), numberBox ); numberLayout->addWidget( p9, 2, 2 ); QPushButton* clear = new QPushButton( i18n("x"), numberBox ); numberLayout->addWidget( clear, 3, 0 ); QPushButton* p0 = new QPushButton( i18n("0"), numberBox ); numberLayout->addWidget( p0, 3, 1 ); QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); numberLayout->addWidget( backspace, 3, 2 ); pageLayout->addWidget(numberBox); - +#ifdef DESKTOP_VERSION + resize( sizeHint() ); +#else resize( 200,sizeHint().height() ); +#endif connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) ); connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) ); connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) ); connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) ); connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) ); connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) ); connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) ); connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) ); connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) ); connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) ); connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); } /* * Destroys the object and frees any allocated resources */ getMasterPwWnd::~getMasterPwWnd() { // no need to delete child widgets, Qt does it all for us } void getMasterPwWnd::okButton_slot() { qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); } void getMasterPwWnd::cancelButton_slot() { qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); } void getMasterPwWnd::add0() { addCharacter("0"); } void getMasterPwWnd::add1() { addCharacter("1"); } void getMasterPwWnd::add2() { addCharacter("2"); } void getMasterPwWnd::add3() { addCharacter("3"); } void getMasterPwWnd::add4() { addCharacter("4"); } void getMasterPwWnd::add5() { addCharacter("5"); } void getMasterPwWnd::add6() { addCharacter("6"); } diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp index 9d1d863..3f2d055 100644 --- a/pwmanager/pwmanager/main.cpp +++ b/pwmanager/pwmanager/main.cpp @@ -142,73 +142,72 @@ int main(int argc, char *argv[]) "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, "http://passwordmanager.sourceforge.net/", "mbuesch@freenet.de"); addAuthors(&aboutData); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KUniqueApplication::addCmdLineOptions(); if (!KUniqueApplication::start()) { printInfo("already running."); return EXIT_SUCCESS; } PwMApplication a; aboutData.setLicenseTextFile(LICENSE_FILE); return a.exec(); #else bool exitHelp = false; if ( argc > 1 ) { QString command = argv[1]; if ( command == "-help" ){ printf("PWM/PI command line commands:\n"); printf(" no command: Start PWM/PI in usual way\n"); printf(" -help: This output\n"); printf(" PWM/PI is exiting now. Bye!\n"); exitHelp = true; } } if ( ! exitHelp ) { PwMApplication a(argc, argv); KGlobal::setAppName( "pwmanager" ); #ifndef DESKTOP_VERSION //qDebug("width %d ",QApplication::desktop()->width() ); if ( QApplication::desktop()->width() > 320 ) KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); else KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); #else QString fileName ; fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); QApplication::addLibraryPath ( qApp->applicationDirPath () ); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); KPimGlobalPrefs::instance()->setGlobalConfig(); a.newInstance(); //US KAddressBookMain m ; //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); /*US #ifndef DESKTOP_VERSION a.showMainWidget( &m ); #else a.setMainWidget( &m ); m.resize (640, 480 ); m.show(); #endif */ - qDebug("exec "); a.exec(); } qDebug("PWMPI: Bye! "); #endif } diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp index ea9e330..9238c8c 100644 --- a/pwmanager/pwmanager/pwminit.cpp +++ b/pwmanager/pwmanager/pwminit.cpp @@ -68,142 +68,141 @@ static NOREGPARM void sig_handler(int signum) } } PwMInit::PwMInit(PwMApplication *_app) : runStatus (unknown) , _curWidget (0) , _dcopClient (0) , _kwalletEmu (0) , _keycard (0) , _tray (0) { sig_init_pointer = this; app = _app; } PwMInit::~PwMInit() { #ifndef PWM_EMBEDDED SelfTest::cancel(); // close all open mainwnds QValueList<PwM *>::iterator i = _mainWndList.begin(), end = _mainWndList.end(); #else // close all open mainwnds QValueList<PwM *>::Iterator i = _mainWndList.begin(), end = _mainWndList.end(); #endif while (i != end) { disconnect(*i, SIGNAL(closed(PwM *)), this, SLOT(mainWndClosed(PwM *))); delete *i; ++i; } _mainWndList.clear(); // close all remaining open documents PwMDocList *_dl = PwMDoc::getOpenDocList(); vector<PwMDocList::listItem> dl = *(_dl->getList()); vector<PwMDocList::listItem>::iterator i2 = dl.begin(), end2 = dl.end(); while (i2 != end2) { delete (*i2).doc; ++i2; } #ifdef CONFIG_KWALLETIF delete_ifnot_null(_kwalletEmu); #endif // CONFIG_KWALLETIF #ifdef CONFIG_KEYCARD delete_ifnot_null(_keycard); #endif // CONFIG_KEYCARD delete_ifnot_null(_tray); Randomizer::cleanup(); #ifndef PWM_EMBEDDED Configuration::cleanup(); #endif } void PwMInit::initializeApp() { - qDebug("PwMInit::initializeApp() "); + //qDebug("PwMInit::initializeApp() "); PWM_ASSERT(runStatus == unknown); runStatus = init; initPosixSignalHandler(); Randomizer::init(); #ifndef PWM_EMBEDDED Configuration::init(); #endif initDCOP(); initKWalletEmu(); initKeycard(); initTray(); handleCmdLineArgs(); - qDebug("handle "); bool openDeeplocked = false; if (conf()->confGlobAutostartDeepLocked() || savedCmd.open_deeplocked) openDeeplocked = true; if ( false ){ // LR is not working //if (conf()->confWndAutoMinimizeOnStart() || // savedCmd.minToTray) { PwMDoc *newDoc = createDoc(); qDebug(" createDoc()"); if (!newDoc->openDocUi(newDoc, conf()->confGlobAutoStart(), openDeeplocked)) { delete newDoc; } //US ENH for embedded devices: in the case of failure, open a document the default way createMainWnd(conf()->confGlobAutoStart(), openDeeplocked, true, 0, savedCmd.minimized); // } } else { createMainWnd(conf()->confGlobAutoStart(), openDeeplocked, true, 0, savedCmd.minimized); } runStatus = running; } void PwMInit::shutdownApp(int exitStatus) { printDebug(string("PwMInit::shutdownApp(") + tostr(exitStatus) + ") called."); PWM_ASSERT((runStatus == running) || (runStatus == init)); runStatus = shutdown; QApplication::exit(exitStatus); /* The destructor of PwMInit is called when control * leaves main() */ } void PwMInit::initPosixSignalHandler() { signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); } void PwMInit::initDCOP() { #ifndef PWM_EMBEDDED _dcopClient = app->dcopClient(); _dcopClient->setNotifications(true); #endif } @@ -231,129 +230,128 @@ void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) } #else // CONFIG_KWALLETIF PARAM_UNUSED(forceDisable); PARAM_UNUSED(forceReload); #endif // CONFIG_KWALLETIF } void PwMInit::initKeycard() { #ifdef CONFIG_KEYCARD PWM_ASSERT(!_keycard); _keycard = new PwMKeyCard(this); #endif // CONFIG_KEYCARD } void PwMInit::initTray() { #ifdef PWM_EMBEDDED //US ENH : embedded version does not support a tray return; #endif if (!conf()->confGlobTray()) { if (!_tray) return; _tray->hide(); delete_and_null(_tray); return; } if (_tray) return; _tray = new PwMTray(this); connect(_tray, SIGNAL(quitSelected()), this, SLOT(removeTrayAndQuit())); connect(_tray, SIGNAL(closed(PwMTray *)), this, SLOT(trayIconClosed(PwMTray *))); KIconLoader icons; #ifndef PWM_EMBEDDED _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); #endif _tray->show(); // connect the signals of all open documents. const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); vector<PwMDocList::listItem>::const_iterator i = dl->begin(), end = dl->end(); while (i != end) { _tray->connectDocToTray((*i).doc); ++i; } } void PwMInit::removeTrayAndQuit() { PWM_ASSERT(_tray); // _tray is deleted in ~PwMInit shutdownApp(0); } PwM * PwMInit::createMainWnd(const QString &loadFile, bool loadFileDeepLocked, bool virginity, PwMDoc *doc, bool minimized) { - qDebug("PwMInit::createMainWnd "); PwM *newWnd; if (!doc) doc = createDoc(); newWnd = new PwM(this, doc, virginity); #ifndef PWM_EMBEDDED _mainWndList.push_back(newWnd); #else _mainWndList.append(newWnd); #endif connect(newWnd, SIGNAL(closed(PwM *)), this, SLOT(mainWndClosed(PwM *))); connect(newWnd, SIGNAL(gotFocus(PwM *)), this, SLOT(setCurWidget(PwM *))); connect(newWnd, SIGNAL(lostFocus(PwM *)), this, SLOT(resetCurWidget())); //US ENH #ifndef PWM_EMBEDDED if (minimized) newWnd->showMinimized(); else newWnd->show(); #else //PWM_EMBEDDED #ifndef DESKTOP_VERSION app->showMainWidget( newWnd ); #else //DESKTOP_VERSION app->setMainWidget( newWnd ); newWnd->resize (640, 480 ); newWnd->show(); qDebug("show "); #endif //DESKTOP_VERSION #endif //PWM_EMBEDDED if (loadFile != QString::null && loadFile != "") { newWnd->openDoc(loadFile, loadFileDeepLocked); } return newWnd; } PwMDoc * PwMInit::createDoc() { PwMDoc *doc = new PwMDoc(this); #ifdef CONFIG_KEYCARD doc->setPwMKeyCard(keycard()); #endif #ifdef CONFIG_KWALLETIF if (kwalletEmu()) kwalletEmu()->connectDocSignals(doc); #endif if (_tray) _tray->connectDocToTray(doc); return doc; } void PwMInit::mainWndClosed(PwM *wnd) { bool doMinimizeToTray = false; |