-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello again,
as i promised a few days ago, here come my patch which disables some menu
entries while we are offline.
See my mail below for details.
Bye,
Thomas
On Wednesday 09 October 2002 23:50, Thomas Reitelbach wrote:
> Hello people,
>
> here another RFC (Request for comments) from me:
> Some menu items (especially in the user functions menu) are quite useless
> when we are in offline status. for example "update all users" will not work
> when we are not connected...
> So my idea was to disable these menu items when offline (make them grey/not
> clickable), so the user will not be confused when he clicks on such item
> and nothing happens.
>
> Now i want to hear your opinion about my idea. Good idea? Bad idea? Why?
> The code is written already, i will fine-tune it a bit next days and send a
> patch to the list.
>
> Bye,
> Thomas
- --
panic: can't find /
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9pc/U+83LmoKU5MARArsGAKClB5U+Kb6S6Dm5P6tVAQ4B9LtihwCgk82J
6tzHlY6OH7CDtBH2QtQ+xkg=
=HElA
-----END PGP SIGNATURE-----
Index: licq/plugins/qt-gui/src/mainwin.h
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/mainwin.h,v
retrieving revision 1.91
diff -u -3 -p -r1.91 mainwin.h
--- licq/plugins/qt-gui/src/mainwin.h 30 Sep 2002 00:04:39 -0000 1.91
+++ licq/plugins/qt-gui/src/mainwin.h 10 Oct 2002 19:07:21 -0000
@@ -251,6 +251,7 @@ protected slots:
void slot_userfinished(unsigned long);
void slot_sendfinished(unsigned long);
void slot_usermenu();
+ void slot_mnuUserAdm();
void slot_logon();
void slot_ui_viewevent(unsigned long);
void slot_ui_message(unsigned long);
Index: licq/plugins/qt-gui/src/mainwin.cpp
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/mainwin.cpp,v
retrieving revision 1.243
diff -u -3 -p -r1.243 mainwin.cpp
--- licq/plugins/qt-gui/src/mainwin.cpp 2 Oct 2002 05:06:09 -0000 1.243
+++ licq/plugins/qt-gui/src/mainwin.cpp 10 Oct 2002 19:07:22 -0000
@@ -3026,22 +3026,25 @@ void CMainWindow::initMenu()
mnuOwnerAdm->insertItem(tr("Debug Level"), mnuDebug);
connect (mnuOwnerAdm, SIGNAL(activated(int)), this, SLOT(callOwnerFunction(int)));
+ // If you re-arrange, delete or add ID numbers, please re-order them
+ // in slot_mnuUserAdm, too.
mnuUserAdm = new QPopupMenu(NULL);
- mnuUserAdm->insertItem(tr("&Add User"), this, SLOT(showAddUserDlg()));
- mnuUserAdm->insertItem(tr("S&earch for User"), this, SLOT(showSearchUserDlg()));
- mnuUserAdm->insertItem(tr("A&uthorize User"), this, SLOT(showAuthUserDlg()));
- mnuUserAdm->insertItem(tr("Re&quest Authorization"), this, SLOT(showReqAuthDlg()));
- mnuUserAdm->insertItem(tr("R&andom Chat"), this, SLOT(slot_randomchatsearch()));
+ mnuUserAdm->insertItem(tr("&Add User"), this, SLOT(showAddUserDlg()),0,1);
+ mnuUserAdm->insertItem(tr("S&earch for User"), this, SLOT(showSearchUserDlg()),0,2);
+ mnuUserAdm->insertItem(tr("A&uthorize User"), this, SLOT(showAuthUserDlg()),0,3);
+ mnuUserAdm->insertItem(tr("Re&quest Authorization"), this, SLOT(showReqAuthDlg()),0,4);
+ mnuUserAdm->insertItem(tr("R&andom Chat"), this, SLOT(slot_randomchatsearch()),0,5);
mnuUserAdm->insertSeparator();
- mnuUserAdm->insertItem(tr("&Popup All Messages"), this, SLOT(slot_popupall()));
- mnuUserAdm->insertItem(tr("Edit &Groups"), this, SLOT(showEditGrpDlg()));
+ mnuUserAdm->insertItem(tr("&Popup All Messages"), this, SLOT(slot_popupall()),0,6);
+ mnuUserAdm->insertItem(tr("Edit &Groups"), this, SLOT(showEditGrpDlg()),0,7);
mnuUserAdm->insertSeparator();
- mnuUserAdm->insertItem(tr("Update All Users"), this, SLOT(slot_updateAllUsers()));
- mnuUserAdm->insertItem(tr("Update Current Group"), this, SLOT(slot_updateAllUsersInGroup()));
- mnuUserAdm->insertItem(tr("&Redraw User Window"), this, SLOT(updateUserWin()));
- mnuUserAdm->insertItem(tr("&Save All Users"), this, SLOT(saveAllUsers()));
+ mnuUserAdm->insertItem(tr("Update All Users"), this, SLOT(slot_updateAllUsers()),0,8);
+ mnuUserAdm->insertItem(tr("Update Current Group"), this, SLOT(slot_updateAllUsersInGroup()),0,9);
+ mnuUserAdm->insertItem(tr("&Redraw User Window"), this, SLOT(updateUserWin()),0,10);
+ mnuUserAdm->insertItem(tr("&Save All Users"), this, SLOT(saveAllUsers()),0,11);
mnuUserAdm->insertSeparator();
- mnuUserAdm->insertItem(tr("Reg&ister User"), this, SLOT(slot_register()));
+ mnuUserAdm->insertItem(tr("Reg&ister User"), this, SLOT(slot_register()),0,12);
+ connect(mnuUserAdm, SIGNAL(aboutToShow()), this, SLOT(slot_mnuUserAdm()));
QPopupMenu *mnuHelp = new QPopupMenu(NULL);
mnuHelp->insertItem(tr("&Hints"), this, SLOT(slot_hints()));
@@ -3203,6 +3206,31 @@ void CMainWindow::slot_usermenu()
gUserManager.DropUser(u);
}
+
+/*! \brief Disables some menu entries when offline
+ *
+ * This slot disables some menu entries when we are in offline
+ * status. These disabled entries would not be very useful
+ * while we are not connected to a ICQ Server.
+ */
+void CMainWindow::slot_mnuUserAdm()
+{
+ // Get owner status so we can disable some menu entries
+ // that would be quite useless while we are offline
+ ICQOwner *o = gUserManager.FetchOwner(LOCK_R);
+ unsigned short status = o->Status();
+ gUserManager.DropOwner();
+
+ if (status == ICQ_STATUS_OFFLINE)
+ {
+ mnuUserAdm->setItemEnabled(2, false); // search for user
+ mnuUserAdm->setItemEnabled(3, false); // authorize user
+ mnuUserAdm->setItemEnabled(4, false); // request authorization
+ mnuUserAdm->setItemEnabled(5, false); // random chat
+ mnuUserAdm->setItemEnabled(8, false); // update all users
+ mnuUserAdm->setItemEnabled(9, false); // update this group
+ }
+}
void CMainWindow::slot_stats()
{