Adapted to new KPasswordEdit::password() signature. This relates to bug 2961.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/20/head
Michele Calgaro 5 years ago
parent 3c2da5f0e1
commit 6ae10fc66e
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -1620,13 +1620,13 @@ void KCryptoConfig::slotYourImport() {
#ifdef HAVE_SSL
KSSLPKCS12 *cert = NULL;
TQCString pass;
TQString pass;
TryImportPassAgain:
int rc = KPasswordDialog::getPassword(pass, i18n("Certificate password"));
if (rc != KPasswordDialog::Accepted) return;
cert = KSSLPKCS12::loadCertFile(certFile, TQString(pass));
cert = KSSLPKCS12::loadCertFile(certFile, pass);
if (!cert) {
rc = KMessageBox::warningYesNo(this, i18n("The certificate file could not be loaded. Try a different password?"), i18n("SSL"),i18n("Try"),i18n("Do Not Try"));
@ -1681,7 +1681,7 @@ YourCertItem *x = static_cast<YourCertItem *>(yourSSLBox->selectedItem());
pkcs = KSSLPKCS12::fromString(x->getPKCS(), x->getPassCache());
if (!pkcs) {
TQString pprompt = i18n("Enter the certificate password:");
TQCString oldpass;
TQString oldpass;
do {
int i = KPasswordDialog::getPassword(oldpass, pprompt);
if (i != KPasswordDialog::Accepted) return;
@ -1713,7 +1713,7 @@ TQString iss;
pkcs = KSSLPKCS12::fromString(x->getPKCS(), x->getPassCache());
if (!pkcs) {
TQString pprompt = i18n("Enter the certificate password:");
TQCString oldpass;
TQString oldpass;
do {
int i = KPasswordDialog::getPassword(oldpass, pprompt);
if (i != KPasswordDialog::Accepted) return;
@ -1761,7 +1761,7 @@ TQString iss;
pkcs = KSSLPKCS12::fromString(x->getPKCS(), x->getPassCache());
if (!pkcs) {
TQString pprompt = i18n("Enter the certificate password:");
TQCString oldpass;
TQString oldpass;
do {
int i = KPasswordDialog::getPassword(oldpass, pprompt);
if (i != KPasswordDialog::Accepted) return;
@ -1851,8 +1851,8 @@ TQString iss;
void KCryptoConfig::slotYourPass() {
YourCertItem *x = static_cast<YourCertItem *>(yourSSLBox->selectedItem());
TQCString oldpass = "";
YourCertItem *x = static_cast<YourCertItem *>(yourSSLBox->selectedItem());
TQString oldpass = "";
if (!x) return;
KSSLPKCS12 *pkcs = KSSLPKCS12::fromString(x->getPKCS(), x->getPass());
@ -1877,8 +1877,8 @@ TQCString oldpass = "";
int i = kpd->exec();
if (i == KPasswordDialog::Accepted) {
TQCString pass = kpd->password();
pkcs->changePassword(TQString(oldpass), TQString(pass));
TQString pass = kpd->password();
pkcs->changePassword(oldpass, pass);
x->setPKCS(pkcs->toString());
x->setPassCache(pass);
configChanged();

@ -169,7 +169,7 @@ bool KCMDnssd::saveMdnsd()
{
mdnsdLines["zone"]=domainedit->text();
mdnsdLines["hostname"]=hostedit->text();
if (!secretedit->text().isEmpty()) mdnsdLines["secret-64"]=TQString(secretedit->password());
if (!secretedit->text().isEmpty()) mdnsdLines["secret-64"]=secretedit->password();
else mdnsdLines.remove("secret-64");
TQFile f(MDNSD_CONF);
bool newfile=!f.exists();

@ -90,7 +90,8 @@ CryptPasswordDialog::~CryptPasswordDialog()
TQByteArray CryptPasswordDialog::password() {
if (m_base->textPasswordButton->isOn() == true) {
m_password.duplicate(m_base->textPasswordEntry->password(), strlen(m_base->textPasswordEntry->password()));
TQCString pass = m_base->textPasswordEntry->password().utf8();
m_password.duplicate(pass, pass.length());
if (m_useCard) *m_useCard = false;
}
else if (m_base->filePasswordButton->isOn() == true) {
@ -109,7 +110,7 @@ void CryptPasswordDialog::processLockouts() {
m_base->textPasswordEntry->setEnabled(true);
m_base->filePasswordURL->setEnabled(false);
m_base->textPasswordEntry->setFocus();
if (strlen(m_base->textPasswordEntry->password()) > 0) {
if (m_base->textPasswordEntry->password().length() > 0) {
enableButtonOK(true);
}
else {

@ -229,7 +229,7 @@ void TDEHWManager::deviceChanged(TDEGenericDevice* device) {
}
void TDEHWManager::cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice) {
TQCString password;
TQString password;
int result = KPasswordDialog::getPassword(password, prompt);
if (result == KPasswordDialog::Accepted) {
cdevice->setProvidedPin(password);

@ -2719,7 +2719,7 @@ void LockProcess::slotMouseActivity(XEvent *event)
void LockProcess::processInputPipeCommand(TQString inputcommand) {
TQCString command(inputcommand.ascii());
TQString to_display;
const char * pin_entry;
TQString pin_entry;
if (command[0] == 'C') {
while (mDialogControlLock == true) usleep(100000);
@ -2807,7 +2807,8 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) {
pin_entry = qryDlg.getEntry();
mInfoMessageDisplayed=false;
if (mPipeOpen_out == true) {
if (write(mPipe_fd_out, pin_entry, strlen(pin_entry)+1) == -1) {
TQCString pin_entry_utf8 = pin_entry.utf8(); // utf8 length may differ from TQString length
if (write(mPipe_fd_out, pin_entry_utf8.data(), pin_entry_utf8.length()+1) == -1) {
// Error handler to shut up gcc warnings
}
if (write(mPipe_fd_out, "\n\r", 3) == -1) {
@ -2896,7 +2897,7 @@ void LockProcess::signalPassDlgToAttemptCardAbort() {
void LockProcess::cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice) {
TQCString password;
const char * pin_entry;
TQString pin_entry;
QueryDlg qryDlg(this);
qryDlg.updateLabel(prompt);

@ -133,7 +133,7 @@ void QueryDlg::slotOK()
close();
}
const char * QueryDlg::getEntry()
TQString QueryDlg::getEntry()
{
return pin_box->password();
}

@ -38,7 +38,7 @@ class QueryDlg : public TQDialog
void updateLabel( TQString &txt );
void setUnlockIcon();
void setWarningIcon();
const char * getEntry();
TQString getEntry();
private slots:
void slotOK();

@ -483,7 +483,7 @@ int Minicli::runCommand()
proc_checkpwd.setScheduler(m_iScheduler);
}
if (proc_checkpwd.checkInstall(m_dlg->lePassword->password()) != 0)
if (proc_checkpwd.checkInstall(m_dlg->lePassword->password().utf8()) != 0)
{
KMessageBox::sorry(this, i18n("Incorrect password; please try again."));
return 1;
@ -534,7 +534,7 @@ int Minicli::runCommand()
sigprocmask(SIG_BLOCK, &sset, 0L);
proc.setTerminal(true);
proc.setErase(true);
_exit(proc.exec(m_dlg->lePassword->password()));
_exit(proc.exec(m_dlg->lePassword->password().utf8()));
return 0;
}
else

@ -5,10 +5,4 @@ The syntax is very much inspired from the "dialog" command
However the width and height attributes have been removed for
most dialogs - Qt/KDE have layouts ;)
A tutorial on using kdialog is available at
http://developer.kde.org/documentation/tutorials/kdialog/t1.html
If you change or add any functionality, please contact Brad
Hards <bradh@frogmouth.net> to ensure it is reflected in the
tutorial.
Current maintainer: David Faure <faure@kde.org>

@ -279,9 +279,9 @@ static int directCommand(TDECmdLineArgs *args)
// --password text
if (args->isSet("password"))
{
TQCString result;
TQString result;
bool retcode = Widgets::passwordBox(0, title, TQString::fromLocal8Bit(args->getOption("password")), result);
cout << result.data() << endl;
cout << result.utf8() << endl;
return retcode ? 0 : 1;
}

@ -65,7 +65,7 @@ bool Widgets::inputBox(TQWidget *parent, const TQString& title, const TQString&
return ok;
}
bool Widgets::passwordBox(TQWidget *parent, const TQString& title, const TQString& text, TQCString &result)
bool Widgets::passwordBox(TQWidget *parent, const TQString& title, const TQString& text, TQString &result)
{
KPasswordDialog dlg( KPasswordDialog::Password, false, 0, parent );

@ -27,7 +27,7 @@
namespace Widgets
{
bool inputBox(TQWidget *parent, const TQString& title, const TQString& text, const TQString& init, TQString &result);
bool passwordBox(TQWidget *parent, const TQString& title, const TQString& text, TQCString &result);
bool passwordBox(TQWidget *parent, const TQString& title, const TQString& text, TQString &result);
int textBox(TQWidget *parent, int width, int height, const TQString& title, const TQString& file);
int textInputBox(TQWidget *parent, int width, int height, const TQString& title, const TQStringList& args, TQCString &result);
bool listBox(TQWidget *parent, const TQString& title, const TQString& text, const TQStringList& args, const TQString &defaultEntry, TQString &result);

@ -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 )

@ -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);
}

@ -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; }

@ -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:

@ -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;
};

@ -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);

@ -67,11 +67,11 @@ TDEsuDialog::~TDEsuDialog()
{
}
bool TDEsuDialog::checkPassword(const char *password)
bool TDEsuDialog::checkPassword(const TQString &password)
{
SuProcess proc;
proc.setUser(m_User);
int status = proc.checkInstall(password);
int status = proc.checkInstall(password.utf8());
switch (status)
{
case -1:

@ -21,7 +21,7 @@ public:
enum ResultCodes { AsUser = 10 };
protected:
bool checkPassword(const char *password);
bool checkPassword(const TQString &password);
void slotUser1();
private:

@ -344,7 +344,7 @@ static int startApp()
}
// Start the dialog
TQCString password;
TQString password;
if (needpw)
{
TDEStartupInfoId id;
@ -391,7 +391,7 @@ static int startApp()
}
else if (keep && have_daemon)
{
client.setPass(password, timeout);
client.setPass(password.utf8(), timeout);
client.setPriority(priority);
client.setScheduler(scheduler);
int result = client.exec(command, user, options, env);
@ -415,7 +415,7 @@ static int startApp()
proc.setPriority(priority);
proc.setScheduler(scheduler);
proc.setCommand(command);
int result = proc.exec(password);
int result = proc.exec(password.utf8());
return result;
}
return -1;

@ -280,16 +280,16 @@ KClassicGreeter::returnData()
KGreeterPluginHandler::IsUser );
break;
case 1:
handler->gplugReturnText( passwdEdit->password(),
handler->gplugReturnText( passwdEdit->password().utf8(),
KGreeterPluginHandler::IsPassword |
KGreeterPluginHandler::IsSecret );
break;
case 2:
handler->gplugReturnText( passwd1Edit->password(),
handler->gplugReturnText( passwd1Edit->password().utf8(),
KGreeterPluginHandler::IsSecret );
break;
default: // case 3:
handler->gplugReturnText( passwd2Edit->password(),
handler->gplugReturnText( passwd2Edit->password().utf8(),
KGreeterPluginHandler::IsNewPassword |
KGreeterPluginHandler::IsSecret );
break;

@ -325,16 +325,16 @@ KPamGreeter::returnData()
KGreeterPluginHandler::IsUser );
break;
case 1:
handler->gplugReturnText( authEdit[0]->password(),
handler->gplugReturnText( authEdit[0]->password().utf8(),
KGreeterPluginHandler::IsPassword |
KGreeterPluginHandler::IsSecret );
break;
case 2:
handler->gplugReturnText( authEdit[1]->password(),
handler->gplugReturnText( authEdit[1]->password().utf8(),
KGreeterPluginHandler::IsSecret );
break;
default: // case 3:
handler->gplugReturnText( authEdit[2]->password(),
handler->gplugReturnText( authEdit[2]->password().utf8(),
KGreeterPluginHandler::IsNewPassword |
KGreeterPluginHandler::IsSecret );
break;

@ -356,16 +356,16 @@ KWinbindGreeter::returnData()
KGreeterPluginHandler::IsUser );
break;
case 1:
handler->gplugReturnText( passwdEdit->password(),
handler->gplugReturnText( passwdEdit->password().utf8(),
KGreeterPluginHandler::IsPassword |
KGreeterPluginHandler::IsSecret );
break;
case 2:
handler->gplugReturnText( passwd1Edit->password(),
handler->gplugReturnText( passwd1Edit->password().utf8(),
KGreeterPluginHandler::IsSecret );
break;
default: // case 3:
handler->gplugReturnText( passwd2Edit->password(),
handler->gplugReturnText( passwd2Edit->password().utf8(),
KGreeterPluginHandler::IsNewPassword |
KGreeterPluginHandler::IsSecret );
break;

Loading…
Cancel
Save