[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/dialogs
From:       Pino Toscano <toscano.pino () tiscali ! it>
Date:       2006-10-20 18:27:17
Message-ID: 1161368837.730490.20950.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 597561 by pino:

Add new versions of the static getPassword and getNewPassword that take a string with \
the caption for the dialog. Changed the pointer 'keep' parameter of getPassword from \
int to bool, more logic. Left the old two functions and marked them as deprecated.


 M  +26 -3     kpassworddialog.cpp  
 M  +20 -4     kpassworddialog.h  


--- trunk/KDE/kdelibs/kdeui/dialogs/kpassworddialog.cpp #597560:597561
@@ -526,11 +526,12 @@
 }
 
 
-int KPasswordDialog::getPassword(QWidget *parent,QByteArray &password, const QString \
                &prompt,
-	int *keep)
+int KPasswordDialog::getPassword(QWidget *parent, QByteArray &password, const \
QString &caption, +    const QString &prompt, bool *keep)
 {
     const bool enableKeep = (keep && *keep);
     KPasswordDialog* const dlg = new KPasswordDialog(Password, \
enableKeep,false,parent); +    dlg->setWindowTitle(caption);
     dlg->setPrompt(prompt);
     const int ret = dlg->exec();
     if (ret == Accepted) {
@@ -542,10 +543,27 @@
     return ret;
 }
 
+int KPasswordDialog::getPassword(QWidget *parent, QByteArray &password, const \
QString &prompt, +	int *keep)
+{
+    int res = KPasswordDialog::Rejected;
+    if (keep) {
+        bool boolkeep = *keep;
+        res = getPassword(parent, password, i18n("Password Input"), prompt, \
&boolkeep); +        *keep = boolkeep;
+    }
+    else {
+        res = getPassword(parent, password, i18n("Password Input"), prompt);
+    }
+    return res;
+}
 
-int KPasswordDialog::getNewPassword(QWidget *parent,QByteArray &password, const \
QString &prompt) +
+int KPasswordDialog::getNewPassword(QWidget *parent, QByteArray &password, const \
QString &caption, +    const QString &prompt)
 {
     KPasswordDialog* const dlg = new KPasswordDialog(NewPassword, \
false,false,parent); +    dlg->setWindowTitle(caption);
     dlg->setPrompt(prompt);
     const int ret = dlg->exec();
     if (ret == Accepted)
@@ -554,7 +572,12 @@
     return ret;
 }
 
+int KPasswordDialog::getNewPassword(QWidget *parent, QByteArray &password, const \
QString &prompt) +{
+    return getNewPassword(parent, password, i18n("Password Input"), prompt);
+}
 
+
 // static
 void KPasswordDialog::disableCoreDumps()
 {
--- trunk/KDE/kdelibs/kdeui/dialogs/kpassworddialog.h #597560:597561
@@ -315,30 +315,46 @@
      *
      * @param parent The widget the dialog belongs too
      * @param password The password is returned in this reference parameter.
+     * @param caption A caption for the dialog.
      * @param prompt A prompt for the password. This can be a few lines of
      * information. The text is word broken to fit nicely in the dialog.
      * @param keep Enable/disable a checkbox controlling password keeping.
-     * If you pass a null pointer, or a pointer to the value 0, the checkbox
-     * is not shown. If you pass a pointer to a nonzero value, the checkbox
+     * If you pass a null pointer, or a pointer to the value false, the checkbox
+     * is not shown. If you pass a pointer to a true value, the checkbox
      * is shown and the result is stored in *keep.
      * @return Result code: Accepted or Rejected.
      */
-    static int getPassword(QWidget *parent,QByteArray &password, const QString \
&prompt, int *keep=0L); +    static int getPassword(QWidget *parent, QByteArray \
&password, const QString &caption, const QString &prompt, bool *keep = 0L);  
     /**
+     * @overload
+     *
+     * @deprecated Use the new version with the caption argument
+     */
+    static KDE_DEPRECATED int getPassword(QWidget *parent, QByteArray &password, \
const QString &prompt, int *keep = 0L); +
+    /**
      * Pops up the dialog, asks the user for a password and returns it. The
      * user has to enter the password twice to make sure it was entered
      * correctly.
      *
      * @param parent The widget the dialog belongs too
      * @param password The password is returned in this reference parameter.
+     * @param caption A caption for the dialog.
      * @param prompt A prompt for the password. This can be a few lines of
      * information. The text is word broken to fit nicely in the dialog.
      * @return Result code: Accepted or Rejected.
      */
-    static int getNewPassword(QWidget *parent,QByteArray &password, const QString \
&prompt); +    static int getNewPassword(QWidget *parent, QByteArray &password, const \
QString &caption, const QString &prompt);  
     /**
+     * @overload
+     *
+     * @deprecated Use the new version with the caption argument
+     */
+    static KDE_DEPRECATED int getNewPassword(QWidget *parent, QByteArray &password, \
const QString &prompt); +
+    /**
      * Static helper function that disables core dumps.
      */
     static void disableCoreDumps();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic