diff -aurp kadu.orig/kadu/kadu.cpp kadu/kadu/kadu.cpp --- kadu.orig/kadu/kadu.cpp 2005-03-20 15:48:41.000000000 +0100 +++ kadu/kadu/kadu.cpp 2005-03-20 19:07:06.000000000 +0100 @@ -100,8 +100,21 @@ void ToolBar::createControls() if ((*j).caption== "--separator--") addSeparator(); else - (*j).button = new QToolButton(icons_manager.loadIcon((*j).iconname), (*j).caption, - QString::null, (*j).receiver, (*j).slot, this, (*j).name); + { + if ((*j).type == ToolButton::Push) + { + (*j).button = new QToolButton(icons_manager.loadIcon((*j).iconname), (*j).caption, + QString::null, (*j).receiver, (*j).slot, this, (*j).name); + } + else + { + (*j).button = new QToolButton(icons_manager.loadIcon((*j).iconname), (*j).caption, + QString::null, 0, 0, this, (*j).name); + (*j).button->setToggleButton(true); + (*j).button->setOn((*j).type == ToolButton::ToggleOn); + connect((*j).button, SIGNAL(toggled(bool)), (*j).receiver, (*j).slot); + } + } setStretchableWidget(new QWidget(this)); kdebugf2(); @@ -141,6 +154,34 @@ void ToolBar::registerButton(const QStri RToolButton.slot= slot; RToolButton.position= position; RToolButton.name= name; + RToolButton.type= ToolButton::Push; + + if ((RegisteredToolButtons.count()<(uint)(position+1)) || (position == -1)) + RegisteredToolButtons.append(RToolButton); + else + RegisteredToolButtons.insert(RegisteredToolButtons.at(position), RToolButton); + + if(instance!=NULL) + instance->createControls(); + kdebugf2(); +} + +void ToolBar::registerToggleButton(const QString &iconname, const QString& caption, bool on, + QObject* receiver, const char* slot, int position, const char* name) +{ + kdebugf(); + if(instance!=NULL) + instance->clear(); + + ToolButton RToolButton; + + RToolButton.iconname= iconname; + RToolButton.caption= caption; + RToolButton.receiver= receiver; + RToolButton.slot= slot; + RToolButton.position= position; + RToolButton.name= name; + RToolButton.type= on ? ToolButton::ToggleOn : ToolButton::ToggleOff; if ((RegisteredToolButtons.count()<(uint)(position+1)) || (position == -1)) RegisteredToolButtons.append(RToolButton); @@ -400,8 +441,10 @@ Kadu::Kadu(QWidget *parent, const char * setActiveGroup(""); // dodanie przyciskow do paska narzedzi - ToolBar::registerButton("ShowHideInactiveUsers", tr("Show / hide inactive users"), Userbox, SLOT(showHideInactive()), -1, "inactiveUsersButton"); - ToolBar::registerButton("ShowOnlyDescriptionUsers", tr("Show / hide users without description"), Userbox, SLOT(showHideDescriptions()), -1, "withDescriptionUsersButton"); + ToolBar::registerToggleButton("ShowHideInactiveUsers", tr("Show / hide inactive users"), + config_file.readBoolEntry("General","ShowHideInactive"), Userbox, SLOT(showHideInactive(bool)), -1, "inactiveUsersButton"); + ToolBar::registerToggleButton("ShowOnlyDescriptionUsers", tr("Show / hide users without description"), + config_file.readBoolEntry("General","ShowOnlyDescriptionUsers"), Userbox, SLOT(showHideDescriptions(bool)), -1, "withDescriptionUsersButton"); ToolBar::registerButton("Configuration", tr("Configuration"), this, SLOT(configure()), -1, "configurationButton"); ToolBar::registerSeparator(); ToolBar::registerButton("History", tr("View history"), this, SLOT(viewHistory()), -1, "historyButton"); diff -aurp kadu.orig/kadu/kadu.h kadu/kadu/kadu.h --- kadu.orig/kadu/kadu.h 2005-03-20 15:48:41.000000000 +0100 +++ kadu/kadu/kadu.h 2005-03-20 19:02:48.000000000 +0100 @@ -35,6 +35,12 @@ class ToolBar : public QToolBar QString slot; QToolButton* button; int position; + enum + { + Push, + ToggleOff, + ToggleOn + } type; }; static QValueList RegisteredToolButtons; void createControls(); @@ -44,6 +50,8 @@ class ToolBar : public QToolBar ~ToolBar(); static void registerButton(const QString &iconname, const QString& caption, QObject* receiver, const char* slot, const int position=-1, const char* name=""); + static void registerToggleButton(const QString &iconname, const QString& caption, bool on, + QObject* receiver, const char* slot, const int position=-1, const char* name=""); static void unregisterButton(const char* name); static void registerSeparator(int position=-1); static QToolButton* getButton(const char* name); diff -aurp kadu.orig/kadu/userbox.cpp kadu/kadu/userbox.cpp --- kadu.orig/kadu/userbox.cpp 2005-03-20 15:48:42.000000000 +0100 +++ kadu/kadu/userbox.cpp 2005-03-20 18:08:42.000000000 +0100 @@ -678,6 +678,14 @@ void UserBox::showHideInactive() kdebugf2(); } +void UserBox::showHideInactive(bool state) +{ + kdebugf(); + config_file.writeEntry("General","ShowHideInactive",state); + all_refresh(); + kdebugf2(); +} + void UserBox::showHideDescriptions() { kdebugf(); @@ -685,6 +693,13 @@ void UserBox::showHideDescriptions() all_refresh(); } +void UserBox::showHideDescriptions(bool state) +{ + kdebugf(); + config_file.writeEntry("General","ShowOnlyDescriptionUsers",state); + all_refresh(); +} + UinsList UserBox::getSelectedUins() const { kdebugf(); diff -aurp kadu.orig/kadu/userbox.h kadu/kadu/userbox.h --- kadu.orig/kadu/userbox.h 2005-03-20 15:48:42.000000000 +0100 +++ kadu/kadu/userbox.h 2005-03-20 17:58:14.000000000 +0100 @@ -418,12 +418,26 @@ class UserBox : public QListBox , QToolT void showHideInactive(); /** + \fn void showHideInactive() + Przełącza tryb pokazywania kontaktów niedostępnych. + \param state Jeśli true - kontakty nieaktywne sa widoczne + **/ + void showHideInactive(bool state); + + /** \fn void showHideDescriptions() Przełącza tryb pokazywania opisów kontaktów. **/ void showHideDescriptions(); /** + \fn void showHideDescriptions() + Przełącza tryb pokazywania opisów kontaktów. + \param state Jeśli true - kontakty bez opisow sa ukryte + **/ + void showHideDescriptions(bool state); + + /** \fn virtual void clear() Czyśli listę. **/