Hi!
The patch attached to this message fixes 2 annoying inconveniences in Kopete
ICQ authorisation request dialog.
1. Set wordWrap property of lblRequestReason to true.
The request reason string can be very long, and without wordWrap set to true
can lead to ridiculously wide dialog window.
2. Added "Contact" menu button which invokes contact menu.
When authorisation request comes, the first question which comes to mind
is "Who is that?". Without this patch there are only two ways to get
requestor's info: use search function of "Add contact" and enter UIN manually
(conveniently, you can't select UIN from text in dialog) or open web browser
and enter manually "http://www.icq.com/UIN"). Both ways are very
inconvenient.
With this patch a temporary contact is added on arrival of authorisation
request (the same way as when a message from unknown contact is received).
This contact's context menu can be invoked from "Contact" button.
This is just a minor patch to relieve user interface pain in ICQ protocol
support only. The long-term solution should be a major refactoring of event
handling in Kopete to handle authorisation requests and other special
messages the way uniform with regular messages.
Popping up dialogs is acceptable only as a result of user's action, not on
asynchronous events like authorisation requests. All asynchronous events
should lead to asynchronous notifications (blinking of tray icon, blinking of
icon in contact list, possibly notification popup near the tray icon which
always disappears in 10 seconds if user does not click it).
The real window should open only as a result of user's interaction: when user
clicks on a notification popup or blinking icon. If the event is a regular
message, the chat window should open. If it is an authorisation request, an
authorisation dialog should open.
-- Oleg Girko, http://www.infoserver.ru/~ol/
Index: kopete/protocols/oscar/icq/icqaccount.cpp
===================================================================
--- kopete/protocols/oscar/icq/icqaccount.cpp (revision 764024)
+++ kopete/protocols/oscar/icq/icqaccount.cpp (working copy)
@@ -478,9 +478,17 @@
QObject::connect( this, SIGNAL(destroyed()), replyDialog, SLOT(deleteLater()) );
QObject::connect( replyDialog, SIGNAL(okClicked()), this, SLOT(slotAuthReplyDialogOkClicked()) );
- Kopete::Contact * ct = contacts()[ Oscar::normalize( contact ) ];
+ QString sender = Oscar::normalize( contact );
+ if ( !contacts()[sender] )
+ {
+ kDebug( OSCAR_ICQ_DEBUG ) << "Adding '" << sender << "' as temporary contact";
+ addContact( sender, QString(), 0, Kopete::Account::Temporary );
+ }
+
+ Kopete::Contact * ct = contacts()[ sender ];
replyDialog->setUser( ( ct ) ? ct->nickName() : contact );
- replyDialog->setContact( contact );
+ replyDialog->setContact( ct );
+ replyDialog->setContactName( contact );
replyDialog->setRequestReason( reason );
replyDialog->show();
}
@@ -491,7 +499,7 @@
ICQAuthReplyDialog *replyDialog = (ICQAuthReplyDialog*)sender();
if ( replyDialog )
- engine()->sendAuth( replyDialog->contact(), replyDialog->reason(), replyDialog->grantAuth() );
+ engine()->sendAuth( replyDialog->contactName(), replyDialog->reason(), replyDialog->grantAuth() );
}
#include "icqaccount.moc"
Index: kopete/protocols/oscar/icq/ui/icqauthreplydialog.h
===================================================================
--- kopete/protocols/oscar/icq/ui/icqauthreplydialog.h (revision 764024)
+++ kopete/protocols/oscar/icq/ui/icqauthreplydialog.h (working copy)
@@ -20,6 +20,8 @@
#include <kdialog.h>
+namespace Kopete { class Contact; }
+
namespace Ui { class ICQAuthReplyUI; }
/**
@@ -35,14 +37,17 @@
void setUser( const QString& user );
void setRequestReason( const QString& reason );
- void setContact( const QString& contact );
+ void setContact( Kopete::Contact *contact );
+ void setContactName( const QString &contactName );
QString reason() const;
- QString contact() const;
+ Kopete::Contact *contact() const;
+ QString contactName() const;
bool grantAuth() const;
private:
bool m_wasRequested;
- QString m_contact;
+ Kopete::Contact *m_contact;
+ QString m_contactName;
Ui::ICQAuthReplyUI *m_ui;
};
Index: kopete/protocols/oscar/icq/ui/icqauthreplyui.ui
===================================================================
--- kopete/protocols/oscar/icq/ui/icqauthreplyui.ui (revision 764024)
+++ kopete/protocols/oscar/icq/ui/icqauthreplyui.ui (working copy)
@@ -29,11 +29,50 @@
<number>0</number>
</property>
<item>
- <widget class="QLabel" name="lblUserReq" >
- <property name="text" >
- <string>%1 requested authorization to add you to his/her contact list.</string>
+ <layout class="QHBoxLayout" >
+ <property name="spacing" >
+ <number>6</number>
</property>
- </widget>
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="lblUserReq" >
+ <property name="text" >
+ <string>%1 requested authorization to add you to his/her contact list.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnContact" >
+ <property name="text" >
+ <string>&Contact</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<layout class="QHBoxLayout" >
@@ -76,6 +115,9 @@
<property name="text" >
<string>Some reason...</string>
</property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
</widget>
</item>
</layout>
Index: kopete/protocols/oscar/icq/ui/icqauthreplydialog.cpp
===================================================================
--- kopete/protocols/oscar/icq/ui/icqauthreplydialog.cpp (revision 764024)
+++ kopete/protocols/oscar/icq/ui/icqauthreplydialog.cpp (working copy)
@@ -18,7 +18,10 @@
#include "icqauthreplydialog.h"
#include "ui_icqauthreplyui.h"
+#include "kopetecontact.h"
+
#include <klocale.h>
+#include <kmenu.h>
#include <qlabel.h>
#include <qradiobutton.h>
@@ -40,11 +43,14 @@
{
m_ui->lblReqReason->hide();
m_ui->lblRequestReason->hide();
+ m_ui->btnContact->hide();
}
else
{
setAttribute( Qt::WA_DeleteOnClose );
}
+
+ m_contact = 0;
}
ICQAuthReplyDialog::~ICQAuthReplyDialog()
@@ -66,21 +72,42 @@
m_ui->lblRequestReason->setText( reason );
}
-void ICQAuthReplyDialog::setContact( const QString& contact )
+void ICQAuthReplyDialog::setContact( Kopete::Contact *contact )
{
+ if ( m_contact )
+ {
+ m_ui->btnContact->menu()->deleteLater();
+ m_ui->btnContact->setMenu( 0 );
+ }
m_contact = contact;
+ if ( m_contact )
+ {
+ KMenu *p = m_contact->popupMenu();
+ connect( this, SIGNAL(destroyed()), p, SLOT(deleteLater()) );
+ m_ui->btnContact->setMenu( p );
+ }
}
+void ICQAuthReplyDialog::setContactName( const QString &contactName )
+{
+ m_contactName = contactName;
+}
+
QString ICQAuthReplyDialog::reason() const
{
return m_ui->leReason->text();
}
-QString ICQAuthReplyDialog::contact() const
+Kopete::Contact *ICQAuthReplyDialog::contact() const
{
return m_contact;
}
+QString ICQAuthReplyDialog::contactName() const
+{
+ return m_contactName;
+}
+
bool ICQAuthReplyDialog::grantAuth() const
{
return m_ui->rbGrant->isChecked();
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel