-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 24 September 2002 04:52, Jon Keating wrote:
> On Monday 23 September 2002 05:42 pm, Thomas Reitelbach wrote:
> > - The securitydialog performs 2 actions (1st sets normal security
> > options, 2nd changes password). If one of these fails the user will not
> > see which one failed :( Maybe we should open a info dialog to inform the
> > user)
>
> I haven't had a chance to look at this yet and probably won't for a couple
> of days, but here's what I think would be ideal behaviour. Don't make the
> changed password call unless the password entered is different from the
> saved password. Same thing with the security options. This does not
> address the failed event problem though. Informing the user somehow is
> essential, using a message box will be fine.
Hi guys,
i've got much free time right now, so here it is, my second version of the
patch.
What i've changed:
- - A info box will pop up if a event fails, informing the user about what
exactly failed.
- - updating information on the server is only done if really necessary (=> if
the user really changed something)
- - qt-gui should now compile with QT 2.3, too. cannot test this with kde-gui, i
have no old kde libs.
Bye,
Thomas
- --
_________________________________________________
No I Don't Yahoo!
And I'm getting pretty sick of being asked if I do.
_________________________________________________
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9kLOn+83LmoKU5MARAtP2AJ92Q8S0ckIhekYBv/ZJPhXO+VYGhACgm/yu
gvQjGM5flfw8nHb6k9xyOpU=
=hYE7
-----END PGP SIGNATURE-----
Index: licq/plugins/qt-gui/src/mainwin.cpp
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/mainwin.cpp,v
retrieving revision 1.241
diff -u -3 -p -r1.241 mainwin.cpp
--- licq/plugins/qt-gui/src/mainwin.cpp 11 Sep 2002 01:50:47 -0000 1.241
+++ licq/plugins/qt-gui/src/mainwin.cpp 24 Sep 2002 18:37:13 -0000
@@ -67,13 +67,11 @@
#include "optionsdlg.h"
#include "skin.h"
#include "securitydlg.h"
-#include "passworddlg.h"
#include "plugindlg.h"
#include "randomchatdlg.h"
#include "userinfodlg.h"
#include "usereventdlg.h"
#include "reqauthdlg.h"
-#include "chgpassdlg.h"
#ifdef USE_DOCK
#include "wharf.h"
#endif
@@ -1684,12 +1682,13 @@ void CMainWindow::callOwnerFunction(int
else if (index == OwnerMenuSecurity)
(void) new SecurityDlg(licqDaemon, licqSigMan);
+/*
else if (index == OwnerMenuPassword)
(void) new PasswordDlg(licqDaemon, licqSigMan);
else if (index == OwnerMenuSavedPassword)
(void) new ChangePassDlg();
-
+*/
else if (index == OwnerMenuRandomChat)
(void) new CSetRandomChatGroupDlg(licqDaemon, licqSigMan);
@@ -3020,8 +3019,6 @@ void CMainWindow::initMenu()
mnuOwnerAdm->insertItem(tr("&Last"), OwnerMenuLast);
mnuOwnerAdm->insertSeparator();
mnuOwnerAdm->insertItem(tr("&Security Options"), OwnerMenuSecurity);
- mnuOwnerAdm->insertItem(tr("Change &Password"), OwnerMenuPassword);
- mnuOwnerAdm->insertItem(tr("&Change Saved UIN/Password"), OwnerMenuSavedPassword);
mnuOwnerAdm->insertItem(tr("&Random Chat Group"), OwnerMenuRandomChat);
mnuOwnerAdm->insertSeparator();
mnuOwnerAdm->insertItem(tr("Debug Level"), mnuDebug);
Index: licq/plugins/qt-gui/src/securitydlg.cpp
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/securitydlg.cpp,v
retrieving revision 1.11
diff -u -3 -p -r1.11 securitydlg.cpp
--- licq/plugins/qt-gui/src/securitydlg.cpp 5 Oct 2001 01:47:27 -0000 1.11
+++ licq/plugins/qt-gui/src/securitydlg.cpp 24 Sep 2002 18:37:13 -0000
@@ -15,7 +15,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -26,6 +25,8 @@
#include <qgroupbox.h>
#include <qwhatsthis.h>
#include <qtoolbutton.h>
+#include <qlineedit.h>
+#include <qlabel.h>
#include "ewidgets.h"
#include "securitydlg.h"
@@ -37,17 +38,62 @@
SecurityDlg::SecurityDlg(CICQDaemon *s, CSignalManager *_sigman,
QWidget *parent)
- : QWidget(parent, "SecurityDialog", WStyle_ContextHelp | WDestructiveClose )
+ : QDialog(parent, "SecurityDialog", false, WStyle_ContextHelp | WDestructiveClose )
{
server = s;
sigman = _sigman;
- tag = 0;
+ eSecurityInfo = 0;
+ ePasswordChange = 0;
+
+ unsigned long nUin = gUserManager.OwnerUin();
+ QString strUin;
+ if (nUin)
+ strUin.setNum(nUin);
QVBoxLayout *lay = new QVBoxLayout(this, 8);
- QGroupBox *box = new QGroupBox(tr("Options"), this);
+ QGroupBox *box = new QGroupBox(1, QGroupBox::Horizontal, tr("Options"), this);
lay->addWidget(box);
+
+ QGroupBox *passwordBox = new QGroupBox(2, QGroupBox::Horizontal, tr("Password/UIN settings"), this);
+#if QT_VERSION > 300
+ box->setInsideSpacing(1);
+ passwordBox->setInsideSpacing(1);
+#endif
+ lay->addWidget(passwordBox);
+
+ // Password Boxes
+ lblUin = new QLabel(tr("&Uin:"), passwordBox);
+ edtUin = new QLineEdit(passwordBox);
+ QWhatsThis::add(edtUin, tr("Enter the UIN which you want to use for ICQ server logon. Only available if \"Local changes only\" is checked."));
+ lblPassword = new QLabel(tr("&Password:"), passwordBox);
+ edtFirst = new QLineEdit(passwordBox);
+ QWhatsThis::add(edtFirst, tr("Enter your ICQ password here."));
+ lblVerify = new QLabel(tr("&Verify:"), passwordBox);
+ edtSecond = new QLineEdit(passwordBox);
+ QWhatsThis::add(edtSecond, tr("Verify your ICQ password here."));
+ chkOnlyLocal = new QCheckBox(tr("&Local changes only"), passwordBox);
+ QWhatsThis::add(chkOnlyLocal, tr("If checked, password/UIN changes will apply only on your local computer. "
+ "Useful if your Server side password has changed and you would like to "
+ "synchronize your locally stored Licq password to the server."));
+
+ edtUin->setEnabled(false);
+ edtFirst->setEchoMode(QLineEdit::Password);
+ edtSecond->setEchoMode(QLineEdit::Password);
+ lblUin->setBuddy(edtUin);
+ lblPassword->setBuddy(edtFirst);
+ lblVerify->setBuddy(edtSecond);
+
+ // UIN
+ edtUin->setValidator(new QIntValidator(10000,2147483647,edtUin));
+ if (nUin) edtUin->setText(strUin);
+
+ // Owner Password
+ ICQOwner *o = gUserManager.FetchOwner(LOCK_R);
+ edtFirst->setText(o->Password());
+ edtSecond->setText(o->Password());
+
- QVBoxLayout *blay = new QVBoxLayout(box, 15);
+ QVBoxLayout *blay = new QVBoxLayout;
chkAuthorization = new QCheckBox(tr("Authorization Required"), box);
QWhatsThis::add(chkAuthorization, tr("Determines whether regular ICQ clients "
"require your authorization to add you to "
@@ -77,14 +123,35 @@ SecurityDlg::SecurityDlg(CICQDaemon *s,
connect (btnUpdate, SIGNAL(clicked()), SLOT(ok()) );
connect (btnCancel, SIGNAL(clicked()), SLOT(close()) );
+ connect (chkOnlyLocal,SIGNAL(toggled(bool)), SLOT(slot_chkOnlyLocalToggled(bool)));
+
+ // do some magic ;)
+ // if we are offline, we enable the checkbox "Only local changes"
+ // this saves one click :)
+ unsigned short status = o->Status();
+ if (status == ICQ_STATUS_OFFLINE)
+ {
+ slot_chkOnlyLocalToggled(true);
+ } else
+ {
+ slot_chkOnlyLocalToggled(false);
+ }
- ICQOwner *o = gUserManager.FetchOwner(LOCK_R);
chkAuthorization->setChecked(o->GetAuthorization());
chkWebAware->setChecked(o->WebAware());
chkHideIp->setChecked(o->HideIp());
gUserManager.DropOwner();
setCaption(tr("ICQ Security Options"));
+
+ // remember the initial values
+ // later we use these to apply only what has been changed by the user
+ initAuthorization = chkAuthorization->isChecked();
+ initWebAware = chkWebAware->isChecked();
+ initHideIp = chkHideIp->isChecked();
+ initEdtUin = edtUin->text();
+ initEdtFirst = edtFirst->text();
+ initEdtSecond = edtSecond->text();
show();
}
@@ -102,54 +169,128 @@ void SecurityDlg::ok()
unsigned short status = o->Status();
gUserManager.DropOwner();
- if(status == ICQ_STATUS_OFFLINE) {
+ // validate password
+ if (edtFirst->text().isEmpty() || edtFirst->text().length() > 8)
+ {
+ InformUser(this, tr("Invalid password, must be between 1 and 8 characters."));
+ return;
+ }
+ if (edtFirst->text() != edtSecond->text())
+ {
+ InformUser(this, tr("Passwords do not match, try again."));
+ return;
+ }
+
+ if(status == ICQ_STATUS_OFFLINE && !chkOnlyLocal->isChecked()) {
InformUser(this, tr("You need to be connected to the\n"
"ICQ Network to change the settings."));
return;
}
- btnUpdate->setEnabled(false);
- QObject::connect(sigman, SIGNAL(signal_doneUserFcn(ICQEvent *)),
- this, SLOT(slot_doneUserFcn(ICQEvent *)));
- tag = server->icqSetSecurityInfo(chkAuthorization->isChecked(),
- chkHideIp->isChecked(),
- chkWebAware->isChecked());
- setCaption(tr("ICQ Security Options [Setting...]"));
+
+ // test if we really need to update something
+ bool secUpdateNeeded = false;
+ bool pasUpdateNeeded = false;
+
+ if ((chkAuthorization->isChecked() != initAuthorization) || (chkWebAware->isChecked() != initWebAware) || (chkHideIp->isChecked() != initHideIp))
+ {
+ secUpdateNeeded = true;
+ initAuthorization = chkAuthorization->isChecked();
+ initWebAware = chkWebAware->isChecked();
+ initHideIp = chkHideIp->isChecked();
+ }
+ if ((edtUin->text() != initEdtUin) || (edtFirst->text() != initEdtFirst) || (edtSecond->text() != initEdtSecond))
+ {
+ pasUpdateNeeded = true;
+ initEdtUin = edtUin->text();
+ initEdtFirst = edtFirst->text();
+ initEdtSecond = edtSecond->text();
+ }
+
+ if ( secUpdateNeeded || pasUpdateNeeded )
+ {
+ btnUpdate->setEnabled(false);
+ QObject::connect(sigman, SIGNAL(signal_doneUserFcn(ICQEvent *)),
+ this, SLOT(slot_doneUserFcn(ICQEvent *)));
+
+ if (chkOnlyLocal->isChecked())
+ {
+ gUserManager.SetOwnerUin(edtUin->text().toULong());
+ o->SetPassword(edtFirst->text().latin1());
+ gUserManager.DropOwner();
+ close();
+ } else
+ {
+ // eSecurityInfo and ePasswordChange contain the event numbers.
+ // These are used in slot_doneUserFcn to compare if we reveived
+ // what we expected :)
+ if (secUpdateNeeded)
+ eSecurityInfo = server->icqSetSecurityInfo(chkAuthorization->isChecked(), chkHideIp->isChecked(), chkWebAware->isChecked());
+ if (pasUpdateNeeded)
+ ePasswordChange = server->icqSetPassword(edtFirst->text().local8Bit());
+ }
+ setCaption(tr("ICQ Security Options [Setting...]"));
+ } else
+ {
+ close();
+ }
}
void SecurityDlg::slot_doneUserFcn(ICQEvent *e)
{
- if (!e->Equals(tag)) return;
-
- btnUpdate->setEnabled(true);
- tag = 0;
+ // Checking if the received events correspond to one of
+ // our sent events.
+ if (!e->Equals(eSecurityInfo) && !e->Equals(ePasswordChange)) return;
QString result;
switch (e->Result())
{
case EVENT_FAILED:
result = tr("failed");
+ if (e->Equals(eSecurityInfo)) InformUser(this, tr("Setting ICQ security options failed."));
+ if (e->Equals(ePasswordChange)) InformUser(this, tr("Changing ICQ password failed."));
break;
case EVENT_TIMEDOUT:
result = tr("timed out");
+ if (e->Equals(eSecurityInfo)) InformUser(this, tr("Timeout while setting ICQ security options."));
+ if (e->Equals(ePasswordChange)) InformUser(this, tr("Timeout while changing ICQ password."));
break;
case EVENT_ERROR:
result = tr("error");
+ if (e->Equals(eSecurityInfo)) InformUser(this, tr("Internal error while setting ICQ security options."));
+ if (e->Equals(ePasswordChange)) InformUser(this, tr("Internal error while changing ICQ password."));
break;
default:
break;
}
+ if(e->Equals(eSecurityInfo)) eSecurityInfo = 0;
+ if(e->Equals(ePasswordChange)) ePasswordChange = 0;
+
+ if ((eSecurityInfo == 0) && (ePasswordChange == 0)) btnUpdate->setEnabled(true);
+
if(!result.isEmpty())
setCaption(tr("ICQ Security Options [Setting...") + result + "]");
else
{
- setCaption(tr("ICQ Security Options"));
- close();
+ if ((eSecurityInfo == 0) && (ePasswordChange == 0))
+ {
+ setCaption(tr("ICQ Security Options"));
+ close();
+ }
}
+}
+
+void SecurityDlg::slot_chkOnlyLocalToggled(bool b)
+{
+ edtUin->setEnabled(b);
+ chkOnlyLocal->setChecked(b);
+ chkAuthorization->setEnabled(!b);
+ chkWebAware->setEnabled(!b);
+ chkHideIp->setEnabled(!b);
}
Index: licq/plugins/qt-gui/src/securitydlg.h
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/securitydlg.h,v
retrieving revision 1.5
diff -u -3 -p -r1.5 securitydlg.h
--- licq/plugins/qt-gui/src/securitydlg.h 2 Nov 2000 17:57:55 -0000 1.5
+++ licq/plugins/qt-gui/src/securitydlg.h 24 Sep 2002 18:37:13 -0000
@@ -1,7 +1,9 @@
#ifndef SECURITYDLG_H
#define SECURITYDLG_H
-#include <qwidget.h>
+#include <qdialog.h>
+#include <qlineedit.h>
+#include <qlabel.h>
class QPushButton;
class QCheckBox;
@@ -10,24 +12,34 @@ class ICQEvent;
class CICQDaemon;
class CSignalManager;
-class SecurityDlg : public QWidget
+class SecurityDlg : public QDialog
{
Q_OBJECT
public:
SecurityDlg (CICQDaemon *s, CSignalManager *, QWidget* parent = 0);
~SecurityDlg();
+
protected:
CICQDaemon *server;
CSignalManager *sigman;
QPushButton *btnUpdate, *btnCancel;
- QCheckBox *chkWebAware, *chkAuthorization, *chkHideIp;
+ QCheckBox *chkWebAware, *chkAuthorization, *chkHideIp, *chkOnlyLocal;
+ QLineEdit *edtUin, *edtFirst, *edtSecond;
+ QLabel *lblUin, *lblPassword, *lblVerify;
- unsigned long tag;
+ // Some returned events
+ unsigned long eSecurityInfo, ePasswordChange;
+
+ // For saving initial values
+ bool initAuthorization, initWebAware, initHideIp;
+ QString initEdtUin, initEdtFirst, initEdtSecond;
public slots:
void slot_doneUserFcn(ICQEvent *);
+
protected slots:
void ok();
+ void slot_chkOnlyLocalToggled(bool b);
};
Index: licq/plugins/qt-gui/src/sigman.cpp
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/sigman.cpp,v
retrieving revision 1.18
diff -u -3 -p -r1.18 sigman.cpp
--- licq/plugins/qt-gui/src/sigman.cpp 11 Sep 2002 01:50:47 -0000 1.18
+++ licq/plugins/qt-gui/src/sigman.cpp 24 Sep 2002 18:37:13 -0000
@@ -26,7 +26,7 @@
#include "licq_user.h"
#include "licq_socket.h"
#include "licq_icq.h"
-#include "chgpassdlg.h"
+#include "securitydlg.h"
//=====CSignalManager===========================================================
@@ -97,11 +97,9 @@ void CSignalManager::ProcessSignal(CICQS
case SIGNAL_LOGOFF:
if( s->SubSignal() == LOGOFF_PASSWORD)
{
- ChangePassDlg *pass = new ChangePassDlg();
- pass->exec();
- delete pass;
+ SecurityDlg *pass = new SecurityDlg(licqDaemon, this);
+ pass->show();
}
-
emit signal_logoff();
break;
case SIGNAL_UI_VIEWEVENT:
Index: licq/plugins/qt-gui/src/Makefile.am
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/Makefile.am,v
retrieving revision 1.35
diff -u -3 -p -r1.35 Makefile.am
--- licq/plugins/qt-gui/src/Makefile.am 11 Sep 2002 01:50:46 -0000 1.35
+++ licq/plugins/qt-gui/src/Makefile.am 24 Sep 2002 18:37:13 -0000
@@ -14,23 +14,23 @@ lib_LTLIBRARIES = @LIB_NAME@
noinst_HEADERS = adduserdlg.h authuserdlg.h awaymsgdlg.h refusedlg.h \
chatdlg.h editgrp.h editfile.h eventdesc.h ewidgets.h \
filedlg.h gui-defines.h licq_qt-gui.conf.h licqgui.h \
- mainwin.h messagebox.h mledit.h mlview.h mlview2.h mlview3.h optionsdlg.h outputwin.h passworddlg.h\
+ mainwin.h messagebox.h mledit.h mlview.h mlview2.h mlview3.h optionsdlg.h outputwin.h\
plugindlg.h registeruser.h searchuserdlg.h \
securitydlg.h showawaymsgdlg.h sigman.h skin.h skinbrowser.h userbox.h\
utilitydlg.h wharf.h randomchatdlg.h forwarddlg.h chatjoin.h \
mmlistview.h mmsenddlg.h userinfodlg.h usereventdlg.h keyrequestdlg.h \
- jfcstyle.h usercodec.h reqauthdlg.h chgpassdlg.h
+ jfcstyle.h usercodec.h reqauthdlg.h
licq_gui = adduserdlg.cpp authuserdlg.cpp awaymsgdlg.cpp \
refusedlg.cpp chatdlg.cpp editgrp.cpp editfile.cpp eventdesc.cpp \
ewidgets.cpp filedlg.cpp \
licqgui.cpp mainwin.cpp messagebox.cpp mledit.cpp mlview2.cpp mlview3.cpp optionsdlg.cpp \
- outputwin.cpp passworddlg.cpp plugindlg.cpp \
+ outputwin.cpp plugindlg.cpp \
registeruser.cpp searchuserdlg.cpp securitydlg.cpp showawaymsgdlg.cpp \
sigman.cpp skin.cpp skinbrowser.cpp userbox.cpp utilitydlg.cpp \
wharf.cpp randomchatdlg.cpp forwarddlg.cpp chatjoin.cpp mmlistview.cpp \
mmsenddlg.cpp userinfodlg.cpp usereventdlg.cpp keyrequestdlg.cpp \
- jfcstyle.cpp usercodec.cpp reqauthdlg.cpp chgpassdlg.cpp
+ jfcstyle.cpp usercodec.cpp reqauthdlg.cpp
licq_qt_gui_la_SOURCES = $(licq_gui)
licq_kde_gui_la_SOURCES = $(licq_gui) wrap_kde_malloc.cpp