-rw-r--r-- | pwmanager/pwmanager/configuration.cpp | 459 | ||||
-rw-r--r-- | pwmanager/pwmanager/configuration.h | 336 | ||||
-rw-r--r-- | pwmanager/pwmanager/configuration_31compat.cpp | 365 | ||||
-rw-r--r-- | pwmanager/pwmanager/configuration_31compat.h | 146 | ||||
-rw-r--r-- | pwmanager/pwmanager/configwnd.cpp | 265 | ||||
-rw-r--r-- | pwmanager/pwmanager/configwnd.h | 91 | ||||
-rw-r--r-- | pwmanager/pwmanager/configwndimpl.cpp | 136 | ||||
-rw-r--r-- | pwmanager/pwmanager/configwndimpl.h | 55 |
8 files changed, 0 insertions, 1853 deletions
diff --git a/pwmanager/pwmanager/configuration.cpp b/pwmanager/pwmanager/configuration.cpp deleted file mode 100644 index 8d67977..0000000 --- a/pwmanager/pwmanager/configuration.cpp +++ b/dev/null @@ -1,459 +0,0 @@ -/*************************************************************************** - * * - * copyright (C) 2004 by Michael Buesch * - * email: mbuesch@freenet.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License version 2 * - * as published by the Free Software Foundation. * - * * - ***************************************************************************/ - -/*************************************************************************** - * copyright (C) 2004 by Ulf Schenk - * This file is originaly based on version 2.0 of pwmanager - * and was modified to run on embedded devices that run microkde - * - * $Id$ - **************************************************************************/ - -#include "configuration.h" -#if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) - -#include <kconfigdialog.h> -#include <kfiledialog.h> -#include <klocale.h> -#include <kfontrequester.h> - -#include <qcheckbox.h> -#include <qcombobox.h> -#include <qlabel.h> -#include <qlineedit.h> -#include <qpushbutton.h> -#include <qgroupbox.h> -#include <qfileinfo.h> -#include <qfontdialog.h> -#include <qspinbox.h> -#include <qvalidator.h> -#include <qsqlpropertymap.h> -#include <qlayout.h> - -#include <stdlib.h> -#include <stdio.h> - -#define INITIAL_CONFWND_SIZE (QSize(600, 450)) - - -/********************************************************* - ** class Configuration ** - *********************************************************/ - -Configuration * Configuration::_obj (0); - -Configuration::Configuration() -{ - skel = new KConfigSkeleton; - initSkel(); - readConfig(); -} - -Configuration::~Configuration() -{ - writeConfig(); - delete_ifnot_null(skel); -} - -void Configuration::initSkel() -{ - skel->setCurrentGroup("GLOBAL"); - skel->addItemString("autoStart", cGlobAutoStart); - skel->addItemString("browserCommand", cGlobBrowserCommand, CONF_DEFAULT_BROWSERCOMMAND); - skel->addItemString("xtermCommand", cGlobXtermCommand, CONF_DEFAULT_XTERMCOMMAND); - skel->addItemFont("entryFont", cGlobEntryFont); - skel->addItemInt("pwTimeout", cGlobPwTimeout, CONF_DEFAULT_PWTIMEOUT); - skel->addItemInt("lockTimeout", cGlobLockTimeout, CONF_DEFAULT_LOCKTIMEOUT); - skel->addItemInt("compression", cGlobCompression, CONF_DEFAULT_COMPRESSION); - skel->addItemInt("filePermissions", cGlobFilePermissions, CONF_DEFAULT_FILEPERMISSIONS); - skel->addItemInt("minimizeLock", cGlobMinimizeLock, CONF_DEFAULT_MINIMIZELOCK); - skel->addItemBool("unlockOnOpen", cGlobUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN); - skel->addItemBool("tray", cGlobTray, CONF_DEFAULT_TRAY); - skel->addItemBool("makeFileBackup", cGlobMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP); - skel->addItemBool("autostartDeeplocked", cGlobAutostartDeepLocked, CONF_DEFAULT_AUTOSTART_DEEPL); - skel->addItemBool("autoDeepLock", cGlobAutoDeepLock, CONF_DEFAULT_AUTODEEPLOCK); - skel->addItemBool("kwalletEmu", cGlobKwalletEmu, CONF_DEFAULT_KWALLETEMU); - skel->addItemBool("newEntrLockStat", cGlobNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT); - - skel->setCurrentGroup("WND"); - skel->addItemSize("MainWndSize", cWndMainWndSize); - skel->addItemInt("MainViewStyle", cWndMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE); - skel->addItemBool("autoMinimizeOnStart", cWndAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE); - skel->addItemBool("close", cWndClose, CONF_DEFAULT_WNDCLOSE); -} - -bool Configuration::showConfWnd(QWidget *parent) -{ - bool ret = true; - KConfigDialog *confDlg; - confDlg = new KConfigDialog(parent, i18n("Main configuration").latin1(), skel, - KDialogBase::IconList, - KConfigDialog::Default | KConfigDialog::Ok | - KConfigDialog::Cancel | KConfigDialog::Help, - KConfigDialog::Ok, true); - ConfPageGlobal *confPageGlobal = new ConfPageGlobal; - ConfPageLookNFeel *confPageLookNFeel = new ConfPageLookNFeel; - ConfPageFile *confPageFile = new ConfPageFile; - ConfPageTimeouts *confPageTimeouts = new ConfPageTimeouts; - ConfPageExtApps *confPageExtApps = new ConfPageExtApps; - ConfPageAutostart *confPageAutostart = new ConfPageAutostart; - confDlg->addPage(confPageGlobal, i18n("General"), "pwmanager"); - confDlg->addPage(confPageLookNFeel, i18n("Look & Feel"), "fonts"); - confDlg->addPage(confPageFile, i18n("Files"), "filesave"); - confDlg->addPage(confPageTimeouts, i18n("Timeouts"), "clock"); - confDlg->addPage(confPageExtApps, i18n("External Applications"), "gear"); - confDlg->addPage(confPageAutostart, i18n("Autostart"), "fileopen"); - confDlg->resize(INITIAL_CONFWND_SIZE); - if (confDlg->exec() == 0) - ret = false; - delete confPageGlobal; - delete confPageLookNFeel; - delete confPageFile; - delete confPageTimeouts; - delete confPageExtApps; - delete confPageAutostart; - return ret; -} - - -/********************************************************* - ** class OctLineEdit ** - *********************************************************/ - -OctLineEdit::OctLineEdit(QWidget *parent, const char *name) - : QLineEdit(parent, name) -{ -} - -OctLineEdit::~OctLineEdit() -{ -} - -void OctLineEdit::setText(const QString &t) -{ - bool ok; - int tmp = t.toInt(&ok, 10); - if (!ok) - return; - QString ret; - ret.setNum(tmp, 8); - QLineEdit::setText(ret); -} - -QString OctLineEdit::text() const -{ - bool ok; - QString ret; - QString t(QLineEdit::text()); - int tmp = t.toInt(&ok, 8); - if (!ok) - return ret; - ret.setNum(tmp, 10); - return ret; -} - -void OctLineEdit::keyPressEvent(QKeyEvent *e) -{ - int key = e->key(); - switch (key) { - case Qt::Key_0: - case Qt::Key_1: - case Qt::Key_2: - case Qt::Key_3: - case Qt::Key_4: - case Qt::Key_5: - case Qt::Key_6: - case Qt::Key_7: - case Qt::Key_Escape: - case Qt::Key_Backtab: - case Qt::Key_Backspace: - case Qt::Key_Return: - case Qt::Key_Enter: - case Qt::Key_Insert: - case Qt::Key_Delete: - case Qt::Key_Home: - case Qt::Key_End: - case Qt::Key_Left: - case Qt::Key_Up: - case Qt::Key_Right: - case Qt::Key_Down: - e->accept(); - QLineEdit::keyPressEvent(e); - break; - default: - e->ignore(); - } -} - - -/********************************************************* - ** class ConfPageGlobal ** - *********************************************************/ - -ConfPageGlobal::ConfPageGlobal(QWidget *parent, const char *name, WFlags f) - : QWidget(parent, name, f) -{ - QCheckBox *kcfg_tray; - QCheckBox *kcfg_autoMinimizeOnStart; - QCheckBox *kcfg_unlockOnOpen; - QCheckBox *kcfg_newEntrLockStat; - QCheckBox *kcfg_close; - QComboBox *kcfg_minimizeLock; - QLabel *kcfg_minimizeLock_label; - - QBoxLayout *l = new QVBoxLayout(this); - l->setSpacing(4); - kcfg_tray = new QCheckBox(i18n("Show icon in system-tray"), this, "kcfg_tray"); - l->addWidget(kcfg_tray); - kcfg_autoMinimizeOnStart = new QCheckBox(i18n("auto-minimize to tray on startup"), - this, "kcfg_autoMinimizeOnStart"); - l->addWidget(kcfg_autoMinimizeOnStart); - kcfg_unlockOnOpen = new QCheckBox(i18n("Open document with passwords unlocked"), - this, "kcfg_unlockOnOpen"); - l->addWidget(kcfg_unlockOnOpen); -#ifdef CONFIG_KWALLETIF - QCheckBox *kcfg_kwalletEmu; - kcfg_kwalletEmu = new QCheckBox(i18n("KWallet emulation"), - this, "kcfg_kwalletEmu"); - l->addWidget(kcfg_kwalletEmu); -#endif // CONFIG_KWALLETIF - kcfg_newEntrLockStat = new QCheckBox(i18n("Automatically lock new entries"), - this, "kcfg_newEntrLockStat"); - l->addWidget(kcfg_newEntrLockStat); - kcfg_close = new QCheckBox(i18n("Do not minimize windows into tray. (Close the window)"), - this, "kcfg_close"); - l->addWidget(kcfg_close); - l->addSpacing(4); - QBoxLayout *hl = new QHBoxLayout(this); - hl->setSpacing(10); - kcfg_minimizeLock_label = new QLabel(i18n("auto-lock on minimize:"), this); - hl->addWidget(kcfg_minimizeLock_label); - kcfg_minimizeLock = new QComboBox(this, "kcfg_minimizeLock"); - hl->addStretch(); - hl->addWidget(kcfg_minimizeLock); - kcfg_minimizeLock->insertItem(i18n("don't lock")); - kcfg_minimizeLock->insertItem(i18n("normal lock")); - kcfg_minimizeLock->insertItem(i18n("deep-lock")); - l->addLayout(hl); - l->addStretch(); -} - - -/********************************************************* - ** class ConfPageLookNFeel ** - *********************************************************/ - -ConfPageLookNFeel::ConfPageLookNFeel(QWidget *parent, const char *name, WFlags f) - : QWidget(parent, name, f) -{ - QComboBox *kcfg_MainViewStyle; - QLabel *kcfg_MainViewStyle_label; - KFontRequester *kcfg_entryFont; - QGroupBox *kcfg_entryFont_box; - - QBoxLayout *l = new QVBoxLayout(this); - l->setSpacing(10); - // font - kcfg_entryFont_box = new QGroupBox(i18n("Font for the password entries:"), this); - l->addWidget(kcfg_entryFont_box); - kcfg_entryFont_box->setColumns(1); - kcfg_entryFont = new KFontRequester(kcfg_entryFont_box, "kcfg_entryFont", false); - // wnd style - QBoxLayout *hl = new QHBoxLayout(this); - hl->setSpacing(10); - kcfg_MainViewStyle_label = new QLabel(i18n("Window-style:"), this); - hl->addWidget(kcfg_MainViewStyle_label); - kcfg_MainViewStyle = new QComboBox(this, "kcfg_MainViewStyle"); - hl->addStretch(); - hl->addWidget(kcfg_MainViewStyle); - kcfg_MainViewStyle->insertItem(i18n("Category on top")); - kcfg_MainViewStyle->insertItem(i18n("Category-list left")); - l->addLayout(hl); - l->addStretch(); -} - - -/********************************************************* - ** class ConfPageFile ** - *********************************************************/ - -ConfPageFile::ConfPageFile(QWidget *parent, const char *name, WFlags f) - : QWidget(parent, name, f) -{ - QComboBox *kcfg_compression; - QLabel *kcfg_compression_label; - OctLineEdit *kcfg_filePermissions; - QLabel *kcfg_filePermissions_label; - QCheckBox *kcfg_makeFileBackup; - - QBoxLayout *l = new QVBoxLayout(this); - l->setSpacing(10); - // compression - QBoxLayout *hl = new QHBoxLayout(this); - hl->setSpacing(10); - kcfg_compression_label = new QLabel(i18n("*.pwm file compression:"), this); - hl->addWidget(kcfg_compression_label); - kcfg_compression = new QComboBox(this, "kcfg_compression"); - hl->addStretch(); - hl->addWidget(kcfg_compression); - kcfg_compression->insertItem(i18n("none")); - kcfg_compression->insertItem(i18n("gzip")); - kcfg_compression->insertItem(i18n("bzip2")); - l->addLayout(hl); - // permissions - hl = new QHBoxLayout(this); - hl->setSpacing(10); - kcfg_filePermissions_label = new QLabel(i18n("permissions:"), this); - hl->addWidget(kcfg_filePermissions_label); - kcfg_filePermissions = new OctLineEdit(this, "kcfg_filePermissions"); - hl->addStretch(); - hl->addWidget(kcfg_filePermissions); - kcfg_filePermissions->setMaxLength(3); - l->addLayout(hl); - // backup - kcfg_makeFileBackup = new QCheckBox(i18n("Make file backup before saving"), - this, "kcfg_makeFileBackup"); - l->addWidget(kcfg_makeFileBackup); - l->addStretch(); -} - - -/********************************************************* - ** class ConfPageTimeouts ** - *********************************************************/ - -ConfPageTimeouts::ConfPageTimeouts(QWidget *parent, const char *name, WFlags f) - : QWidget(parent, name, f) -{ - QSpinBox *kcfg_pwTimeout; - QLabel *kcfg_pwTimeout_label; - QSpinBox *kcfg_lockTimeout; - QLabel *kcfg_lockTimeout_label; - QCheckBox *kcfg_autoDeepLock; - - QBoxLayout *l = new QVBoxLayout(this); - l->setSpacing(10); - // pw timeout - QBoxLayout *hl = new QHBoxLayout(this); - hl->setSpacing(10); - kcfg_pwTimeout_label = new QLabel(i18n("Password timeout (timeout to hold " - "password in memory, so you don't have " - "to re-enter it, if you already have " - "entered it) [set to 0 to disable]:"), - this); - hl->addWidget(kcfg_pwTimeout_label); - kcfg_pwTimeout_label->setAlignment(QLabel::WordBreak); - kcfg_pwTimeout = new QSpinBox(this, "kcfg_pwTimeout"); - hl->addStretch(); - hl->addWidget(kcfg_pwTimeout); - l->addLayout(hl); - // lock timeout - hl = new QHBoxLayout(this); - hl->setSpacing(10); - kcfg_lockTimeout_label = new QLabel(i18n("Auto-lock timeout (auto lock document " - "after this amount of seconds) " - "[set to 0 to disable]:"), - this); - hl->addWidget(kcfg_lockTimeout_label); - kcfg_lockTimeout_label->setAlignment(QLabel::WordBreak); - kcfg_lockTimeout = new QSpinBox(this, "kcfg_lockTimeout"); - hl->addStretch(); - hl->addWidget(kcfg_lockTimeout); - l->addLayout(hl); - // auto deep lock checkbox - kcfg_autoDeepLock = new QCheckBox(i18n("deep-lock on autolock"), - this, "kcfg_autoDeepLock"); - l->addWidget(kcfg_autoDeepLock); - l->addStretch(); -} - - -/********************************************************* - ** class ConfPageExtApps ** - *********************************************************/ - -ConfPageExtApps::ConfPageExtApps(QWidget *parent, const char *name, WFlags f) - : QWidget(parent, name, f) -{ - QLineEdit *kcfg_browserCommand; - QLabel *kcfg_browserCommand_label; - QLineEdit *kcfg_xtermCommand; - QLabel *kcfg_xtermCommand_label; - - QBoxLayout *l = new QVBoxLayout(this); - l->setSpacing(4); - // browser command - QBoxLayout *hl = new QHBoxLayout(this); - hl->setSpacing(10); - kcfg_browserCommand_label = new QLabel(i18n("Favourite browser:"), this); - hl->addWidget(kcfg_browserCommand_label); - kcfg_browserCommand = new QLineEdit(this, "kcfg_browserCommand"); - hl->addStretch(); - hl->addWidget(kcfg_browserCommand); - l->addLayout(hl); - // xterm command - hl = new QHBoxLayout(this); - hl->setSpacing(10); - kcfg_xtermCommand_label = new QLabel(i18n("Favourite X-terminal:"), this); - hl->addWidget(kcfg_xtermCommand_label); - kcfg_xtermCommand = new QLineEdit(this, "kcfg_xtermCommand"); - hl->addStretch(); - hl->addWidget(kcfg_xtermCommand); - l->addLayout(hl); - l->addStretch(); -} - - -/********************************************************* - ** class ConfPageAutostart ** - *********************************************************/ - -ConfPageAutostart::ConfPageAutostart(QWidget *parent, const char *name, WFlags f) - : QWidget(parent, name, f) -{ - QGroupBox *kcfg_autoStart_box; - QPushButton *kcfg_autoStart_button; - QCheckBox *kcfg_autostartDeeplocked; - - QBoxLayout *l = new QVBoxLayout(this); - l->setSpacing(4); - // autostart - kcfg_autoStart_box = new QGroupBox(i18n("Open this file automatically on startup:"), - this); - l->addWidget(kcfg_autoStart_box); - kcfg_autoStart_box->setColumns(2); - kcfg_autoStart = new QLineEdit(kcfg_autoStart_box, "kcfg_autoStart"); - kcfg_autoStart_button = new QPushButton("...", kcfg_autoStart_box); - kcfg_autostartDeeplocked = new QCheckBox(i18n("open deeplocked"), - kcfg_autoStart_box, "kcfg_autostartDeeplocked"); - l->addStretch(); - // connections - connect(kcfg_autoStart_button, SIGNAL(clicked()), - this, SLOT(browseButton_slot())); -} - -void ConfPageAutostart::browseButton_slot() -{ - QString path(KFileDialog::getOpenFileName(QString::null, - i18n("*.pwm|PwM Password file\n" - "*|All files"), this)); - if (path == QString::null) - return; - kcfg_autoStart->setText(path); -} - - -#include "configuration.moc" - -#else // KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) - /* XXX: This is the code for KDE-3.1 compatibility. */ -# include "configuration_31compat.cpp" -#endif // KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) diff --git a/pwmanager/pwmanager/configuration.h b/pwmanager/pwmanager/configuration.h deleted file mode 100644 index 9001147..0000000 --- a/pwmanager/pwmanager/configuration.h +++ b/dev/null @@ -1,336 +0,0 @@ -/*************************************************************************** - * * - * copyright (C) 2004 by Michael Buesch * - * email: mbuesch@freenet.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License version 2 * - * as published by the Free Software Foundation. * - * * - ***************************************************************************/ - -/*************************************************************************** - * copyright (C) 2004 by Ulf Schenk - * This file is originaly based on version 1.0.1 of pwmanager - * and was modified to run on embedded devices that run microkde - * - * $Id$ - **************************************************************************/ - -#ifndef __CONFIGURATION_H -#define __CONFIGURATION_H - -#define CONF_DEFAULT_PWTIMEOUT 10 /* 10 sec */ -#define CONF_DEFAULT_LOCKTIMEOUT 0 /* 0 == disable */ -#define CONF_DEFAULT_TRAY true -#define CONF_DEFAULT_UNLOCKONOPEN false -#define CONF_DEFAULT_MAINVIEWSTYLE 0 -#define CONF_DEFAULT_COMPRESSION 0x01 /* gzip */ -#define CONF_DEFAULT_AUTOMINIMIZE false -#define CONF_DEFAULT_BROWSERCOMMAND "" -#define CONF_DEFAULT_XTERMCOMMAND "konsole -e" -#define CONF_DEFAULT_FILEPERMISSIONS 0600 -#define CONF_DEFAULT_MAKEFILEBACKUP false -#define CONF_DEFAULT_AUTOSTART_DEEPL true -#define CONF_DEFAULT_AUTODEEPLOCK true -#define CONF_DEFAULT_KWALLETEMU true -#define CONF_DEFAULT_MINIMIZELOCK 2 /* deep-lock */ -#define CONF_DEFAULT_NEWENTRLOCKSTAT true /* locked */ -#define CONF_DEFAULT_WNDCLOSE true /* don't minimize to tray */ - -/** This is just because I'm too lazy to always - * type this loooong statement, when accessing - * configuration parameters. - */ -#define conf() Configuration::obj() - -#include <kstandarddirs.h> - -#ifndef PWM_EMBEDDED -#include <kdeversion.h> -#else -#define KDE_VERSION 310 -#define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c)) -#endif - -// Set this to 1 to debug the 3.1 compatibility interface -#if 0 -# warning configuration.h KDE_VERSION debugging enabled! -# undef KDE_VERSION -# define KDE_VERSION KDE_MAKE_VERSION(3, 1, 0) -#endif - -#if !defined(KDE_VERSION) || !defined(KDE_MAKE_VERSION) -# error "KDE_VERSION or KDE_MAKE_VERSION not defined" -#endif -#if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) - -#ifndef PWM_EMBEDDED -//MOC_SKIP_BEGIN -#endif - -#include <qstring.h> -#include <qsize.h> -#include <qfont.h> -#include <qwidget.h> -#include <qvbox.h> -#include <qhbox.h> -#include <qlineedit.h> - -#include <kconfigskeleton.h> - -#include "pwmexception.h" - -class QLabel; -class QGroupBox; -class QPushButton; -class QResizeEvent; - -/** New global configuration file interface - * using KDE-3.2 KConfigSkeleton model. - */ -class Configuration -{ -public: - Configuration(); - ~Configuration(); - - static Configuration * obj() - { - PWM_ASSERT(_obj); - return _obj; - } - static void init() - { - PWM_ASSERT(!_obj); - _obj = new Configuration; - } - static void cleanup() - { delete_ifnot_null(_obj); } - - - /** Read the configuration from the file. - * Normally this function has not to be called manually. - */ - void readConfig() - { skel->readConfig(); } - /** Write the configuration to the file. - * Normally this function has not to be called manually. - */ - void writeConfig() - { skel->writeConfig(); } - /** reset the whole configuration to its defaults */ - void resetConfig() - { skel->setDefaults(); } - /** show the configuration window */ - bool showConfWnd(QWidget *parent); - -public: - /* functions for reading the configuration settings */ - /* GLOBAL */ - QString confGlobAutoStart() - { return cGlobAutoStart; } - QString confGlobBrowserCommand() - { return cGlobBrowserCommand; } - QString confGlobXtermCommand() - { return cGlobXtermCommand; } - QFont confGlobEntryFont() - { return cGlobEntryFont; } - int confGlobPwTimeout() - { return cGlobPwTimeout; } - int confGlobLockTimeout() - { return cGlobLockTimeout; } - int confGlobCompression() - { return cGlobCompression; } - int confGlobFilePermissions() - { return cGlobFilePermissions; } - int confGlobMinimizeLock() - { return cGlobMinimizeLock; } - bool confGlobUnlockOnOpen() - { return cGlobUnlockOnOpen; } - bool confGlobTray() - { return cGlobTray; } - bool confGlobMakeFileBackup() - { return cGlobMakeFileBackup; } - bool confGlobAutostartDeepLocked() - { return cGlobAutostartDeepLocked; } - bool confGlobAutoDeepLock() - { return cGlobAutoDeepLock; } - bool confGlobKwalletEmu() - { return cGlobKwalletEmu; } - bool confGlobNewEntrLockStat() - { return cGlobNewEntrLockStat; } - /* WND */ - QSize confWndMainWndSize() - { return cWndMainWndSize; } - int confWndMainViewStyle() - { return cWndMainViewStyle; } - bool confWndAutoMinimizeOnStart() - { return cWndAutoMinimizeOnStart; } - bool confWndClose() - { return cWndClose; } - -public: - /* functions for writing the configuration settings */ - /* GLOBAL */ - void confGlobAutoStart(const QString &e) - { cGlobAutoStart = e; } - void confGlobBrowserCommand(const QString &e) - { cGlobBrowserCommand = e; } - void confGlobXtermCommand(const QString &e) - { cGlobXtermCommand = e; } - void confGlobEntryFont(const QFont &e) - { cGlobEntryFont = e; } - void confGlobPwTimeout(int e) - { cGlobPwTimeout = e; } - void confGlobLockTimeout(int e) - { cGlobLockTimeout = e; } - void confGlobCompression(int e) - { cGlobCompression = e; } - void confGlobFilePermissions(int e) - { cGlobFilePermissions = e; } - void confGlobMinimizeLock(int e) - { cGlobMinimizeLock = e; } - void confGlobUnlockOnOpen(bool e) - { cGlobUnlockOnOpen = e; } - void confGlobTray(bool e) - { cGlobTray = e; } - void confGlobMakeFileBackup(bool e) - { cGlobMakeFileBackup = e; } - void confGlobAutostartDeepLocked(bool e) - { cGlobAutostartDeepLocked = e; } - void confGlobAutoDeepLock(bool e) - { cGlobAutoDeepLock = e; } - void confGlobKwalletEmu(bool e) - { cGlobKwalletEmu = e; } - void confGlobNewEntrLockStat(bool e) - { cGlobNewEntrLockStat = e; } - /* WND */ - void confWndMainWndSize(const QSize &e) - { cWndMainWndSize = e; } - void confWndMainViewStyle(int e) - { cWndMainViewStyle = e; } - void confWndAutoMinimizeOnStart(bool e) - { cWndAutoMinimizeOnStart = e; } - void confWndClose(bool e) - { cWndClose = e; } - -protected: - /** initialize the skeleton */ - void initSkel(); - -protected: - /** static instance of this class returned by obj() */ - static Configuration *_obj; - /** main configuration access skeleton */ - KConfigSkeleton *skel; - -protected: - /* configuration variables. All prefixed with 'c'. */ - /* GLOBAL */ - QString cGlobAutoStart; - QString cGlobBrowserCommand; - QString cGlobXtermCommand; - QFont cGlobEntryFont; - int cGlobPwTimeout; - int cGlobLockTimeout; - int cGlobCompression; - int cGlobFilePermissions; - int cGlobMinimizeLock; - bool cGlobUnlockOnOpen; - bool cGlobTray; - bool cGlobMakeFileBackup; - bool cGlobAutostartDeepLocked; - bool cGlobAutoDeepLock; - bool cGlobKwalletEmu; - bool cGlobNewEntrLockStat; - /* WND */ - QSize cWndMainWndSize; - int cWndMainViewStyle; - bool cWndAutoMinimizeOnStart; - bool cWndClose; -}; - -/* Big fat note: Internal stuff follows. - * ============ Don't use the following classes outside of - * the Configuration code, because it's unavailable - * when compiled under KDE-3.1 - */ - -/** class for input of octal numbers (for example file permissions) */ -class OctLineEdit : public QLineEdit -{ - Q_OBJECT - Q_OVERRIDE( QString text READ text WRITE setText ) - -public: - OctLineEdit(QWidget *parent, const char *name = 0); - ~OctLineEdit(); - - void setText(const QString &t); - QString text() const; - -protected: - void keyPressEvent(QKeyEvent *e); -}; - -/** global configuration page */ -class ConfPageGlobal : public QWidget -{ -public: - ConfPageGlobal(QWidget *parent = 0, const char *name = 0, WFlags f = 0); -}; - -/** configuration page for look&feel */ -class ConfPageLookNFeel : public QWidget -{ -public: - ConfPageLookNFeel(QWidget *parent = 0, const char *name = 0, WFlags f = 0); -}; - -/** file configuration page */ -class ConfPageFile : public QWidget -{ -public: - ConfPageFile(QWidget *parent = 0, const char *name = 0, WFlags f = 0); -}; - -/** timeouts configuration page */ -class ConfPageTimeouts : public QWidget -{ -public: - ConfPageTimeouts(QWidget *parent = 0, const char *name = 0, WFlags f = 0); -}; - -/** configuration page for external apps */ -class ConfPageExtApps : public QWidget -{ -public: - ConfPageExtApps(QWidget *parent = 0, const char *name = 0, WFlags f = 0); -}; - -/** autostart configuration page */ -class ConfPageAutostart : public QWidget -{ - Q_OBJECT -public: - ConfPageAutostart(QWidget *parent = 0, const char *name = 0, WFlags f = 0); - -protected slots: - void browseButton_slot(); - -protected: - QLineEdit *kcfg_autoStart; -}; - - -#ifndef PWM_EMBEDDED -//MOC_SKIP_END -#endif - - -#else // KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) - /* XXX: This is the code for KDE-3.1 compatibility. */ -# include "configuration_31compat.h" -#endif // KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) -#endif // CONFIGURATION_H diff --git a/pwmanager/pwmanager/configuration_31compat.cpp b/pwmanager/pwmanager/configuration_31compat.cpp deleted file mode 100644 index ffd522c..0000000 --- a/pwmanager/pwmanager/configuration_31compat.cpp +++ b/dev/null @@ -1,365 +0,0 @@ -/*************************************************************************** - * * - * copyright (C) 2004 by Michael Buesch * - * email: mbuesch@freenet.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License version 2 * - * as published by the Free Software Foundation. * - * * - ***************************************************************************/ - -/*************************************************************************** - * copyright (C) 2004 by Ulf Schenk - * This file is originaly based on version 1.0.1 of pwmanager - * and was modified to run on embedded devices that run microkde - * - * $Id$ - **************************************************************************/ - -#include "configuration_31compat.h" -#include "configwndimpl.h" -#include "pwmexception.h" - -#include <kconfig.h> -#include <kapplication.h> - -#include <qfileinfo.h> -#include <qcheckbox.h> -#include <qcombobox.h> -#include <qspinbox.h> -#include <qlineedit.h> -#include <qlabel.h> - -#ifdef PWM_EMBEDDED -#include <qfont.h> -#include <kglobal.h> -#endif - -Configuration_31compat * Configuration_31compat::_obj (0); - -Configuration_31compat::Configuration_31compat() -{ -#ifndef PWM_EMBEDDED - conf = KApplication::kApplication()->config(); -#else - conf = KGlobal::config(); -#endif -} - -Configuration_31compat::~Configuration_31compat() -{ -} - -bool Configuration_31compat::showConfWnd(QWidget * /*parent*/) -{ - ConfigWndImpl cfgWnd; - cfgWnd.pwTimeoutSpinBox->setValue(confGlobPwTimeout()); - cfgWnd.lockTimeoutSpinBox->setValue(confGlobLockTimeout()); - cfgWnd.trayCheckBox->setChecked(confGlobTray()); - cfgWnd.autoStartLineEdit->setText(confGlobAutoStart()); - cfgWnd.openUnlockedCheckBox->setChecked(confGlobUnlockOnOpen()); - cfgWnd.currentEntryFont = confGlobEntryFont(); - cfgWnd.currEntrFont->setText(cfgWnd.currentEntryFont.family()); - cfgWnd.currEntrFont->setFont(cfgWnd.currentEntryFont); - cfgWnd.windowStyleComboBox->setCurrentItem(confWndMainViewStyle()); - cfgWnd.compressionComboBox->setCurrentItem(confGlobCompression()); - cfgWnd.autoMinimizeCheckBox->setChecked(confWndAutoMinimizeOnStart()); - cfgWnd.browserLineEdit->setText(confGlobBrowserCommand()); - cfgWnd.xtermLineEdit->setText(confGlobXtermCommand()); - cfgWnd.setFilePermissions(confGlobFilePermissions()); - cfgWnd.fileBackupCheckBox->setChecked(confGlobMakeFileBackup()); - cfgWnd.autostartDeeplockedCheckBox->setChecked(confGlobAutostartDeepLocked()); - cfgWnd.autoDeepLockCheckBox->setChecked(confGlobAutoDeepLock()); - cfgWnd.minimizeLockComboBox->setCurrentItem(confGlobMinimizeLock()); - cfgWnd.wndCloseCheckBox->setChecked(confWndClose()); -#ifdef CONFIG_KWALLETIF - cfgWnd.kwalletEmuCheckBox->setChecked(confGlobKwalletEmu()); -#else // CONFIG_KWALLETIF - cfgWnd.kwalletEmuCheckBox->setChecked(false); - cfgWnd.kwalletEmuCheckBox->setEnabled(false); -#endif // CONFIG_KWALLETIF - - if (cfgWnd.exec()) - return false; - - confGlobPwTimeout(cfgWnd.pwTimeoutSpinBox->value()); - confGlobLockTimeout(cfgWnd.lockTimeoutSpinBox->value()); - confGlobTray(cfgWnd.trayCheckBox->isChecked()); - confGlobAutoStart(cfgWnd.autoStartLineEdit->text()); - confGlobUnlockOnOpen(cfgWnd.openUnlockedCheckBox->isChecked()); - confGlobEntryFont(cfgWnd.currentEntryFont); - confWndMainViewStyle(cfgWnd.windowStyleComboBox->currentItem()); - confGlobCompression(cfgWnd.compressionComboBox->currentItem()); - confWndAutoMinimizeOnStart(cfgWnd.autoMinimizeCheckBox->isChecked()); - confGlobBrowserCommand(cfgWnd.browserLineEdit->text()); - confGlobXtermCommand(cfgWnd.xtermLineEdit->text()); - confGlobFilePermissions(cfgWnd.getFilePermissions()); - confGlobMakeFileBackup(cfgWnd.fileBackupCheckBox->isChecked()); - confGlobAutostartDeepLocked(cfgWnd. - autostartDeeplockedCheckBox->isChecked()); - confGlobAutoDeepLock(cfgWnd.autoDeepLockCheckBox->isChecked()); - confGlobMinimizeLock(cfgWnd.minimizeLockComboBox->currentItem()); - confWndClose(cfgWnd.wndCloseCheckBox->isChecked()); -#ifdef CONFIG_KWALLETIF - confGlobKwalletEmu(cfgWnd.kwalletEmuCheckBox->isChecked()); -#endif // CONFIG_KWALLETIF - return true; -} - -/******************************************************************* - * functions for reading the configuration settings - *******************************************************************/ - -QString Configuration_31compat::confGlobAutoStart() -{ - conf->setGroup("GLOBAL"); - return conf->readEntry("autoStart"); -} - -QString Configuration_31compat::confGlobBrowserCommand() -{ - conf->setGroup("GLOBAL"); - return conf->readEntry("browserCommand", CONF_DEFAULT_BROWSERCOMMAND); -} - -QString Configuration_31compat::confGlobXtermCommand() -{ - conf->setGroup("GLOBAL"); - return conf->readEntry("xtermCommand", CONF_DEFAULT_XTERMCOMMAND); -} - -QFont Configuration_31compat::confGlobEntryFont() -{ - conf->setGroup("GLOBAL"); -#ifndef PWM_EMBEDDED - return conf->readFontEntry("entryFont"); -#else - QFont f; - return conf->readFontEntry("entryFont", &f); -#endif -} - -int Configuration_31compat::confGlobPwTimeout() -{ - conf->setGroup("GLOBAL"); - return conf->readNumEntry("pwTimeout", CONF_DEFAULT_PWTIMEOUT); -} - -int Configuration_31compat::confGlobLockTimeout() -{ - conf->setGroup("GLOBAL"); - return conf->readNumEntry("lockTimeout", CONF_DEFAULT_LOCKTIMEOUT); -} - -int Configuration_31compat::confGlobCompression() -{ - conf->setGroup("GLOBAL"); - return conf->readNumEntry("compression", CONF_DEFAULT_COMPRESSION); -} - -int Configuration_31compat::confGlobFilePermissions() -{ - conf->setGroup("GLOBAL"); - return conf->readNumEntry("filePermissions", CONF_DEFAULT_FILEPERMISSIONS); -} - -int Configuration_31compat::confGlobMinimizeLock() -{ - conf->setGroup("GLOBAL"); - return conf->readNumEntry("minimizeLock", CONF_DEFAULT_MINIMIZELOCK); -} - -bool Configuration_31compat::confGlobUnlockOnOpen() -{ - conf->setGroup("GLOBAL"); - return conf->readBoolEntry("unlockOnOpen", CONF_DEFAULT_UNLOCKONOPEN); -} - -bool Configuration_31compat::confGlobTray() -{ - conf->setGroup("GLOBAL"); - return conf->readBoolEntry("tray", CONF_DEFAULT_TRAY); -} - -bool Configuration_31compat::confGlobMakeFileBackup() -{ - conf->setGroup("GLOBAL"); - return conf->readBoolEntry("makeFileBackup", CONF_DEFAULT_MAKEFILEBACKUP); -} - -bool Configuration_31compat::confGlobAutostartDeepLocked() -{ - conf->setGroup("GLOBAL"); - return conf->readBoolEntry("autostartDeeplocked", CONF_DEFAULT_AUTOSTART_DEEPL); -} - -bool Configuration_31compat::confGlobAutoDeepLock() -{ - conf->setGroup("GLOBAL"); - return conf->readBoolEntry("autoDeepLock", CONF_DEFAULT_AUTODEEPLOCK); -} - -bool Configuration_31compat::confGlobKwalletEmu() -{ - conf->setGroup("GLOBAL"); - return conf->readBoolEntry("kwalletEmu", CONF_DEFAULT_KWALLETEMU); -} - -bool Configuration_31compat::confGlobNewEntrLockStat() -{ - conf->setGroup("GLOBAL"); - return conf->readBoolEntry("newEntrLockStat", CONF_DEFAULT_NEWENTRLOCKSTAT); -} - -QSize Configuration_31compat::confWndMainWndSize() -{ - conf->setGroup("WND"); -#ifndef PWM_EMBEDDED - return conf->readSizeEntry("MainWndSize"); -#else - return conf->readSizeEntry("MainWndSize", 0); -#endif -} - -int Configuration_31compat::confWndMainViewStyle() -{ - conf->setGroup("WND"); - return conf->readNumEntry("MainViewStyle", CONF_DEFAULT_MAINVIEWSTYLE); -} - -bool Configuration_31compat::confWndAutoMinimizeOnStart() -{ - conf->setGroup("WND"); - return conf->readBoolEntry("autoMinimizeOnStart", CONF_DEFAULT_AUTOMINIMIZE); -} - -bool Configuration_31compat::confWndClose() -{ - conf->setGroup("WND"); - return conf->readBoolEntry("close", CONF_DEFAULT_WNDCLOSE); -} - -/******************************************************************* - * functions for writing the configuration settings - *******************************************************************/ - -void Configuration_31compat::confGlobAutoStart(const QString &e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("autoStart", e); -} - -void Configuration_31compat::confGlobBrowserCommand(const QString &e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("browserCommand", e); -} - -void Configuration_31compat::confGlobXtermCommand(const QString &e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("xtermCommand", e); -} - -void Configuration_31compat::confGlobEntryFont(const QFont &e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("entryFont", e); -} - -void Configuration_31compat::confGlobPwTimeout(int e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("pwTimeout", e); -} - -void Configuration_31compat::confGlobLockTimeout(int e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("lockTimeout", e); -} - -void Configuration_31compat::confGlobCompression(int e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("compression", e); -} - -void Configuration_31compat::confGlobFilePermissions(int e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("filePermissions", e); -} - -void Configuration_31compat::confGlobMinimizeLock(int e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("minimizeLock", e); -} - -void Configuration_31compat::confGlobUnlockOnOpen(bool e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("unlockOnOpen", e); -} - -void Configuration_31compat::confGlobTray(bool e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("tray", e); -} - -void Configuration_31compat::confGlobMakeFileBackup(bool e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("makeFileBackup", e); -} - -void Configuration_31compat::confGlobAutostartDeepLocked(bool e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("autostartDeeplocked", e); -} - -void Configuration_31compat::confGlobAutoDeepLock(bool e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("autoDeepLock", e); -} - -void Configuration_31compat::confGlobKwalletEmu(bool e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("kwalletEmu", e); -} - -void Configuration_31compat::confGlobNewEntrLockStat(bool e) -{ - conf->setGroup("GLOBAL"); - conf->writeEntry("newEntrLockStat", e); -} - -void Configuration_31compat::confWndMainWndSize(const QSize &e) -{ - conf->setGroup("WND"); - conf->writeEntry("MainWndSize", e); -} - -void Configuration_31compat::confWndMainViewStyle(int e) -{ - conf->setGroup("WND"); - conf->writeEntry("MainViewStyle", e); -} - -void Configuration_31compat::confWndAutoMinimizeOnStart(bool e) -{ - conf->setGroup("WND"); - conf->writeEntry("autoMinimizeOnStart", e); -} - -void Configuration_31compat::confWndClose(bool e) -{ - conf->setGroup("WND"); - conf->writeEntry("close", e); -} diff --git a/pwmanager/pwmanager/configuration_31compat.h b/pwmanager/pwmanager/configuration_31compat.h deleted file mode 100644 index 8ad6e09..0000000 --- a/pwmanager/pwmanager/configuration_31compat.h +++ b/dev/null @@ -1,146 +0,0 @@ -/*************************************************************************** - * * - * copyright (C) 2004 by Michael Buesch * - * email: mbuesch@freenet.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License version 2 * - * as published by the Free Software Foundation. * - * * - ***************************************************************************/ - -/*************************************************************************** - * copyright (C) 2004 by Ulf Schenk - * This file is originaly based on version 1.0.1 of pwmanager - * and was modified to run on embedded devices that run microkde - * - * $Id$ - **************************************************************************/ - -#ifndef CONFIGURATION_31COMPAT_H -#define CONFIGURATION_31COMPAT_H - -#include "pwmexception.h" - -#include <qsize.h> -#include <qfont.h> -#include <qstring.h> - -#ifdef PWM_EMBEDDED -#include <configuration.h> -#endif - -class KConfig; - -/** This class is the compatibility layer for - * running the new KDE-3.2 Configuration interface on KDE-3.1. - * We have to keep this class in sync with the real configuration - * interface. - */ -class Configuration_31compat -{ -public: - Configuration_31compat(); - ~Configuration_31compat(); - - static Configuration_31compat * obj() - { - PWM_ASSERT(_obj); - return _obj; - } - static void init() - { - PWM_ASSERT(!_obj); - _obj = new Configuration_31compat; - } - static void cleanup() - { delete_ifnot_null(_obj); } - - - /** Read the configuration from the file. - * Normally this function has not to be called manually. - * - * This function is a NOP in KDE-3.1 compatibility layer. - */ - void readConfig() - { } - /** Write the configuration to the file. - * Normally this function has not to be called manually. - * - * This function is a NOP in KDE-3.1 compatibility layer. - */ - void writeConfig() - { } - /** reset the whole configuration to its defaults. - * - * This function is a NOP in KDE-3.1 compatibility layer. - * It should not be, but it is. :) - */ - void resetConfig() - { } - /** show the configuration window */ - bool showConfWnd(QWidget *parent); - -public: - /* functions for reading the configuration settings */ - /* GLOBAL */ - QString confGlobAutoStart(); - QString confGlobBrowserCommand(); - QString confGlobXtermCommand(); - QFont confGlobEntryFont(); - int confGlobPwTimeout(); - int confGlobLockTimeout(); - int confGlobCompression(); - int confGlobFilePermissions(); - int confGlobMinimizeLock(); - bool confGlobUnlockOnOpen(); - bool confGlobTray(); - bool confGlobMakeFileBackup(); - bool confGlobAutostartDeepLocked(); - bool confGlobAutoDeepLock(); - bool confGlobKwalletEmu(); - bool confGlobNewEntrLockStat(); - /* WND */ - QSize confWndMainWndSize(); - int confWndMainViewStyle(); - bool confWndAutoMinimizeOnStart(); - bool confWndClose(); - -public: - /* functions for writing the configuration settings */ - /* GLOBAL */ - void confGlobAutoStart(const QString &e); - void confGlobBrowserCommand(const QString &e); - void confGlobXtermCommand(const QString &e); - void confGlobEntryFont(const QFont &e); - void confGlobPwTimeout(int e); - void confGlobLockTimeout(int e); - void confGlobCompression(int e); - void confGlobFilePermissions(int e); - void confGlobMinimizeLock(int e); - void confGlobUnlockOnOpen(bool e); - void confGlobTray(bool e); - void confGlobMakeFileBackup(bool e); - void confGlobAutostartDeepLocked(bool e); - void confGlobAutoDeepLock(bool e); - void confGlobKwalletEmu(bool e); - void confGlobNewEntrLockStat(bool e); - /* WND */ - void confWndMainWndSize(const QSize &e); - void confWndMainViewStyle(int e); - void confWndAutoMinimizeOnStart(bool e); - void confWndClose(bool e); - -protected: - /** static instance of this class returned by obj() */ - static Configuration_31compat *_obj; - /** configuration object */ - KConfig *conf; -}; - -#ifdef Configuration -# error "Configuration already defined!" -#endif -#define Configuration Configuration_31compat - -#endif diff --git a/pwmanager/pwmanager/configwnd.cpp b/pwmanager/pwmanager/configwnd.cpp deleted file mode 100644 index 108c40f..0000000 --- a/pwmanager/pwmanager/configwnd.cpp +++ b/dev/null @@ -1,265 +0,0 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'configwnd.ui' -** -** Created: Tue Sep 14 15:20:58 2004 -** by: The User Interface Compiler ($Id$) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ - -#include "configwnd.h" - -#include <qvariant.h> -#include <qpushbutton.h> -#include <qtabwidget.h> -#include <qwidget.h> -#include <qcombobox.h> -#include <qlabel.h> -#include <qlineedit.h> -#include <qcheckbox.h> -#include <qspinbox.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qwhatsthis.h> - -/* - * Constructs a configWnd as a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - * - * The dialog will by default be modeless, unless you set 'modal' to - * TRUE to construct a modal dialog. - */ -configWnd::configWnd( QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, fl ) -{ - if ( !name ) - setName( "configWnd" ); - - okButton = new QPushButton( this, "okButton" ); - okButton->setGeometry( QRect( 10, 280, 107, 27 ) ); - - cancelButton = new QPushButton( this, "cancelButton" ); - cancelButton->setGeometry( QRect( 370, 280, 107, 27 ) ); - - tabWidget2 = new QTabWidget( this, "tabWidget2" ); - tabWidget2->setGeometry( QRect( 10, 10, 470, 260 ) ); - - ////////////////////////////// - tab = new QWidget( tabWidget2, "tab" ); - - windowStyleComboBox = new QComboBox( FALSE, tab, "windowStyleComboBox" ); - windowStyleComboBox->setGeometry( QRect( 220, 180, 210, 28 ) ); - - textLabel1_5 = new QLabel( tab, "textLabel1_5" ); - textLabel1_5->setGeometry( QRect( 30, 180, 180, 20 ) ); - textLabel1_5->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - - textLabel1_4 = new QLabel( tab, "textLabel1_4" ); - textLabel1_4->setGeometry( QRect( 30, 40, 400, 20 ) ); - - selEntrFontButton = new QPushButton( tab, "selEntrFontButton" ); - selEntrFontButton->setGeometry( QRect( 30, 90, 160, 27 ) ); - - currEntrFont = new QLabel( tab, "currEntrFont" ); - currEntrFont->setGeometry( QRect( 30, 70, 230, 20 ) ); - tabWidget2->insertTab( tab, QString("") ); - ////////////////////////////////////// - TabPage = new QWidget( tabWidget2, "TabPage" ); - - compressionComboBox = new QComboBox( FALSE, TabPage, "compressionComboBox" ); - compressionComboBox->setGeometry( QRect( 290, 50, 150, 28 ) ); - - textLabel1_6 = new QLabel( TabPage, "textLabel1_6" ); - textLabel1_6->setGeometry( QRect( 10, 50, 270, 20 ) ); - textLabel1_6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - - textLabel1_8 = new QLabel( TabPage, "textLabel1_8" ); - textLabel1_8->setGeometry( QRect( 10, 90, 270, 20 ) ); - textLabel1_8->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - - permissionLineEdit = new QLineEdit( TabPage, "permissionLineEdit" ); - permissionLineEdit->setGeometry( QRect( 290, 90, 142, 27 ) ); - permissionLineEdit->setMaxLength( 3 ); - - fileBackupCheckBox = new QCheckBox( TabPage, "fileBackupCheckBox" ); - fileBackupCheckBox->setGeometry( QRect( 80, 140, 360, 23 ) ); - tabWidget2->insertTab( TabPage, QString("") ); - ////////////////////////////////////// - tab_2 = new QWidget( tabWidget2, "tab_2" ); - - pwTimeoutSpinBox = new QSpinBox( tab_2, "pwTimeoutSpinBox" ); - pwTimeoutSpinBox->setGeometry( QRect( 390, 50, 55, 23 ) ); - - textLabel1 = new QLabel( tab_2, "textLabel1" ); - textLabel1->setGeometry( QRect( 10, 20, 370, 80 ) ); - textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); - - textLabel1_7 = new QLabel( tab_2, "textLabel1_7" ); - textLabel1_7->setGeometry( QRect( 10, 110, 370, 80 ) ); - textLabel1_7->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); - - lockTimeoutSpinBox = new QSpinBox( tab_2, "lockTimeoutSpinBox" ); - lockTimeoutSpinBox->setGeometry( QRect( 390, 140, 55, 23 ) ); - - autoDeepLockCheckBox = new QCheckBox( tab_2, "autoDeepLockCheckBox" ); - autoDeepLockCheckBox->setGeometry( QRect( 60, 180, 380, 25 ) ); - tabWidget2->insertTab( tab_2, QString("") ); - /////////////////////////////////////////// - tab_3 = new QWidget( tabWidget2, "tab_3" ); - - textLabel1_3 = new QLabel( tab_3, "textLabel1_3" ); - textLabel1_3->setGeometry( QRect( 30, 30, 400, 20 ) ); - - autoStartLineEdit = new QLineEdit( tab_3, "autoStartLineEdit" ); - autoStartLineEdit->setGeometry( QRect( 30, 50, 360, 20 ) ); - - browseAutoStButton = new QPushButton( tab_3, "browseAutoStButton" ); - browseAutoStButton->setGeometry( QRect( 400, 50, 30, 20 ) ); - - autostartDeeplockedCheckBox = new QCheckBox( tab_3, "autostartDeeplockedCheckBox" ); - autostartDeeplockedCheckBox->setGeometry( QRect( 40, 80, 390, 25 ) ); - tabWidget2->insertTab( tab_3, QString("") ); - //////////////////////////////////////////// - tab_4 = new QWidget( tabWidget2, "tab_4" ); - - textLabel2 = new QLabel( tab_4, "textLabel2" ); - textLabel2->setGeometry( QRect( 20, 40, 280, 20 ) ); - textLabel2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - - browserLineEdit = new QLineEdit( tab_4, "browserLineEdit" ); - browserLineEdit->setGeometry( QRect( 310, 40, 130, 27 ) ); - - xtermLineEdit = new QLineEdit( tab_4, "xtermLineEdit" ); - xtermLineEdit->setGeometry( QRect( 310, 100, 130, 27 ) ); - - textLabel3 = new QLabel( tab_4, "textLabel3" ); - textLabel3->setGeometry( QRect( 20, 100, 280, 20 ) ); - textLabel3->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - tabWidget2->insertTab( tab_4, QString("") ); - /////////////////////////////////////////////// - tab_5 = new QWidget( tabWidget2, "tab_5" ); - - trayCheckBox = new QCheckBox( tab_5, "trayCheckBox" ); - trayCheckBox->setGeometry( QRect( 30, 30, 400, 20 ) ); - - openUnlockedCheckBox = new QCheckBox( tab_5, "openUnlockedCheckBox" ); - openUnlockedCheckBox->setGeometry( QRect( 30, 80, 400, 20 ) ); - - autoMinimizeCheckBox = new QCheckBox( tab_5, "autoMinimizeCheckBox" ); - autoMinimizeCheckBox->setEnabled( FALSE ); - autoMinimizeCheckBox->setGeometry( QRect( 50, 50, 380, 25 ) ); - - minimizeLockComboBox = new QComboBox( FALSE, tab_5, "minimizeLockComboBox" ); - minimizeLockComboBox->setGeometry( QRect( 310, 170, 120, 27 ) ); - - textLabel1_9 = new QLabel( tab_5, "textLabel1_9" ); - textLabel1_9->setGeometry( QRect( 30, 180, 270, 20 ) ); - textLabel1_9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - - kwalletEmuCheckBox = new QCheckBox( tab_5, "kwalletEmuCheckBox" ); - kwalletEmuCheckBox->setGeometry( QRect( 30, 110, 400, 25 ) ); - - wndCloseCheckBox = new QCheckBox( tab_5, "wndCloseCheckBox" ); - wndCloseCheckBox->setGeometry( QRect( 30, 140, 430, 24 ) ); - tabWidget2->insertTab( tab_5, QString("") ); - languageChange(); - resize( QSize(490, 318).expandedTo(minimumSizeHint()) ); - clearWState( WState_Polished ); - - // signals and slots connections - connect( okButton, SIGNAL( clicked() ), this, SLOT( okButton_slot() ) ); - connect( cancelButton, SIGNAL( clicked() ), this, SLOT( cancelButton_slot() ) ); - connect( browseAutoStButton, SIGNAL( clicked() ), this, SLOT( browseAutoStButton_slot() ) ); - connect( selEntrFontButton, SIGNAL( clicked() ), this, SLOT( selEntrFontButton_slot() ) ); - connect( trayCheckBox, SIGNAL( toggled(bool) ), autoMinimizeCheckBox, SLOT( setEnabled(bool) ) ); - - // tab order - setTabOrder( pwTimeoutSpinBox, trayCheckBox ); - setTabOrder( trayCheckBox, okButton ); - setTabOrder( okButton, cancelButton ); -} - -/* - * Destroys the object and frees any allocated resources - */ -configWnd::~configWnd() -{ - // no need to delete child widgets, Qt does it all for us -} - -/* - * Sets the strings of the subwidgets using the current - * language. - */ -void configWnd::languageChange() -{ - setCaption( tr( "PwManager Configuration" ) ); - okButton->setText( tr( "&OK" ) ); - //US ENH okButton->setAccel( QKeySequence( tr( "Alt+O" ) ) ); - cancelButton->setText( tr( "&Cancel" ) ); - //US ENH cancelButton->setAccel( QKeySequence( tr( "Alt+C" ) ) ); - windowStyleComboBox->clear(); - windowStyleComboBox->insertItem( tr( "Category on top" ) ); - windowStyleComboBox->insertItem( tr( "Category-list left" ) ); - textLabel1_5->setText( tr( "Window-style:" ) ); - textLabel1_4->setText( tr( "Font for the password entries:" ) ); - selEntrFontButton->setText( tr( "select Font" ) ); - currEntrFont->setText( QString::null ); - tabWidget2->changeTab( tab, tr( "Look && feel" ) ); - compressionComboBox->clear(); - compressionComboBox->insertItem( tr( "none" ) ); - compressionComboBox->insertItem( tr( "gzip" ) ); - compressionComboBox->insertItem( tr( "bzip2" ) ); - textLabel1_6->setText( tr( "*.pwm file compression:" ) ); - textLabel1_8->setText( tr( "permissions:" ) ); - fileBackupCheckBox->setText( tr( "Make file backup before saving" ) ); - tabWidget2->changeTab( TabPage, tr( "File" ) ); - textLabel1->setText( tr( "Password timeout (timeout to hold password in memory, so you don't have to re-enter it, if you already have entered it) [set to 0 to disable]:" ) ); - textLabel1_7->setText( tr( "Auto-lock timeout (auto lock document after this amount of seconds) [set to 0 to disable]:" ) ); - autoDeepLockCheckBox->setText( tr( "deep-lock on autolock" ) ); - tabWidget2->changeTab( tab_2, tr( "Timeout" ) ); - textLabel1_3->setText( tr( "Open this file automatically on startup:" ) ); - browseAutoStButton->setText( tr( "..." ) ); - autostartDeeplockedCheckBox->setText( tr( "open deeplocked" ) ); - tabWidget2->changeTab( tab_3, tr( "Autostart" ) ); - textLabel2->setText( tr( "Favourite browser:" ) ); - textLabel3->setText( tr( "Favourite X-terminal:" ) ); - tabWidget2->changeTab( tab_4, tr( "External apps" ) ); - trayCheckBox->setText( tr( "Show icon in system-tray" ) ); - openUnlockedCheckBox->setText( tr( "Open document with passwords unlocked" ) ); - autoMinimizeCheckBox->setText( tr( "auto-minimize to tray on startup" ) ); - minimizeLockComboBox->clear(); - minimizeLockComboBox->insertItem( tr( "don't lock" ) ); - minimizeLockComboBox->insertItem( tr( "normal lock" ) ); - minimizeLockComboBox->insertItem( tr( "deep-lock" ) ); - textLabel1_9->setText( tr( "auto-lock on minimize:" ) ); - kwalletEmuCheckBox->setText( tr( "KWallet emulation" ) ); - wndCloseCheckBox->setText( tr( "Do not minimize windows into tray. (Close the window)" ) ); - tabWidget2->changeTab( tab_5, tr( "Miscellaneous" ) ); -} - -void configWnd::okButton_slot() -{ - qWarning( "configWnd::okButton_slot(): Not implemented yet" ); -} - -void configWnd::cancelButton_slot() -{ - qWarning( "configWnd::cancelButton_slot(): Not implemented yet" ); -} - -void configWnd::browseBgButton_slot() -{ - qWarning( "configWnd::browseBgButton_slot(): Not implemented yet" ); -} - -void configWnd::browseAutoStButton_slot() -{ - qWarning( "configWnd::browseAutoStButton_slot(): Not implemented yet" ); -} - -void configWnd::selEntrFontButton_slot() -{ - qWarning( "configWnd::selEntrFontButton_slot(): Not implemented yet" ); -} - diff --git a/pwmanager/pwmanager/configwnd.h b/pwmanager/pwmanager/configwnd.h deleted file mode 100644 index 608a38b..0000000 --- a/pwmanager/pwmanager/configwnd.h +++ b/dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** Form interface generated from reading ui file 'configwnd.ui' -** -** Created: Tue Sep 14 15:20:50 2004 -** by: The User Interface Compiler ($Id$) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ - -#ifndef CONFIGWND_H -#define CONFIGWND_H - -#include <qvariant.h> -#include <qdialog.h> - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QSpacerItem; -class QPushButton; -class QTabWidget; -class QWidget; -class QComboBox; -class QLabel; -class QLineEdit; -class QCheckBox; -class QSpinBox; - -class configWnd : public QDialog -{ - Q_OBJECT - -public: - configWnd( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~configWnd(); - - QPushButton* okButton; - QPushButton* cancelButton; - QTabWidget* tabWidget2; - QWidget* tab; - QComboBox* windowStyleComboBox; - QLabel* textLabel1_5; - QLabel* textLabel1_4; - QPushButton* selEntrFontButton; - QLabel* currEntrFont; - QWidget* TabPage; - QComboBox* compressionComboBox; - QLabel* textLabel1_6; - QLabel* textLabel1_8; - QLineEdit* permissionLineEdit; - QCheckBox* fileBackupCheckBox; - QWidget* tab_2; - QSpinBox* pwTimeoutSpinBox; - QLabel* textLabel1; - QLabel* textLabel1_7; - QSpinBox* lockTimeoutSpinBox; - QCheckBox* autoDeepLockCheckBox; - QWidget* tab_3; - QLabel* textLabel1_3; - QLineEdit* autoStartLineEdit; - QPushButton* browseAutoStButton; - QCheckBox* autostartDeeplockedCheckBox; - QWidget* tab_4; - QLabel* textLabel2; - QLineEdit* browserLineEdit; - QLineEdit* xtermLineEdit; - QLabel* textLabel3; - QWidget* tab_5; - QCheckBox* trayCheckBox; - QCheckBox* openUnlockedCheckBox; - QCheckBox* autoMinimizeCheckBox; - QComboBox* minimizeLockComboBox; - QLabel* textLabel1_9; - QCheckBox* kwalletEmuCheckBox; - QCheckBox* wndCloseCheckBox; - -public slots: - virtual void okButton_slot(); - virtual void cancelButton_slot(); - virtual void browseBgButton_slot(); - virtual void browseAutoStButton_slot(); - virtual void selEntrFontButton_slot(); - -protected: - -protected slots: - virtual void languageChange(); - -}; - -#endif // CONFIGWND_H diff --git a/pwmanager/pwmanager/configwndimpl.cpp b/pwmanager/pwmanager/configwndimpl.cpp deleted file mode 100644 index 5440498..0000000 --- a/pwmanager/pwmanager/configwndimpl.cpp +++ b/dev/null @@ -1,136 +0,0 @@ -/*************************************************************************** - * * - * copyright (C) 2003 by Michael Buesch * - * email: mbuesch@freenet.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License version 2 * - * as published by the Free Software Foundation. * - * * - ***************************************************************************/ - - -/*************************************************************************** - * copyright (C) 2004 by Ulf Schenk - * This file is originaly based on version 1.0.1 of pwmanager - * and was modified to run on embedded devices that run microkde - * - * $Id$ - **************************************************************************/ - -#include "configwndimpl.h" -#include "pwm.h" -#include "configuration.h" - -#include <qfileinfo.h> -#include <qlineedit.h> - -#include <kstandarddirs.h> -#include <kfiledialog.h> -#include <klocale.h> - -#include <stdlib.h> -#include <stdio.h> - -#ifdef PWM_EMBEDDED -#include <kfontdialog.h> -#endif - -ConfigWndImpl::ConfigWndImpl() -#ifdef PWM_EMBEDDED - : configWnd(0, "ConfigWndImpl", TRUE) -#endif - -{ -} - -ConfigWndImpl::~ConfigWndImpl() -{ -} - -void ConfigWndImpl::okButton_slot() -{ - done(0); -} - -void ConfigWndImpl::cancelButton_slot() -{ - done(1); -} - -void ConfigWndImpl::browseAutoStButton_slot() -{ -#ifndef PWM_EMBEDDED - QString path(KFileDialog::getOpenFileName(QString::null, - i18n("*.pwm|PwM Password file\n" - "*|All files"), this)); -#else - QString path = locateLocal( "data", KGlobal::getAppName() + "/*.pwm"); - path = KFileDialog::getOpenFileName(path, - i18n("password filename(*.pwm)"), this); -#endif - if (path != QString::null) - autoStartLineEdit->setText(path); -} - -void ConfigWndImpl::selEntrFontButton_slot() -{ - bool ok; -#ifndef PWM_EMBEDDED - QFont fnt = QFontDialog::getFont(&ok, currentEntryFont, this); -#else - QFont fnt = KFontDialog::getFont(currentEntryFont, ok); -#endif - if (!ok) - return; - currEntrFont->setFont(fnt); - currEntrFont->setText(fnt.family()); - currentEntryFont = fnt; -} - -int ConfigWndImpl::getFilePermissions() -{ - char octalDigits[] = "01234567"; - bool isOctal; - QString permString(permissionLineEdit->text()); - int i, j, length = permString.length(); - if (length != 3) { - printWarn("Wrong permission string length! Please enter " - "the string like the following example: 600"); - return CONF_DEFAULT_FILEPERMISSIONS; - } - for (i = 0; i < length; ++i) { - isOctal = false; - for (j = 0; j < 8; ++j) { - if (permString.at(i) == octalDigits[j]) { - isOctal = true; - break; - } - } - if (!isOctal) { - printWarn("CONFIG: File-permissions: This is " - "not an octal number "); - return CONF_DEFAULT_FILEPERMISSIONS; - } - } - - int ret = strtol(permString.latin1(), 0, 8); - if (ret == 0) { - /* either an error occured, or the user did really type 000 */ - printWarn("CONFIG: File-permissions: Hm, either conversion error, " - "or you really typed 000. 8-)"); - return CONF_DEFAULT_FILEPERMISSIONS; - } - return ret; -} - -void ConfigWndImpl::setFilePermissions(int perm) -{ - char tmpBuf[30]; - sprintf(tmpBuf, "%o", perm); - permissionLineEdit->setText(tmpBuf); -} - -#ifndef PWM_EMBEDDED -#include "configwndimpl.moc" -#endif diff --git a/pwmanager/pwmanager/configwndimpl.h b/pwmanager/pwmanager/configwndimpl.h deleted file mode 100644 index f67f459..0000000 --- a/pwmanager/pwmanager/configwndimpl.h +++ b/dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * * - * copyright (C) 2003 by Michael Buesch * - * email: mbuesch@freenet.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License version 2 * - * as published by the Free Software Foundation. * - * * - ***************************************************************************/ - - -/*************************************************************************** - * copyright (C) 2004 by Ulf Schenk - * This file is originaly based on version 1.0.1 of pwmanager - * and was modified to run on embedded devices that run microkde - * - * $Id$ - **************************************************************************/ - -#ifndef CONFIGWNDIMPL_H -#define CONFIGWNDIMPL_H - -#include <qfontdialog.h> - -#include "configwnd.h" - -/** "add" Window */ -class ConfigWndImpl : public configWnd -{ - Q_OBJECT -public: - ConfigWndImpl(); - ~ConfigWndImpl(); - - /** currently selected entry-font */ - QFont currentEntryFont; - - /** gets the content of permissionLineEdit */ - int getFilePermissions(); - /** sets the content of permissionLineEdit */ - void setFilePermissions(int perm); - -public slots: - /** OK button pressed */ - void okButton_slot(); - /** cancel button pressed */ - void cancelButton_slot(); - /** browse autostart file button pressed */ - void browseAutoStButton_slot(); - /** select entry-font button pressed */ - void selEntrFontButton_slot(); -}; - -#endif |