Commit 757b6c99 authored by Alexey Chernov's avatar Alexey Chernov Committed by Pali Rohár

Get-it-compiled version of KF5-porting of Jabber protocol

There's still one change to libiris internal tree needed, but we'll
try to solve it upstream first.
parent 145b72ac
......@@ -40,7 +40,6 @@
#include <QAbstractSocket>
#include <QPointer>
#include <kcomponentdata.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kmessagebox.h>
......@@ -52,7 +51,6 @@
#include <kicon.h>
#include <kactionmenu.h>
#include <kglobal.h>
#include <KComponentData>
#include "kopetepassword.h"
#include "kopetemetacontact.h"
......@@ -202,7 +200,7 @@ void JabberAccount::setS5BServerPort ( int port )
{
if ( !m_jabberClient->setS5BServerPort ( port ) && !m_notifiedUserCannotBindTransferPort)
{
KMessageBox::queuedMessageBox ( Kopete::UI::Global::mainWidget (), KMessageBox::Sorry,
KMessageBox::sorry ( Kopete::UI::Global::mainWidget (),
i18n ( "Could not bind the Jabber file transfer manager to a local port. Please check if the file transfer port is already in use, or choose another port in the account settings." ),
i18n ( "Failed to start Jabber File Transfer Manager" ) );
m_notifiedUserCannotBindTransferPort = true;
......@@ -216,9 +214,9 @@ void JabberAccount::fillActionMenu( KActionMenu *actionMenu )
actionMenu->addSeparator();
KAction *action;
QAction *action;
action = new KAction( this );
action = new QAction( this );
action->setIcon( KIcon("jabber_group") );
action->setText( i18n("Join Groupchat...") );
QObject::connect( action, SIGNAL(triggered(bool)), this, SLOT(slotJoinNewChat()) );
......@@ -232,20 +230,20 @@ void JabberAccount::fillActionMenu( KActionMenu *actionMenu )
actionMenu->addSeparator();
action = new KAction( this );
action = new QAction( this );
action->setIcon( KIcon("jabber_serv_on") );
action->setText( i18n ("Services...") );
QObject::connect( action, SIGNAL(triggered(bool)), this, SLOT(slotGetServices()) );
action->setEnabled( isConnected() );
actionMenu->addAction( action );
action = new KAction( this );
action = new QAction( this );
action->setIcon( ( KIcon("mail-message-new") ) );
action->setText( i18n ("XML Console") );
QObject::connect( action, SIGNAL(triggered(bool)), this, SLOT(slotXMPPConsole()) );
actionMenu->addAction( action );
action = new KAction( this );
action = new QAction( this );
action->setIcon( ( KIcon("document-properties") ) );
action->setText( i18n ("Edit User Info...") );
QObject::connect( action, SIGNAL(triggered(bool)), this, SLOT(slotEditVCard()) );
......@@ -255,7 +253,7 @@ void JabberAccount::fillActionMenu( KActionMenu *actionMenu )
KActionMenu *mMoodMenu = new KActionMenu(i18n("Set Mood"), actionMenu);
for(int i = 0; i <= Mood::Worried; i++)
{
action = new KAction(mMoodMenu);
action = new QAction(mMoodMenu);
action->setText(MoodManager::self()->getMoodName((Mood::Type)i));
action->setData(QVariant(i));
QObject::connect( action, SIGNAL(triggered(bool)), this, SLOT(slotSetMood()) );
......@@ -317,8 +315,7 @@ bool JabberAccount::createContact (const QString & contactId, Kopete::MetaConta
void JabberAccount::errorConnectFirst ()
{
KMessageBox::queuedMessageBox ( Kopete::UI::Global::mainWidget (),
KMessageBox::Error,
KMessageBox::error ( Kopete::UI::Global::mainWidget (),
i18n ("Please connect first."), i18n ("Jabber Error") );
}
......@@ -394,13 +391,13 @@ void JabberAccount::connectWithPassword ( const QString &password )
uname (&utsBuf);
m_jabberClient->setClientName ("Kopete");
m_jabberClient->setClientVersion (KGlobal::mainComponent().aboutData()->version ());
m_jabberClient->setClientVersion (KAboutData::applicationData().version ());
m_jabberClient->setOSName (QString ("%1 %2").arg (utsBuf.sysname, 1).arg (utsBuf.release, 2));
}
// Set caps node information
m_jabberClient->setCapsNode(KOPETE_CAPS_NODE);
m_jabberClient->setCapsVersion(KGlobal::mainComponent().aboutData()->version());
m_jabberClient->setCapsVersion(KAboutData::applicationData().version());
// Set Disco Identity information
DiscoItem::Identity identity;
......@@ -452,7 +449,7 @@ void JabberAccount::connectWithPassword ( const QString &password )
{
case JabberClient::NoTLS:
// no SSL support, at the connecting stage this means the problem is client-side
KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget (), KMessageBox::Error,
KMessageBox::error(Kopete::UI::Global::mainWidget (),
i18n ("SSL support could not be initialized for account %1. This is most likely because TLS support for QCA is not available.",
myself()->contactId()),
i18n ("Jabber SSL Error"));
......@@ -613,7 +610,7 @@ void JabberAccount::slotClientError ( JabberClient::ErrorCode errorCode )
{
case JabberClient::NoTLS:
default:
KMessageBox::queuedMessageBox ( Kopete::UI::Global::mainWidget (), KMessageBox::Error,
KMessageBox::error ( Kopete::UI::Global::mainWidget (),
i18n ("An encrypted connection with the Jabber server could not be established."),
i18n ("Jabber Connection Error"));
disconnect ( Kopete::Account::Manual );
......@@ -1194,7 +1191,7 @@ void JabberAccount::slotXMPPConsole ()
void JabberAccount::slotSetMood()
{
KAction *action = (KAction *)sender();
QAction *action = (QAction *)sender();
Mood::Type type = (Mood::Type)action->data().toInt();
PubSubItem psi("current", Mood(type).toXml(*client()->client()->rootTask()->doc()));
......@@ -1672,15 +1669,13 @@ void JabberAccount::slotGroupChatError (const XMPP::Jid &jid, int error, const Q
break;
case JabberClient::BannedFromThisMUC:
KMessageBox::queuedMessageBox ( Kopete::UI::Global::mainWidget (),
KMessageBox::Error,
KMessageBox::error ( Kopete::UI::Global::mainWidget (),
i18n ("You cannot join the room %1 because you have been banned", jid.node()),
i18n ("Jabber Group Chat") );
break;
case JabberClient::MaxUsersReachedForThisMuc:
KMessageBox::queuedMessageBox ( Kopete::UI::Global::mainWidget (),
KMessageBox::Error,
KMessageBox::error ( Kopete::UI::Global::mainWidget (),
i18n ("You cannot join the room %1 because the maximum number of users has been reached", jid.node()),
i18n ("Jabber Group Chat") );
break;
......@@ -1689,8 +1684,7 @@ void JabberAccount::slotGroupChatError (const XMPP::Jid &jid, int error, const Q
{
QString detailedReason = reason.isEmpty () ? i18n ( "No reason given by the server" ) : reason;
KMessageBox::queuedMessageBox ( Kopete::UI::Global::mainWidget (),
KMessageBox::Error,
KMessageBox::error ( Kopete::UI::Global::mainWidget (),
i18n ("There was an error processing your request for groupchat %1. (Reason: %2, Code %3)", jid.full (), detailedReason, error ),
i18n ("Jabber Group Chat") );
}
......@@ -1812,7 +1806,7 @@ void JabberAccount::slotUnregisterFinished( )
if ( task && ! task->success ())
{
KMessageBox::queuedMessageBox ( 0L, KMessageBox::Error,
KMessageBox::error ( 0L,
i18n ("An error occurred while trying to remove the account:\n%1", task->statusString()),
i18n ("Jabber Account Unregistration"));
m_removing=false;
......@@ -1915,7 +1909,7 @@ bool JabberAccount::oldEncrypted()
/*
JabberMoodAction::JabberMoodAction(const Mood::Type type, QObject *parent):
KAction(parent)
QAction(parent)
{
mType = type;
setText(MoodManager::self()->getMoodName(mType));
......
......@@ -316,7 +316,7 @@ void JabberBaseContact::updateResourceList ()
// resource timestamp
resourceListStr += QString ( "<tr><td>%1: %2</td></tr>" ).
arg ( i18n ( "Timestamp" ), KGlobal::locale()->formatDateTime ( (*it)->resource().status().timeStamp(), KLocale::ShortDate, true ) );
arg ( i18n ( "Timestamp" ), QLocale().toString ( (*it)->resource().status().timeStamp(), QLocale::ShortFormat ) );
// message, if any
if ( !(*it)->resource().status().status().trimmed().isEmpty () )
......@@ -682,7 +682,7 @@ void JabberBaseContact::setPropertiesFromVCard ( const XMPP::VCard &vCard )
// Downalod photo from URI.
if( !KIO::NetAccess::download( vCard.photoURI(), tempPhotoPath, 0) )
{
KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget (), KMessageBox::Sorry, i18n( "Failed to download Jabber contact photo." ) );
KMessageBox::sorry( Kopete::UI::Global::mainWidget (), i18n( "Failed to download Jabber contact photo." ) );
return;
}
......
......@@ -75,7 +75,7 @@ public:
* Create custom context menu items for the contact
* FIXME: implement manager version here?
*/
virtual QList<KAction*> *customContextMenuActions () = 0;
virtual QList<QAction *> *customContextMenuActions () = 0;
using Kopete::Contact::customContextMenuActions;
/**
......
......@@ -21,7 +21,7 @@
#include <QPointer>
#include <kdebug.h>
#include <kaction.h>
#include <QAction>
#include <kselectaction.h>
#include <klocale.h>
#include <kicon.h>
......@@ -223,7 +223,7 @@ void JabberBookmarks::insertGroupChat(const XMPP::Jid &jid)
task->go( true );
}
KAction * JabberBookmarks::bookmarksAction(QObject *parent)
QAction * JabberBookmarks::bookmarksAction(QObject *parent)
{
Q_UNUSED( parent )
......
......@@ -25,7 +25,7 @@
namespace XMPP { class Jid; }
class JabberAccount;
class KAction;
class QAction;
class JabberBookmark
{
......@@ -82,7 +82,7 @@ class JabberBookmarks : public QObject
/**
* return an action that will be added in the jabber popup menu
*/
KAction *bookmarksAction(QObject * parent);
QAction *bookmarksAction(QObject * parent);
private slots:
void accountConnected();
void slotReceivedBookmarks();
......
......@@ -50,8 +50,6 @@ JabberChatSession::JabberChatSession ( JabberProtocol *protocol, const JabberBas
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "New message manager for " << user->contactId ();
setComponentData(protocol->componentData());
// make sure Kopete knows about this instance
Kopete::ChatSessionManager::self()->registerChatSession ( this );
......
......@@ -36,7 +36,7 @@
#include <klocale.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <kaction.h>
#include <QAction>
#include <kactionmenu.h>
#include <kicon.h>
#include <kstandarddirs.h>
......@@ -134,30 +134,30 @@ JabberContact::~JabberContact()
kDebug(JABBER_DEBUG_GLOBAL) << contactId() << " is destroyed - " << this;
}
QList<KAction*> *JabberContact::customContextMenuActions ()
QList<QAction *> *JabberContact::customContextMenuActions ()
{
QList<KAction*> *actions = new QList<KAction*>();
QList<QAction *> *actions = new QList<QAction*>();
KActionMenu *actionAuthorization = new KActionMenu ( KIcon("network-connect"), i18n ("Authorization"), this);
KAction *resendAuthAction, *requestAuthAction, *removeAuthAction;
QAction *resendAuthAction, *requestAuthAction, *removeAuthAction;
resendAuthAction = new KAction( this );
resendAuthAction = new QAction( this );
resendAuthAction->setIcon( (KIcon("mail-forward") ) );
resendAuthAction->setText( i18n ("(Re)send Authorization To") );
resendAuthAction->setEnabled( mRosterItem.subscription().type() == XMPP::Subscription::To || mRosterItem.subscription().type() == XMPP::Subscription::None );
connect(resendAuthAction, SIGNAL(triggered(bool)), SLOT(slotSendAuth()));
actionAuthorization->addAction(resendAuthAction);
requestAuthAction = new KAction( this );
requestAuthAction = new QAction( this );
requestAuthAction->setIcon( (KIcon("mail-reply-sender") ) );
requestAuthAction->setText( i18n ("(Re)request Authorization From") );
requestAuthAction->setEnabled( mRosterItem.subscription().type() == XMPP::Subscription::From || mRosterItem.subscription().type() == XMPP::Subscription::None );
connect(requestAuthAction, SIGNAL(triggered(bool)), SLOT(slotRequestAuth()));
actionAuthorization->addAction(requestAuthAction);
removeAuthAction = new KAction( this );
removeAuthAction = new QAction( this );
removeAuthAction->setIcon( (KIcon("edit-delete") ) );
removeAuthAction->setText( i18n ("Remove Authorization From") );
removeAuthAction->setEnabled( mRosterItem.subscription().type() == XMPP::Subscription::Both || mRosterItem.subscription().type() == XMPP::Subscription::From );
......@@ -168,8 +168,8 @@ QList<KAction*> *JabberContact::customContextMenuActions ()
if ( account()->enabledLibjingle() ) {
KAction *libjingleCallAction;
libjingleCallAction = new KAction( this );
QAction *libjingleCallAction;
libjingleCallAction = new QAction( this );
libjingleCallAction->setIcon( (KIcon("voicecall") ) );
libjingleCallAction->setText( i18n ("Call contact") );
libjingleCallAction->setEnabled( account()->supportLibjingle(contactId()) );
......@@ -183,7 +183,7 @@ QList<KAction*> *JabberContact::customContextMenuActions ()
KActionMenu *actionSetAvailability = new KActionMenu ( KIcon("user-identity", 0, QStringList() << QString() << "user-online"), i18n ("Set Availability"), this );
#define KACTION(status, text, name, slot) \
{ KAction *tmp = new KAction(this); \
{ QAction *tmp = new QAction(this); \
tmp->setIcon( KIcon(QIcon((status).iconFor(this)))); \
tmp->setText( text ); \
connect(tmp, SIGNAL(triggered(bool)), (slot));\
......@@ -235,7 +235,7 @@ QList<KAction*> *JabberContact::customContextMenuActions ()
{
if( i == activeItem )
{
KAction *tmp = new KAction( this );
QAction *tmp = new QAction( this );
tmp->setIcon( KIcon("dialog-ok") );
tmp->setText( str);
tmp->setObjectName( QString::number(i) );
......@@ -251,7 +251,7 @@ QList<KAction*> *JabberContact::customContextMenuActions ()
QIcon iconSet ( !i ?
protocol()->resourceToKOS ( account()->resourcePool()->bestResource ( mRosterItem.jid(), false ) ).iconFor ( account () ) : protocol()->resourceToKOS ( *availableResources.find(str) ).iconFor ( account () ));
KAction *tmp = new KAction(this);
QAction *tmp = new QAction(this);
tmp->setIcon( KIcon(iconSet) );
tmp->setText( str );
tmp->setObjectName( QString::number(i) );
......@@ -270,14 +270,14 @@ QList<KAction*> *JabberContact::customContextMenuActions ()
#if 0
KAction *testAction = new KAction(i18n("Test action"), this);
QAction *testAction = new QAction(i18n("Test action"), this);
actionJingleAudioCall->setEnabled( true );
actionCollection->append( testAction );
KAction *actionJingleAudioCall = new KAction(i18n("Jingle Audio call"), this);
QAction *actionJingleAudioCall = new QAction(i18n("Jingle Audio call"), this);
connect(actionJingleAudioCall, SIGNAL(triggered(bool)), SLOT(slotJingleAudioCall()));
KAction *actionJingleVideoCall = new KAction(i18n("Jingle Video call"), this);
QAction *actionJingleVideoCall = new QAction(i18n("Jingle Video call"), this);
connect(actionJingleVideoCall, SIGNAL(triggered(bool)), SLOT(slotJingleVideoCall()));
// Check if the current contact support jingle calls, also honor lock by default.
......@@ -817,7 +817,7 @@ void JabberContact::setPhoto( const QString &photoPath )
if(contactPhoto.width() > 96 || contactPhoto.height() > 96)
{
// Save image to a new location if the image isn't the correct format.
QString newLocation( KStandardDirs::locateLocal( "appdata", "jabberphotos/"+ KUrl(photoPath).fileName().toLower() ) );
QString newLocation( KStandardDirs::locateLocal( "appdata", "jabberphotos/"+ QUrl(photoPath).fileName().toLower() ) );
// Scale and crop the picture.
contactPhoto = contactPhoto.scaled( 96, 96, Qt::KeepAspectRatio, Qt::SmoothTransformation );
......@@ -836,7 +836,7 @@ void JabberContact::setPhoto( const QString &photoPath )
else if (contactPhoto.width() < 32 || contactPhoto.height() < 32)
{
// Save image to a new location if the image isn't the correct format.
QString newLocation( KStandardDirs::locateLocal( "appdata", "jabberphotos/"+ KUrl(photoPath).fileName().toLower() ) );
QString newLocation( KStandardDirs::locateLocal( "appdata", "jabberphotos/"+ QUrl(photoPath).fileName().toLower() ) );
// Scale and crop the picture.
contactPhoto = contactPhoto.scaled( 32, 32, Qt::KeepAspectRatio, Qt::SmoothTransformation );
......@@ -855,7 +855,7 @@ void JabberContact::setPhoto( const QString &photoPath )
else if (contactPhoto.width() != contactPhoto.height())
{
// Save image to a new location if the image isn't the correct format.
QString newLocation( KStandardDirs::locateLocal( "appdata", "jabberphotos/"+ KUrl(photoPath).fileName().toLower() ) );
QString newLocation( KStandardDirs::locateLocal( "appdata", "jabberphotos/"+ QUrl(photoPath).fileName().toLower() ) );
if(contactPhoto.width() < contactPhoto.height())
contactPhoto = contactPhoto.copy((contactPhoto.width()-contactPhoto.height())/2, 0, contactPhoto.height(), contactPhoto.height());
......@@ -1107,15 +1107,15 @@ void JabberContact::slotDelayedSync( )
}
void JabberContact::sendFile ( const KUrl &sourceURL, const QString &/*fileName*/, uint /*fileSize*/ )
void JabberContact::sendFile ( const QUrl &sourceURL, const QString &/*fileName*/, uint /*fileSize*/ )
{
QString filePath;
// if the file location is null, then get it from a file open dialog
if ( !sourceURL.isValid () )
filePath = KFileDialog::getOpenFileName( KUrl(), "*", 0L, i18n ( "Kopete File Transfer" ) );
filePath = KFileDialog::getOpenFileName( QUrl(), "*", 0L, i18n ( "Kopete File Transfer" ) );
else
filePath = sourceURL.path(KUrl::RemoveTrailingSlash);
filePath = sourceURL.adjusted(QUrl::StripTrailingSlash).path();
QFile file ( filePath );
......@@ -1173,7 +1173,7 @@ void JabberContact::sendSubscription ( const QString& subType )
void JabberContact::slotSelectResource ()
{
int currentItem = QString ( static_cast<const KAction *>( sender() )->objectName () ).toUInt ();
int currentItem = QString ( static_cast<const QAction *>( sender() )->objectName () ).toUInt ();
/*
* Warn the user if there is already an active chat window.
......@@ -1182,8 +1182,7 @@ void JabberContact::slotSelectResource ()
*/
if ( manager ( Kopete::Contact::CannotCreate ) != 0 )
{
KMessageBox::queuedMessageBox ( Kopete::UI::Global::mainWidget (),
KMessageBox::Information,
KMessageBox::information ( Kopete::UI::Global::mainWidget (),
i18n ("You have preselected a resource for contact %1, "
"but you still have open chat windows for this contact. "
"The preselected resource will only apply to newly opened "
......@@ -1200,7 +1199,7 @@ void JabberContact::slotSelectResource ()
else
{
// use iconText() instead of text(), because we need stripped value without '&'
QString selectedResource = static_cast<const KAction *>(sender())->iconText();
QString selectedResource = static_cast<const QAction *>(sender())->iconText();
kDebug (JABBER_DEBUG_GLOBAL) << "Moving to resource " << selectedResource;
......
......@@ -44,7 +44,7 @@ public:
* Create custom context menu items for the contact
* FIXME: implement manager version here?
*/
QList<KAction*> *customContextMenuActions ();
QList<QAction *> *customContextMenuActions ();
using JabberBaseContact::customContextMenuActions;
/**
......@@ -88,13 +88,13 @@ public slots:
/**
* This is the JabberContact level slot for sending files.
*
* @param sourceURL The actual KUrl of the file you are sending
* @param sourceURL The actual QUrl of the file you are sending
* @param fileName (Optional) An alternate name for the file - what the
* receiver will see
* @param fileSize (Optional) Size of the file being sent. Used when sending
* a nondeterminate file size (such as over a socket)
*/
virtual void sendFile( const KUrl &sourceURL = KUrl(),
virtual void sendFile( const QUrl &sourceURL = QUrl(),
const QString &fileName = QString(), uint fileSize = 0L );
/**
......
......@@ -150,7 +150,7 @@ JabberFileTransfer::JabberFileTransfer ( JabberAccount *account, JabberBaseConta
if(canOpen) {
mXMPPTransfer->sendFile ( XMPP::Jid ( contact->fullAddress () ), KUrl(file).fileName (), mLocalFile.size (), "", preview);
mXMPPTransfer->sendFile ( XMPP::Jid ( contact->fullAddress () ), QUrl(file).fileName (), mLocalFile.size (), "", preview);
} else {
mKopeteTransfer->slotError ( KIO::ERR_CANNOT_OPEN_FOR_READING, file );
}
......
......@@ -36,11 +36,9 @@ JabberGroupChatManager::JabberGroupChatManager ( JabberProtocol *protocol, const
{
kDebug ( JABBER_DEBUG_GLOBAL ) << "New message manager for " << user->contactId ();
setComponentData(protocol->componentData());
mRoomJid = roomJid;
mInviteAction = new KActionMenu (KIcon("system-users"), i18n ("&Invite"), this);
mInviteAction = new KActionMenu (QIcon::fromTheme(QStringLiteral("system-users")), i18n ("&Invite"), this);
mInviteAction->setDelayed(false);
connect( mInviteAction->menu(), SIGNAL(aboutToShow()), this, SLOT(showInviteMenu()) );
connect( mInviteAction->menu(), SIGNAL(aboutToHide()), this, SLOT(hideInviteMenu()) );
......@@ -198,7 +196,7 @@ void JabberGroupChatManager::showInviteMenu() {
QHash <QString, Kopete::Contact *> contactList = account()->contacts();
for ( QHash <QString, Kopete::Contact *>::Iterator it = contactList.begin(); it != contactList.end(); ++it ) {
if ( ! members().contains(it.value()) && it.value()->isOnline() && it.value()->onlineStatus().status() != Kopete::OnlineStatus::Offline ) {
KAction *a = new Kopete::UI::ContactAction(it.value(), actionCollection());
QAction *a = new Kopete::UI::ContactAction(it.value(), actionCollection());
connect( a, SIGNAL(triggered(QString,bool)), this, SLOT(inviteContact(QString)) );
mInviteAction->addAction(a);
}
......
......@@ -22,7 +22,7 @@
#include <klocale.h>
#include <kfiledialog.h>
#include <kinputdialog.h>
#include <kaction.h>
#include <QAction>
#include "jabberprotocol.h"
#include "jabberaccount.h"
......@@ -123,13 +123,13 @@ JabberGroupContact::~JabberGroupContact ()
}
}
QList<KAction*> *JabberGroupContact::customContextMenuActions ()
QList<QAction *> *JabberGroupContact::customContextMenuActions ()
{
QList<KAction*> *actionCollection = new QList<KAction*>();
QList<QAction *> *actionCollection = new QList<QAction*>();
KAction *actionSetNick = new KAction(this);
QAction *actionSetNick = new QAction(this);
actionSetNick->setText( i18n ("Change nickname") );
actionSetNick->setIcon( KIcon("jabber_changenick") );
actionSetNick->setIcon( QIcon::fromTheme(QStringLiteral("jabber_changenick")) );
connect(actionSetNick, SIGNAL(triggered(bool)), this, SLOT(slotChangeNick()));
actionCollection->append( actionSetNick );
......@@ -348,15 +348,15 @@ void JabberGroupContact::removeSubContact ( const XMPP::RosterItem &rosterItem )
}
void JabberGroupContact::sendFile ( const KUrl &sourceURL, const QString &/*fileName*/, uint /*fileSize*/ )
void JabberGroupContact::sendFile ( const QUrl &sourceURL, const QString &/*fileName*/, uint /*fileSize*/ )
{
QString filePath;
// if the file location is null, then get it from a file open dialog
if ( !sourceURL.isValid () )
filePath = KFileDialog::getOpenFileName( KUrl(), "*", 0L, i18n ( "Kopete File Transfer" ) );
filePath = KFileDialog::getOpenFileName( QUrl(), "*", 0L, i18n ( "Kopete File Transfer" ) );
else
filePath = sourceURL.path(KUrl::RemoveTrailingSlash);
filePath = sourceURL.adjusted(QUrl::StripTrailingSlash).path();
QFile file ( filePath );
......
......@@ -41,7 +41,7 @@ public:
* Create custom context menu items for the contact
* FIXME: implement manager version here?
*/
QList<KAction*> *customContextMenuActions ();
QList<QAction *> *customContextMenuActions ();
using JabberBaseContact::customContextMenuActions;
/**
......@@ -66,13 +66,13 @@ public slots:
/**
* This is the JabberContact level slot for sending files.
*
* @param sourceURL The actual KUrl of the file you are sending
* @param sourceURL The actual QUrl of the file you are sending
* @param fileName (Optional) An alternate name for the file - what the
* receiver will see
* @param fileSize (Optional) Size of the file being sent. Used when sending
* a nondeterminate file size (such as over a socket)
*/
virtual void sendFile( const KUrl &sourceURL = KUrl(),
virtual void sendFile( const QUrl &sourceURL = QUrl(),
const QString &fileName = QString(), uint fileSize = 0L );
private slots:
......
......@@ -64,7 +64,7 @@ JabberGroupMemberContact::~JabberGroupMemberContact ()
}
}
QList<KAction*> *JabberGroupMemberContact::customContextMenuActions ()
QList<QAction *> *JabberGroupMemberContact::customContextMenuActions ()
{
return 0;
......@@ -291,15 +291,15 @@ QString JabberGroupMemberContact::lastReceivedMessageId () const
return mLastReceivedMessageId;
}
void JabberGroupMemberContact::sendFile ( const KUrl &sourceURL, const QString &/*fileName*/, uint /*fileSize*/ )
void JabberGroupMemberContact::sendFile ( const QUrl &sourceURL, const QString &/*fileName*/, uint /*fileSize*/ )
{
QString filePath;
// if the file location is null, then get it from a file open dialog
if ( !sourceURL.isValid () )
filePath = KFileDialog::getOpenFileName( KUrl(), "*", 0L, i18n ( "Kopete File Transfer" ) );
filePath = KFileDialog::getOpenFileName( QUrl(), "*", 0L, i18n ( "Kopete File Transfer" ) );
else
filePath = sourceURL.path(KUrl::RemoveTrailingSlash);
filePath = sourceURL.adjusted(QUrl::StripTrailingSlash).path();
QFile file ( filePath );
......
......@@ -39,7 +39,7 @@ public:
* Create custom context menu items for the contact
* FIXME: implement manager version here?
*/
QList<KAction*> *customContextMenuActions ();
QList<QAction *> *customContextMenuActions ();
using JabberBaseContact::customContextMenuActions;
/**
......@@ -62,13 +62,13 @@ public slots:
/**
* This is the JabberContact level slot for sending files.
*
* @param sourceURL The actual KUrl of the file you are sending
* @param sourceURL The actual QUrl of the file you are sending
* @param fileName (Optional) An alternate name for the file - what the
* receiver will see
* @param fileSize (Optional) Size of the file being sent. Used when sending
* a nondeterminate file size (such as over a socket)
*/
virtual void sendFile( const KUrl &sourceURL = KUrl(),
virtual void sendFile( const QUrl &sourceURL = QUrl(),
const QString &fileName = QString(), uint fileSize = 0L );
private slots:
......
......@@ -63,7 +63,7 @@ K_PLUGIN_FACTORY( JabberProtocolFactory, registerPlugin<JabberProtocol>(); )
K_EXPORT_PLUGIN( JabberProtocolFactory( "kopete_jabber" ) )
JabberProtocol::JabberProtocol (QObject * parent, const QVariantList &)
: Kopete::Protocol( JabberProtocolFactory::componentData(), parent),
: Kopete::Protocol(parent),
JabberKOSChatty(Kopete::OnlineStatus::Online, 100, this, JabberFreeForChat, QStringList("jabber_chatty"), i18n ("Free for Chat"), i18n ("Free for Chat"), Kopete::OnlineStatusManager::FreeForChat, Kopete::OnlineStatusManager::HasStatusMessage ),
JabberKOSOnline(Kopete::OnlineStatus::Online, 90, this, JabberOnline, QStringList(), i18n ("Online"), i18n ("Online"), Kopete::OnlineStatusManager::Online, Kopete::OnlineStatusManager::HasStatusMessage ),
JabberKOSAway(Kopete::OnlineStatus::Away, 80, this, JabberAway, QStringList("contact_away_overlay"), i18n ("Away"), i18n ("Away"), Kopete::OnlineStatusManager::Away, Kopete::OnlineStatusManager::HasStatusMessage),
......@@ -351,27 +351,31 @@ XMPP::Status JabberProtocol::kosToStatus( const Kopete::OnlineStatus & status ,
#include <accountselector.h>
#include <kopeteuiglobal.h>
#include <kvbox.h>
#include <QVBoxLayout>
#include "jabbercontactpool.h"
#include <kopeteview.h>
#include <kmessagebox.h>
#include <kinputdialog.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
void JabberProtocol::handleURL(const QString&, const KUrl & kurl) const
void JabberProtocol::handleURL(const QString&, const QUrl &url) const
{
QUrl url=kurl; //QUrl has better query handling.
if(url.scheme() != "xmpp" && !url.scheme().isEmpty() )
return;
url.setQueryDelimiters( '=' , ';' );
QUrlQuery query(url);
query.setQueryDelimiters( '=' , ';' );
QString accountid=url.authority();
QString jid_str=url.path();
if(jid_str.startsWith('/'))
jid_str=jid_str.mid(1);
XMPP::Jid jid = jid_str;
QString action=url.queryItems().isEmpty() ? QString() : url.queryItems().first().first;
QString action=query.queryItems().isEmpty() ? QString() : query.queryItems().first().first;
kDebug() << url.queryItemValue("body");
kDebug() << query.queryItemValue("body");
if(jid.isEmpty())
{
......@@ -390,17 +394,27 @@ void JabberProtocol::handleURL(const QString&, const KUrl & kurl) const
account = static_cast<JabberAccount*>(accounts.first());
else
{
QPointer <KDialog> chooser = new KDialog(Kopete::UI::Global::mainWidget());
chooser->setCaption( i18n("Choose Account") );
chooser->setButtons( KDialog::Ok | KDialog::Cancel );
chooser->setDefaultButton(KDialog::Ok);
KVBox * vb = new KVBox(chooser);
chooser->setMainWidget(vb);
QLabel * label = new QLabel(vb);
label->setText(i18n("Choose an account to handle the URL %1" , kurl.prettyUrl()));