summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/configwndimpl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/configwndimpl.cpp b/pwmanager/pwmanager/configwndimpl.cpp
index 595a6e7..5440498 100644
--- a/pwmanager/pwmanager/configwndimpl.cpp
+++ b/pwmanager/pwmanager/configwndimpl.cpp
@@ -1,136 +1,136 @@
/***************************************************************************
* *
* 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(filename,
+ 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