summaryrefslogtreecommitdiffstats
path: root/tdepasswd
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2018-11-28 00:04:05 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2018-11-28 00:04:05 +0900
commit6ae10fc66ed3c35e98e49bac8bf6670f0a9e2d6b (patch)
tree154aa555033fe887b9b56d8a559000c89b166f1e /tdepasswd
parent3c2da5f0e188e1f1152da840bdf8d94ceb509671 (diff)
downloadtdebase-6ae10fc66ed3c35e98e49bac8bf6670f0a9e2d6b.tar.gz
tdebase-6ae10fc66ed3c35e98e49bac8bf6670f0a9e2d6b.zip
Adapted to new KPasswordEdit::password() signature. This relates to bug 2961.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdepasswd')
-rw-r--r--tdepasswd/kcm/main.cpp4
-rw-r--r--tdepasswd/passwd.cpp4
-rw-r--r--tdepasswd/passwd.h2
-rw-r--r--tdepasswd/passwddlg.cpp19
-rw-r--r--tdepasswd/passwddlg.h12
-rw-r--r--tdepasswd/tdepasswd.cpp8
6 files changed, 25 insertions, 24 deletions
diff --git a/tdepasswd/kcm/main.cpp b/tdepasswd/kcm/main.cpp
index 48478c306..9b11acbcd 100644
--- a/tdepasswd/kcm/main.cpp
+++ b/tdepasswd/kcm/main.cpp
@@ -209,7 +209,7 @@ void KCMUserAccount::save()
/* Save realname to /etc/passwd */
if ( _mw->leRealname->isModified() )
{
- TQCString password;
+ TQString password;
int ret = KPasswordDialog::getPassword( password, i18n("Please enter "
"your password in order to save your settings:"));
@@ -221,7 +221,7 @@ void KCMUserAccount::save()
}
ChfnProcess *proc = new ChfnProcess();
- ret = proc->exec(password, _mw->leRealname->text().ascii() );
+ ret = proc->exec(password.utf8(), _mw->leRealname->text().utf8() );
if ( ret )
{
if ( ret == ChfnProcess::PasswordError )
diff --git a/tdepasswd/passwd.cpp b/tdepasswd/passwd.cpp
index 9d29333fc..6d6d45675 100644
--- a/tdepasswd/passwd.cpp
+++ b/tdepasswd/passwd.cpp
@@ -64,9 +64,9 @@ PasswdProcess::~PasswdProcess()
}
-int PasswdProcess::checkCurrent(const char *oldpass)
+int PasswdProcess::checkCurrent(const TQString &oldpass)
{
- return exec(oldpass, 0L, 1);
+ return exec(oldpass.utf8(), 0L, 1);
}
diff --git a/tdepasswd/passwd.h b/tdepasswd/passwd.h
index a5a75d5ff..83bde9a83 100644
--- a/tdepasswd/passwd.h
+++ b/tdepasswd/passwd.h
@@ -25,7 +25,7 @@ public:
enum Errors { PasswdNotFound=1, PasswordIncorrect, PasswordNotGood };
- int checkCurrent(const char *oldpass);
+ int checkCurrent(const TQString &oldpass);
int exec(const char *oldpass, const char *newpass, int check=0);
TQCString error() { return m_Error; }
diff --git a/tdepasswd/passwddlg.cpp b/tdepasswd/passwddlg.cpp
index b1d5d1a16..f58a29996 100644
--- a/tdepasswd/passwddlg.cpp
+++ b/tdepasswd/passwddlg.cpp
@@ -26,7 +26,7 @@ TDEpasswd1Dialog::~TDEpasswd1Dialog()
}
-bool TDEpasswd1Dialog::checkPassword(const char *password)
+bool TDEpasswd1Dialog::checkPassword(const TQString &password)
{
PasswdProcess proc(0);
@@ -66,7 +66,7 @@ bool TDEpasswd1Dialog::checkPassword(const char *password)
// static
-int TDEpasswd1Dialog::getPassword(TQCString &password)
+int TDEpasswd1Dialog::getPassword(TQString &password)
{
TDEpasswd1Dialog *dlg = new TDEpasswd1Dialog();
int res = dlg->exec();
@@ -78,7 +78,7 @@ int TDEpasswd1Dialog::getPassword(TQCString &password)
-TDEpasswd2Dialog::TDEpasswd2Dialog(const char *oldpass, TQCString user)
+TDEpasswd2Dialog::TDEpasswd2Dialog(const TQString &oldpass, const TQString &user)
: KPasswordDialog(NewPassword, false, Help)
{
m_Pass = oldpass;
@@ -88,7 +88,7 @@ TDEpasswd2Dialog::TDEpasswd2Dialog(const char *oldpass, TQCString user)
if (m_User.isEmpty())
setPrompt(i18n("Please enter your new password:"));
else
- setPrompt(i18n("Please enter the new password for user <b>%1</b>:").arg(static_cast<const char *>(m_User)));
+ setPrompt(i18n("Please enter the new password for user <b>%1</b>:").arg(m_User.utf8().data()));
}
@@ -97,11 +97,12 @@ TDEpasswd2Dialog::~TDEpasswd2Dialog()
}
-bool TDEpasswd2Dialog::checkPassword(const char *password)
+bool TDEpasswd2Dialog::checkPassword(const TQString &password)
{
- PasswdProcess proc(m_User);
+ PasswdProcess proc(m_User.utf8());
+ TQString edit_password = password;
- if (strlen(password) > 8)
+ if (edit_password.length() > 8)
{
switch(KMessageBox::warningYesNoCancel(this,
m_User.isEmpty() ?
@@ -118,7 +119,7 @@ bool TDEpasswd2Dialog::checkPassword(const char *password)
"truncatePassword"))
{
case KMessageBox::Yes :
- const_cast<char *>(password)[8] = '\000';
+ edit_password.truncate(8);
break;
case KMessageBox::No :
break;
@@ -126,7 +127,7 @@ bool TDEpasswd2Dialog::checkPassword(const char *password)
}
}
- int ret = proc.exec(m_Pass, password);
+ int ret = proc.exec(m_Pass.utf8(), edit_password.utf8());
switch (ret)
{
case 0:
diff --git a/tdepasswd/passwddlg.h b/tdepasswd/passwddlg.h
index 88d3be2da..1fef792a4 100644
--- a/tdepasswd/passwddlg.h
+++ b/tdepasswd/passwddlg.h
@@ -20,10 +20,10 @@ public:
TDEpasswd1Dialog();
~TDEpasswd1Dialog();
- static int getPassword(TQCString &password);
+ static int getPassword(TQString &password);
protected:
- bool checkPassword(const char *password);
+ bool checkPassword(const TQString &password);
};
@@ -33,15 +33,15 @@ class TDEpasswd2Dialog
Q_OBJECT
public:
- TDEpasswd2Dialog(const char *oldpass, TQCString user);
+ TDEpasswd2Dialog(const TQString &oldpass, const TQString &user);
~TDEpasswd2Dialog();
protected:
- bool checkPassword(const char *password);
+ bool checkPassword(const TQString &password);
private:
- const char *m_Pass;
- TQCString m_User;
+ TQString m_Pass;
+ TQString m_User;
};
diff --git a/tdepasswd/tdepasswd.cpp b/tdepasswd/tdepasswd.cpp
index 7df4aaf47..41567bf28 100644
--- a/tdepasswd/tdepasswd.cpp
+++ b/tdepasswd/tdepasswd.cpp
@@ -47,21 +47,21 @@ int main(int argc, char **argv)
KUniqueApplication app;
KUser ku;
- TQCString user;
+ TQString user;
bool bRoot = ku.isSuperUser();
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
if (args->count())
- user = args->arg(0);
+ user = TQString(args->arg(0));
/* You must be able to run "tdepasswd loginName" */
- if ( !user.isEmpty() && user!=KUser().loginName().utf8() && !bRoot)
+ if ( !user.isEmpty() && user!=KUser().loginName() && !bRoot)
{
KMessageBox::sorry(0, i18n("You need to be root to change the password of other users."));
return 0;
}
- TQCString oldpass;
+ TQString oldpass;
if (!bRoot)
{
int result = TDEpasswd1Dialog::getPassword(oldpass);