-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello all,
here it comes, i did some work and merged all the password related stuff into
the security options dialog window.
It was quite annoying to have 2 confusing menu entries related to passwords...
so what do we have the security options dialog for if we don't make use of
it?
What does the patch exactly do?
================================
- - mainwin.cpp: It removes the two menu entries "Change Password" and "Change
saved UIN/Password".
- - The functionality of these two dialogs/entries is beeing moved into the
"Security options" dialog window. Hopefully i designed this to be less
confusing than it was before.
- - securitydlg.cpp|h now inherits from QDialog instead of QWidget.
- - sigman.cpp: if we cannot logon due to a password error the new
securitydialog is automatically called and enables the user to type in
correct password/UIN.
- - sigman.cpp: removed a invalid delete() (valgrind complained about it) (The
QDialog deletes itself, it has WDestructiveClose flag set!)
- - Makefile.am: The four files chgpassdlg.cpp, chgpassdlg.h, passworddlg.cpp,
passworddlg.h get obsolete and can be removed. The patch removes references
to these file from Makefile.am.
There are few things that i'm not 100% happy with right now, but it will not
introduce new bugs (i hope so).
What i'm not happy with (brainstorming):
- - 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)
- - both 2 actions are always applied when pressing "update", even if we change
nothing at all :( i will work on this later since what securitydlg does here
is not everyday-use-stuff. i think about something like a
"remember-what-has-been-changed-and-only-update-what-is-necessary" function
for this (nice name for a function ;)
- - If a event fails and licq receives no error-respond for some reason and we
go offline afterwards, licq crashes. this bug is not introduced by me, it's
in here for a while now. i have no idea how to fix this, sorry.
So jon, it's up to you now ;)
I have tested this with my QT3.1 and it compiles nice with or without kde
support. it would be nice if others could test this with older qt versions,
too. hey guys, make a backup before you do so!! ;-)
To those guys who are brave enough to test this:
I need your feedback, please tell me what could be made better!
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
iD8DBQE9j5jA+83LmoKU5MARAnzGAJ9fxj2vzcuFfBqGffW+eN0OmuTmIwCeJyxn
Z0SuOUS+6oVsTpV8SISTXo4=
=nhmt
-----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 23 Sep 2002 21:56:53 -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 23 Sep 2002 21:56:54 -0000
@@ -26,6 +26,8 @@
#include <qgroupbox.h>
#include <qwhatsthis.h>
#include <qtoolbutton.h>
+#include <qlineedit.h>
+#include <qlabel.h>
#include "ewidgets.h"
#include "securitydlg.h"
@@ -37,17 +39,60 @@
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);
+ box->setInsideSpacing(1);
+ passwordBox->setInsideSpacing(1);
+ 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,8 +122,20 @@ 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());
@@ -102,7 +159,19 @@ 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;
@@ -110,21 +179,48 @@ void SecurityDlg::ok()
btnUpdate->setEnabled(false);
QObject::connect(sigman, SIGNAL(signal_doneUserFcn(ICQEvent *)),
- this, SLOT(slot_doneUserFcn(ICQEvent *)));
- tag = server->icqSetSecurityInfo(chkAuthorization->isChecked(),
- chkHideIp->isChecked(),
- chkWebAware->isChecked());
+ this, SLOT(slot_doneUserFcn(ICQEvent *)));
+
+ if (chkOnlyLocal->isChecked())
+ {
+ gUserManager.SetOwnerUin(edtUin->text().toULong());
+ o->SetPassword(edtFirst->text().latin1());
+ gUserManager.DropOwner();
+ close();
+ } else
+ {
+/*
+ FIXME
+ We send two ICQEvents, but the slot_doneUserFcn is only aware for
+ checking _one_ event.
+ I can see that we cannot easily check if both actions ran successfully :(
+ The first successfully returning event will make the window close, i think.
+ Anyway, we should let the user know if password changing was successfull!
+ I've modified the slot to work properly, but i'm not 100% happy with it!
+ /Thomas Reitelbach, [EMAIL PROTECTED]
+*/
+ eSecurityInfo = server->icqSetSecurityInfo(chkAuthorization->isChecked(), chkHideIp->isChecked(), chkWebAware->isChecked());
+ ePasswordChange = server->icqSetPassword(edtFirst->text().local8Bit());
+ }
setCaption(tr("ICQ Security Options [Setting...]"));
}
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;
+ if(e->Equals(eSecurityInfo)) eSecurityInfo = 0;
+ if(e->Equals(ePasswordChange)) ePasswordChange = 0;
+
+ if ((eSecurityInfo == 0) && (ePasswordChange == 0)) btnUpdate->setEnabled(true);
+
+ // FIXME
+ // I don't like the following lines because the user
+ // cannot see which event failed :-(
+ // Maybe we should open a info-dialog if something fails...
+ // Thomas Reitelbach, [EMAIL PROTECTED]
QString result;
switch (e->Result())
{
@@ -146,10 +242,23 @@ void SecurityDlg::slot_doneUserFcn(ICQEv
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 23 Sep 2002 21:56:54 -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,30 @@ 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;
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 23 Sep 2002 21:56:54 -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,9 +97,8 @@ void CSignalManager::ProcessSignal(CICQS
case SIGNAL_LOGOFF:
if( s->SubSignal() == LOGOFF_PASSWORD)
{
- ChangePassDlg *pass = new ChangePassDlg();
+ SecurityDlg *pass = new SecurityDlg(licqDaemon, this);
pass->exec();
- delete pass;
}
emit signal_logoff();
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 23 Sep 2002 21:56:54 -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