From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/protocols/msn/ui/Makefile.am | 12 + kopete/protocols/msn/ui/msnadd.ui | 97 ++ kopete/protocols/msn/ui/msndebugrawcommand_base.ui | 107 ++ kopete/protocols/msn/ui/msneditaccountui.ui | 1421 ++++++++++++++++++++ kopete/protocols/msn/ui/msneditaccountwidget.cpp | 369 +++++ kopete/protocols/msn/ui/msneditaccountwidget.h | 59 + kopete/protocols/msn/ui/msninfo.ui | 221 +++ 7 files changed, 2286 insertions(+) create mode 100644 kopete/protocols/msn/ui/Makefile.am create mode 100644 kopete/protocols/msn/ui/msnadd.ui create mode 100644 kopete/protocols/msn/ui/msndebugrawcommand_base.ui create mode 100644 kopete/protocols/msn/ui/msneditaccountui.ui create mode 100644 kopete/protocols/msn/ui/msneditaccountwidget.cpp create mode 100644 kopete/protocols/msn/ui/msneditaccountwidget.h create mode 100644 kopete/protocols/msn/ui/msninfo.ui (limited to 'kopete/protocols/msn/ui') diff --git a/kopete/protocols/msn/ui/Makefile.am b/kopete/protocols/msn/ui/Makefile.am new file mode 100644 index 00000000..08a7cbac --- /dev/null +++ b/kopete/protocols/msn/ui/Makefile.am @@ -0,0 +1,12 @@ +METASOURCES = AUTO +AM_CPPFLAGS = $(KOPETE_INCLUDES) \ + -I$(srcdir)/.. \ + $(all_includes) + +noinst_LTLIBRARIES = libkopetemsnui.la + +libkopetemsnui_la_SOURCES = msnadd.ui msndebugrawcommand_base.ui msninfo.ui \ + msneditaccountui.ui msneditaccountwidget.cpp + +EXTRA_DIST = msnadd.ui msninfo.ui + diff --git a/kopete/protocols/msn/ui/msnadd.ui b/kopete/protocols/msn/ui/msnadd.ui new file mode 100644 index 00000000..ff99bb92 --- /dev/null +++ b/kopete/protocols/msn/ui/msnadd.ui @@ -0,0 +1,97 @@ + +msnAddUI + + + msnAddUI + + + + 0 + 0 + 397 + 347 + + + + + unnamed + + + 0 + + + 6 + + + + layout21 + + + + unnamed + + + + TextLabel1 + + + &MSN Passport ID: + + + AlignTop + + + addID + + + The user ID of the MSN contact you would like to add. + + + The user ID of the MSN contact you would like to add. This should be in the form of a valid E-mail address. + + + + + addID + + + The user ID of the MSN contact you would like to add. + + + The user ID of the MSN contact you would like to add. This should be in the form of a valid E-mail address. + + + + + + + textLabel2 + + + <i>(for example: joe@hotmail.com)</i> + + + AlignVCenter|AlignRight + + + + + spacer13 + + + Vertical + + + Expanding + + + + 20 + 160 + + + + + + + diff --git a/kopete/protocols/msn/ui/msndebugrawcommand_base.ui b/kopete/protocols/msn/ui/msndebugrawcommand_base.ui new file mode 100644 index 00000000..3b98ce0d --- /dev/null +++ b/kopete/protocols/msn/ui/msndebugrawcommand_base.ui @@ -0,0 +1,107 @@ + +MSNDebugRawCommand_base + + + MSNDebugRawCommand_base + + + + 0 + 0 + 320 + 201 + + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + &Parameters: + + + m_params + + + + + m_command + + + + + TextLabel1 + + + Co&mmand: + + + m_command + + + + + m_params + + + + + m_addId + + + Add &ID + + + true + + + + + m_addNewline + + + Add &new line + + + true + + + + + m_msg + + + PlainText + + + + + TextLabel3 + + + Message: + + + + + + m_command + m_params + m_addId + m_addNewline + + + + ktextedit.h + + diff --git a/kopete/protocols/msn/ui/msneditaccountui.ui b/kopete/protocols/msn/ui/msneditaccountui.ui new file mode 100644 index 00000000..5a3b8294 --- /dev/null +++ b/kopete/protocols/msn/ui/msneditaccountui.ui @@ -0,0 +1,1421 @@ + +MSNEditAccountUI +Olivier Goffart + + + Form1 + + + + 0 + 0 + 604 + 437 + + + + Account Preferences - MSN + + + + unnamed + + + 0 + + + 0 + + + + tabWidget3 + + + Rounded + + + + tab_connection + + + &Basic Setup + + + + unnamed + + + + spacer41 + + + Vertical + + + Expanding + + + + 20 + 146 + + + + + + groupBox5 + + + + 3 + 1 + 0 + 0 + + + + Registration + + + + unnamed + + + + textLabel6 + + + + 3 + 1 + 0 + 0 + + + + + 0 + 0 + + + + To connect to the Microsoft network, you will need a Microsoft Passport.<br><br>If you do not currently have a Passport, please click the button to create one. + + + WordBreak|AlignVCenter + + + + + buttonRegister + + + Re&gister New Account + + + + + + + m_accountInfo + + + Account Information + + + + unnamed + + + + layout14 + + + + unnamed + + + + TextLabel1_3 + + + + 1 + 5 + 0 + 0 + + + + &MSN Passport ID: + + + m_login + + + The user ID of the MSN contact you would like to use. + + + The user ID of the MSN contact you would like to use. This should be in the form of a valid E-mail address. + + + + + m_login + + + + + + The user ID of the MSN contact you would like to use. + + + The user ID of the MSN contact you would like to use. This should be in the form of a valid E-mail address. + + + + + + + m_password + + + + + m_autologin + + + E&xclude from connect all + + + false + + + If you check this checkbox, the account will not be connected when you press the "Connect All" button, or at startup when automatic connection at startup is enabled. + + + + + m_globalIdentity + + + Exclu&de from Global Identity + + + + + + + + + TabPage + + + MSN &Settings + + + + unnamed + + + + textLabel1_3 + + + + 1 + + + + <qt><b>Note:</b> These settings are applicable to all MSN accounts + + + WordBreak|AlignCenter + + + + + global_settings_page + + + Global MSN Options + + + + unnamed + + + + NotifyNewChat + + + + 1 + 0 + 0 + 0 + + + + Au&tomatically open a chat window when someone starts a conversation + + + This option will notify you when a contact starts typing their message, before the message is sent or finished. + + + + + layout13_2 + + + + unnamed + + + + textLabel1_4 + + + Download the msn picture: + + + <qt><p>Indicate when Kopete will download the display pictures of contacts</p> +<dl><dt>Only manually</dt><dd>The picture is not downloaded automatically. It is only downloaded when the user requests it</dd> +<dt>When a chat is open</dt><dd>The picture is downloaded when a conversation socket is opened, i.e. when you open a chat window</dd> +<dt>Automatically</dt><dd>Always try to download the picture if the contact has one. <b>Note:</b> this will open a socket, and let the user know you are downloading their picture.</dd></dl> + + + + + + Only Manually + + + + + When a Chat is Open + + + + + Automatically + + + + DownloadPicture + + + + 3 + 0 + 0 + 0 + + + + 2 + + + <qt><p>Indicate when Kopete will download the pictures of contacts</p> +<dl><dt>Only manually</dt><dd>The picture is not downloaded automatically. It is only downloaded when the user requests it</dd> +<dt>When a chat is open</dt><dd>The picture is downloaded when a conversation socket is opened, i.e. when you open a chat window</dd> +<dt>Automatically</dt><dd>Always try to download the picture if the contact has one. <b>Note:</b> this will open a socket, and let the user know you are downloading their picture.</dd></dl> + + + + + + + useCustomEmoticons + + + &Download and show custom emoticons + + + true + + + MSN Messenger allows users to download and use custom emoticons. If this option is enabled, Kopete will download these emoticons and show them. + + + + + exportEmoticons + + + E&xport the current emoticon theme to users + + + Only work with emoticons in the PNG format + + + Export all the emoticon themes as custom emoticons. +Only works for emoticons in the PNG format. + + + + + + + privacy_page + + + Privacy + + + + unnamed + + + + SendClientInfo + + + true + + + Send client information + + + + + + true + + + <qt>Make it possible for your contacts to detect if you are using Kopete.<br>We recommend leaving this checked.</qt> + + + Third party MSN clients, such as Kopete, give users the ability to let other third party clients guess which client they are using. We recommend leaving this checkbox checked. + + + + + SendTypingNotification + + + true + + + Send &typing notifications + + + true + + + <qt>Check this box to send <b>Typing notifications</b> to your contacts. When you are composing a message, you might want your contact to know that you are typing so that he knows you are answering.</qt> + + + + + layout28 + + + + unnamed + + + + SendJabber + + + Expose my Jabber account to Jabber users + + + true + + + If you have a Jabber account, you may let Jabber users on an MSN gateway know that you are also using Jabber. + + + + + JabberAccount + + + true + + + If you have a Jabber account, you may let Jabber users on an MSN gateway know that you are also using Jabber. + + + + + spacer26 + + + Horizontal + + + Expanding + + + + 61 + 21 + + + + + + + + spacer25 + + + Vertical + + + Minimum + + + + 20 + 21 + + + + + + textLabel1_5 + + + There are also privacy options in the "Contacts" tab + + + WordBreak|AlignCenter + + + + + + + spacer20 + + + Vertical + + + Expanding + + + + 31 + 40 + + + + + + + + tab_info + + + User &Info + + + + unnamed + + + + Layout22_2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2_2_2 + + + + 4 + 4 + 0 + 0 + + + + &Nickname: + + + m_displayName + + + The alias you would like to use on MSN. You may change this at any time you wish. + + + + + m_displayName + + + false + + + The alias you would like to use on MSN. You may change this at any time you wish. + + + + + + + m_phones + + + Phone Numbers + + + + unnamed + + + + TextLabel5 + + + Hom&e: + + + m_phh + + + + + TextLabel6 + + + &Work: + + + m_phw + + + + + m_phw + + + + + m_phh + + + + + TextLabel7 + + + &Mobile: + + + m_phm + + + + + m_phm + + + + + + + groupBox2 + + + Display Picture + + + + unnamed + + + + layout17 + + + + unnamed + + + + m_useDisplayPicture + + + E&xport a display picture + + + + + textLabel1_2 + + + false + + + + 5 + 5 + 0 + 0 + + + + Please select a square image. The image will be scaled to 96x96. + + + WordBreak|AlignVCenter + + + + + layout13 + + + + unnamed + + + + m_selectImage + + + false + + + &Select Image... + + + + + spacer5 + + + Horizontal + + + Expanding + + + + 61 + 21 + + + + + + + + spacer7_2_2 + + + Vertical + + + Minimum + + + + 20 + 1 + + + + + + + + layout16 + + + + unnamed + + + 0 + + + + m_displayPicture + + + false + + + + 0 + 0 + 0 + 0 + + + + + 96 + 96 + + + + + 96 + 96 + + + + GroupBoxPanel + + + true + + + + + spacer7_2 + + + Vertical + + + Minimum + + + + 20 + 1 + + + + + + + + + + spacer16 + + + Vertical + + + Expanding + + + + 20 + 21 + + + + + + m_warning_1 + + + + 255 + 0 + 0 + + + + + 1 + + + + WARNING: You need to be connected to modify this page. + + + WordBreak|AlignVCenter + + + + + + + tab_contacts + + + Con&tacts + + + + unnamed + + + + label_font + + + <i>Italics</i> contacts are not on your contact list.<br> +<br> +<b>Bold</b> contacts are in your contact list but you are not in their contact list. + + + + + layout6 + + + + unnamed + + + + textLabel2 + + + Bloc&ked contacts: + + + m_BL + + + + + m_AL + + + + + layout4 + + + + unnamed + + + + m_blockButton + + + &> + + + + + m_allowButton + + + &< + + + + + spacer13 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + textLabel1 + + + Allo&wed contacts: + + + m_AL + + + + + m_BL + + + + + + + layout58 + + + + unnamed + + + + spacer47 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + m_blp + + + Block all users not in 'Allowed' &list + + + Checking this box will block all users not explicitly shown in the allowed list here, including any contacts not on your contact list. + + + + + spacer50 + + + Horizontal + + + Expanding + + + + 41 + 20 + + + + + + + + layout59 + + + + unnamed + + + + spacer48 + + + Horizontal + + + Expanding + + + + 81 + 20 + + + + + + m_RLButton + + + + 200 + 32767 + + + + View &Reverse List + + + The reverse list is the list of contacts who added you to their own contact list. + + + The reverse list is the list of contacts who added you to their own contact list. + + + + + spacer49 + + + Horizontal + + + Expanding + + + + 111 + 20 + + + + + + + + m_warning_2 + + + + 255 + 0 + 0 + + + + + 1 + + + + WARNING: You need to be connected to modify this page + + + WordBreak|AlignVCenter + + + + + + + TabPage + + + Co&nnection + + + + unnamed + + + + groupBox66 + + + Connection Preferences (for advanced users) + + + + unnamed + + + + optionOverrideServer + + + &Override default server information + + + + + layout20 + + + + unnamed + + + + layout19 + + + + unnamed + + + 3 + + + + labelServer + + + false + + + Ser&ver / + + + m_serverName + + + + + labelPort + + + false + + + po&rt: + + + m_serverPort + + + + + + + m_serverName + + + false + + + + 3 + 0 + 0 + 0 + + + + messenger.hotmail.com + + + Only modify these values if you want to use a special IM proxy server, like SIMP + + + Only modify these values if you want to use a special IM proxy server, like SIMP + + + + + m_serverPort + + + false + + + 65535 + + + 1 + + + 1863 + + + Only modify these values if you want to use a special IM proxy server, like SIMP + + + Only modify these values if you want to use a special IM proxy server, like SIMP + + + + + + + optionUseHttpMethod + + + Use &HTTP method + + + Connect to MSN Messenger using an HTTP-like protocol on port 80. +This may be used to connect on a network with a restrictive firewall. +Only check this option if the normal connection doesn't work. + + + + + layout22 + + + + unnamed + + + + m_useWebcamPort + + + S&pecify a base port for incoming webcam connections: + + + If you are behind a firewall, you may specify a base port to use for the incoming connection, and configure your firewall to accept connections on a range of 10 ports, starting at this one. Incoming connections are used for the webcam. If you don't specify a port yourself, the operating system will choose an available port for you. It is recommended to leave the checkbox unchecked. + + + + + m_webcamPort + + + false + + + 65535 + + + 1 + + + 6891 + + + If you are behind a firewall, you may specify a base port to use for the incoming connection, and configure your firewall to accept connections on a range of 10 ports, starting at this one. Incoming connections are used for the webcam. If you don't specify a port yourself, the operating system will choose an available port for you. It is recommended to leave the checkbox unchecked. + + + + + + + + + spacer7 + + + Vertical + + + Expanding + + + + 21 + 70 + + + + + + + + + labelStatusMessage + + + + + + AlignCenter + + + + + + + Kopete::UI::PasswordWidget +
kopetepasswordwidget.h
+ + 50 + 50 + + 0 + + 1 + 0 + 0 + 0 + + image0 + changed() +
+
+ + + 89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032b49444154388db59531681b6714c77f32373c8186ef0305eea0050932f8201d944d493bc4d0a1a21e4427bb533a74299dbc25905288a7d0b9836932d58116eac1411932388ba421a5a7a17005174e83e00e2cb80f6ab83708d2e18bec8ada26d0f4c1c1ddbbf7fdeeff3efeefbbda70346419b76fdd7ecd3b88e16858ab2dc183c3c1ebee7a97a99b521515d969f65610e71cd971c6f8d7312ccef3c152e9b39f9e11351d36164acdb819d4a9b4c4362ce5a2c48a45162588253ff5cfe5a2c406862405d9138e5eea2a18609a4fb12d212d7ea42c334089ac92e6423113cab902826d4227568a002480a942780dead16a2767e0ca55949a81668023b2c2e8952139748c270e58aa115aebc2675b86b80b6143710aa1b9049ccd336e064a5979e8e039ec7f5f78544368af1b24807ca64cff50befba6a0b765d8be2b67f00bc1562c95e6441646afe40d54b9f36948af2fb4df078722440c0e2af6f70a064f0be2568beea6c5885b01af2d6f4a2db10dc8ff128e0edc19f4f32f8576dbe1707022fcf2b4647babce175f8780f0c31307a7e0162bdc55c5e52247e742fabbc31843af2f9886c32d40d4b0fb4849278ef20476ee59c62f7ced3831848d55f0aa62816ca6de11ad37ed2fa10f1ce9c4619ac2c647824a45dc1100f2a9e2542e067b9f82155f108adf539c61f781924efc0745c0be57273240b08409e62ac508d0f085c94c112c83e778a54608434331733cbc9f331a5bf2636f85a855bfda15f9694e27565ad785e99fcae0a062fb6e4479a2f43e16eacd3a0fef433175ec7e95a1aa98a6d0e95454f355f2bff65803e8f5bddbf7f70a0687393bf72ced2e74ba253bdfb631a1c139872e948d7e487c83ab15979a2301dcba033a373c7e52f0f851c1f885d0ed080ec88f7374ae672b7f3b72249b115143389fce7f4e5e91d11398cefd986e6c099816839fbd1bd2c9b91ad3147afd16a32387534580ac58957c0e3ece485230d77c5ba6a1f4fa42ef9398719253153e1f5f8f687f9013df80f16684c1e0161969b20aae0d47437fc007d0f950882210c19fad81bf24f04e399701a04820380769a2e485e28a0b14b380e4a5927059e85be67cac5dfae63fc61af87fd4ff027ed7f0e16858fb1ba5cd86c64770b2e90000000049454e44ae426082 + + + + + m_useDisplayPicture + toggled(bool) + m_selectImage + setEnabled(bool) + + + m_useDisplayPicture + toggled(bool) + m_selectImage + setEnabled(bool) + + + m_useDisplayPicture + toggled(bool) + textLabel1_2 + setEnabled(bool) + + + optionOverrideServer + toggled(bool) + labelServer + setEnabled(bool) + + + optionOverrideServer + toggled(bool) + m_serverName + setEnabled(bool) + + + optionOverrideServer + toggled(bool) + labelPort + setEnabled(bool) + + + optionOverrideServer + toggled(bool) + m_serverPort + setEnabled(bool) + + + m_useDisplayPicture + toggled(bool) + m_displayPicture + setEnabled(bool) + + + m_useWebcamPort + toggled(bool) + m_webcamPort + setEnabled(bool) + + + + tabWidget3 + optionOverrideServer + m_serverName + m_serverPort + optionUseHttpMethod + m_login + m_autologin + buttonRegister + m_displayName + m_phw + m_phh + m_phm + m_useDisplayPicture + m_selectImage + m_AL + m_blockButton + m_allowButton + m_BL + m_blp + m_RLButton + + + + kopetepasswordwidget.h + kcombobox.h + klineedit.h + +
diff --git a/kopete/protocols/msn/ui/msneditaccountwidget.cpp b/kopete/protocols/msn/ui/msneditaccountwidget.cpp new file mode 100644 index 00000000..1829f41d --- /dev/null +++ b/kopete/protocols/msn/ui/msneditaccountwidget.cpp @@ -0,0 +1,369 @@ +/* + msneditaccountwidget.cpp - MSN Account Widget + + Copyright (c) 2003 by Olivier Goffart + Copyright (c) 2003 by Martijn Klingens + + Kopete (c) 2002-2003 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include "msneditaccountwidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kopeteuiglobal.h" +#include "kopeteglobal.h" + +#include "kopetepasswordwidget.h" +#include "kopeteaccountmanager.h" + +#include "msnaccount.h" +#include "msncontact.h" +#include "msneditaccountui.h" +#include "msnnotifysocket.h" +#include "msnprotocol.h" + +class MSNEditAccountWidgetPrivate +{ +public: + MSNProtocol *protocol; + KAutoConfig *autoConfig; + MSNEditAccountUI *ui; + + QString pictureUrl; + QImage pictureData; +}; + +MSNEditAccountWidget::MSNEditAccountWidget( MSNProtocol *proto, Kopete::Account *account, QWidget *parent, const char * /* name */ ) +: QWidget( parent ), KopeteEditAccountWidget( account ) +{ + d = new MSNEditAccountWidgetPrivate; + + d->protocol=proto; + + ( new QVBoxLayout( this, 0, 0 ) )->setAutoAdd( true ); + + d->ui = new MSNEditAccountUI( this ); + + d->autoConfig = new KAutoConfig( d->ui ); + d->autoConfig->addWidget( d->ui->global_settings_page, "MSN" ); + d->autoConfig->addWidget( d->ui->privacy_page, "MSN" ); + //the JabberAccount need to be saved as text, and can't be handled by kautoconfig + d->autoConfig->ignoreSubWidget( d->ui->JabberAccount ); + d->autoConfig->retrieveSettings( true ); + + //Get a list of all jabber accounts + KGlobal::config()->setGroup("MSN"); + QString jab_account=KGlobal::config()->readEntry("JabberAccount"); + + QPtrList accounts = Kopete::AccountManager::self()->accounts(); + for(Kopete::Account *a=accounts.first() ; a; a=accounts.next() ) + { + if(a->protocol()->pluginId()=="JabberProtocol") + { + d->ui->JabberAccount->insertItem(a->accountId()); + if( jab_account.isEmpty() ) + jab_account=a->accountId(); + } + } + d->ui->JabberAccount->setCurrentText(jab_account); + + // FIXME: actually, I don't know how to set fonts for qlistboxitem - Olivier + d->ui->label_font->hide(); + + // default fields + if ( account ) + { + KConfigGroup * config=account->configGroup(); + + d->ui->m_login->setText( account->accountId() ); + d->ui->m_password->load( &static_cast(account)->password() ); + + //remove me after we can change account ids (Matt) + d->ui->m_login->setDisabled( true ); + d->ui->m_autologin->setChecked( account->excludeConnect() ); + if ( ( static_cast(account)->serverName() != "messenger.hotmail.com" ) || ( static_cast(account)->serverPort() != 1863) ) { + d->ui->optionOverrideServer->setChecked( true ); + } + + d->ui->m_webcamPort->setDisabled(true); + uint port=config->readNumEntry("WebcamPort" ,0); + d->ui->m_useWebcamPort->setChecked( port != 0); + d->ui->m_webcamPort->setValue( port != 0 ? port : 6891 ); + + d->ui->optionUseHttpMethod->setChecked( static_cast(account)->useHttpMethod() ); + + MSNContact *myself = static_cast( account->myself() ); + + d->ui->m_displayName->setText( myself->property( Kopete::Global::Properties::self()->nickName()).value().toString() ); + d->ui->m_phw->setText( config->readEntry("PHW") ); + d->ui->m_phm->setText( config->readEntry("PHM") ); + d->ui->m_phh->setText( config->readEntry("PHH") ); + + bool connected = account->isConnected(); + if ( connected ) + { + d->ui->m_warning_1->hide(); + d->ui->m_warning_2->hide(); + } + d->ui->m_phones->setEnabled( connected ); + d->ui->m_displayName->setEnabled( connected ); + d->ui->m_allowButton->setEnabled( connected ); + d->ui->m_blockButton->setEnabled( connected ); + + MSNAccount *m_account = static_cast( account ); + d->ui->m_serverName->setText( m_account->serverName() ); + d->ui->m_serverPort->setValue( m_account->serverPort() ); + + QStringList blockList = config->readListEntry( "blockList" ); + QStringList allowList = config->readListEntry( "allowList" ); + //QStringList reverseList = config->readListEntry("reverseList" ); + + for ( QStringList::Iterator it = blockList.begin(); it != blockList.end(); ++it ) + d->ui->m_BL->insertItem( *it ); + + for ( QStringList::Iterator it = allowList.begin(); it != allowList.end(); ++it ) + d->ui->m_AL->insertItem( *it ); + + d->ui->m_blp->setChecked( config->readEntry( "BLP" ) == "BL" ); + + d->pictureUrl = locateLocal( "appdata", "msnpicture-" + + account->accountId().lower().replace( QRegExp("[./~]" ), "-" ) + ".png" ); + d->ui->m_displayPicture->setPixmap( d->pictureUrl ); + + d->ui->m_useDisplayPicture->setChecked( config->readBoolEntry( "exportCustomPicture" )); + + // Global Identity + d->ui->m_globalIdentity->setChecked( config->readBoolEntry("ExcludeGlobalIdentity", false) ); + } + else + { + d->ui->tab_contacts->setDisabled( true ); + d->ui->m_displayName->setDisabled( true ); + d->ui->m_phones->setDisabled( true ); + } + + connect( d->ui->m_allowButton, SIGNAL( clicked() ), this, SLOT( slotAllow() ) ); + connect( d->ui->m_blockButton, SIGNAL( clicked() ), this, SLOT( slotBlock() ) ); + connect( d->ui->m_selectImage, SIGNAL( clicked() ), this, SLOT( slotSelectImage() ) ); + connect( d->ui->m_RLButton, SIGNAL( clicked() ), this, SLOT( slotShowReverseList() ) ); + connect( d->ui->buttonRegister, SIGNAL(clicked()), this, SLOT(slotOpenRegister())); + QWidget::setTabOrder( d->ui->m_login, d->ui->m_password->mRemembered ); + QWidget::setTabOrder( d->ui->m_password->mRemembered, d->ui->m_password->mPassword ); + QWidget::setTabOrder( d->ui->m_password->mPassword, d->ui->m_autologin ); +} + +MSNEditAccountWidget::~MSNEditAccountWidget() +{ + delete d; +} + +Kopete::Account * MSNEditAccountWidget::apply() +{ + d->autoConfig->saveSettings(); + KGlobal::config()->setGroup("MSN"); + KGlobal::config()->writeEntry("JabberAccount", d->ui->JabberAccount->currentText()); + + if ( !account() ) + setAccount( new MSNAccount( d->protocol, d->ui->m_login->text() ) ); + + KConfigGroup *config=account()->configGroup(); + + account()->setExcludeConnect( d->ui->m_autologin->isChecked() ); + d->ui->m_password->save( &static_cast(account())->password() ); + + config->writeEntry( "exportCustomPicture", d->ui->m_useDisplayPicture->isChecked() ); + if (d->ui->optionOverrideServer->isChecked() ) { + config->writeEntry( "serverName", d->ui->m_serverName->text() ); + config->writeEntry( "serverPort", d->ui->m_serverPort->value() ); + } + else { + config->writeEntry( "serverName", "messenger.hotmail.com" ); + config->writeEntry( "serverPort", "1863" ); + } + + config->writeEntry( "useHttpMethod", d->ui->optionUseHttpMethod->isChecked() ); + + if(d->ui->m_useWebcamPort->isChecked()) + config->writeEntry( "WebcamPort" , d->ui->m_webcamPort->value() ); + else + config->writeEntry( "WebcamPort" , 0 ); + + // Global Identity + config->writeEntry( "ExcludeGlobalIdentity", d->ui->m_globalIdentity->isChecked() ); + + // Save the avatar image + if( d->ui->m_useDisplayPicture->isChecked() && !d->pictureData.isNull() ) + { + d->pictureUrl = locateLocal( "appdata", "msnpicture-" + + account()->accountId().lower().replace( QRegExp("[./~]" ), "-" ) + ".png" ); + if ( d->pictureData.save( d->pictureUrl, "PNG" ) ) + { + static_cast( account() )->setPictureUrl( d->pictureUrl ); + } + else + { + KMessageBox::sorry( this, i18n( "An error occurred when trying to change the display picture.
" + "Make sure that you have selected a correct image file
" ), i18n( "MSN Plugin" ) ); + } + } + + static_cast( account() )->resetPictureObject(); + + if ( account()->isConnected() ) + { + MSNContact *myself = static_cast( account()->myself() ); + MSNNotifySocket *notify = static_cast( account() )->notifySocket(); + if ( d->ui->m_displayName->text() != myself->property( Kopete::Global::Properties::self()->nickName()).value().toString() ) + static_cast( account() )->setPublicName( d->ui->m_displayName->text() ); + + if ( notify ) + { + if ( d->ui->m_phw->text() != myself->phoneWork() && ( !d->ui->m_phw->text().isEmpty() || !myself->phoneWork().isEmpty() ) ) + notify->changePhoneNumber( "PHW", d->ui->m_phw->text() ); + if( d->ui->m_phh->text() != myself->phoneHome() && ( !d->ui->m_phh->text().isEmpty() || !myself->phoneHome().isEmpty() ) ) + notify->changePhoneNumber( "PHH", d->ui->m_phh->text() ); + if( d->ui->m_phm->text() != myself->phoneMobile() && ( !d->ui->m_phm->text().isEmpty() || !myself->phoneMobile().isEmpty() ) ) + notify->changePhoneNumber( "PHM", d->ui->m_phm->text() ); + // (the && .isEmpty is because one can be null and the other empty) + + if ( ( config->readEntry("BLP") == "BL" ) != d->ui->m_blp->isChecked() ) + { + // Yes, I know, calling sendCommand here is not very clean - Olivier + notify->sendCommand( "BLP", d->ui->m_blp->isChecked() ? "BL" : "AL" ); + } + } + } + return account(); +} + +bool MSNEditAccountWidget::validateData() +{ + QString userid = d->ui->m_login->text(); + if ( MSNProtocol::validContactId( userid ) ) + return true; + + KMessageBox::queuedMessageBox( Kopete::UI::Global::mainWidget(), KMessageBox::Sorry, + i18n( "You must enter a valid email address." ), i18n( "MSN Plugin" ) ); + return false; +} + +void MSNEditAccountWidget::slotAllow() +{ + //TODO: play with multiple selection + QListBoxItem *item = d->ui->m_BL->selectedItem(); + if ( !item ) + return; + + QString handle = item->text(); + + MSNNotifySocket *notify = static_cast( account() )->notifySocket(); + if ( !notify ) + return; + notify->removeContact( handle, MSNProtocol::BL, QString::null, QString::null ); + + d->ui->m_BL->takeItem( item ); + d->ui->m_AL->insertItem( item ); +} + +void MSNEditAccountWidget::slotBlock() +{ + //TODO: play with multiple selection + QListBoxItem *item = d->ui->m_AL->selectedItem(); + if ( !item ) + return; + + QString handle = item->text(); + + MSNNotifySocket *notify = static_cast( account() )->notifySocket(); + if ( !notify ) + return; + + notify->removeContact( handle, MSNProtocol::AL, QString::null, QString::null ); + + d->ui->m_AL->takeItem( item ); + d->ui->m_BL->insertItem( item ); +} + +void MSNEditAccountWidget::slotShowReverseList() +{ + QStringList reverseList = account()->configGroup()->readListEntry( "reverseList" ); + KMessageBox::informationList( this, i18n( "Here you can see a list of contacts who added you to their contact list" ), reverseList, + i18n( "Reverse List - MSN Plugin" ) ); +} + +void MSNEditAccountWidget::slotSelectImage() +{ + QString path = 0; + bool remoteFile = false; + KURL filePath = KFileDialog::getImageOpenURL( QString::null, this, i18n( "MSN Display Picture" ) ); + if( filePath.isEmpty() ) + return; + + if( !filePath.isLocalFile() ) { + if(!KIO::NetAccess::download( filePath, path, this )) { + KMessageBox::sorry( this, i18n( "Downloading of display image failed" ), i18n( "MSN Plugin" ) ); + return; + } + remoteFile = true; + } + else path = filePath.path(); + + QImage img( path ); + img = KPixmapRegionSelectorDialog::getSelectedImage( QPixmap(img), 96, 96, this ); + + if(!img.isNull()) + { + img = MSNProtocol::protocol()->scalePicture(img); + + d->ui->m_displayPicture->setPixmap( QPixmap(img) ); + d->pictureData = img; + } + else + { + KMessageBox::sorry( this, i18n( "An error occurred when trying to change the display picture.
" + "Make sure that you have selected a correct image file
" ), i18n( "MSN Plugin" ) ); + } + if( remoteFile ) KIO::NetAccess::removeTempFile( path ); +} + +void MSNEditAccountWidget::slotOpenRegister() +{ + KRun::runURL( "http://register.passport.net/", "text/html" ); +} + +#include "msneditaccountwidget.moc" + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/protocols/msn/ui/msneditaccountwidget.h b/kopete/protocols/msn/ui/msneditaccountwidget.h new file mode 100644 index 00000000..2b8b8f6e --- /dev/null +++ b/kopete/protocols/msn/ui/msneditaccountwidget.h @@ -0,0 +1,59 @@ +/* + msneditaccountwidget.h - MSN Account Widget + + Copyright (c) 2003 by Olivier Goffart + Copyright (c) 2003 by Martijn Klingens + + Kopete (c) 2002-2003 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef MSNEDITACCOUNTWIDEGET_H +#define MSNEDITACCOUNTWIDEGET_H + +#include + +#include "editaccountwidget.h" + +namespace Kopete { class Account; } + +class MSNProtocol; + +class MSNEditAccountWidgetPrivate; + +/** + * @author Olivier Goffart + */ +class MSNEditAccountWidget : public QWidget, public KopeteEditAccountWidget +{ + Q_OBJECT + +public: + MSNEditAccountWidget( MSNProtocol *proto, Kopete::Account *account, QWidget *parent = 0, const char *name = 0 ); + ~MSNEditAccountWidget(); + virtual bool validateData(); + virtual Kopete::Account * apply(); + +private slots: + void slotAllow(); + void slotBlock(); + void slotShowReverseList(); + void slotSelectImage(); + void slotOpenRegister(); + +private: + MSNEditAccountWidgetPrivate *d; +}; + +#endif + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/protocols/msn/ui/msninfo.ui b/kopete/protocols/msn/ui/msninfo.ui new file mode 100644 index 00000000..17f1eecd --- /dev/null +++ b/kopete/protocols/msn/ui/msninfo.ui @@ -0,0 +1,221 @@ + +MSNInfo + + + MSNInfo + + + + 0 + 0 + 457 + 360 + + + + + unnamed + + + + Layout22 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2_2 + + + + 4 + 4 + 0 + 0 + + + + Email address: + + + + + m_id + + + true + + + + + + + Layout22_2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2_2_2 + + + + 4 + 4 + 0 + 0 + + + + Display name: + + + + + m_displayName + + + true + + + + + + + layout3 + + + + unnamed + + + + textLabel1 + + + Personal message: + + + + + m_personalMessage + + + true + + + + + + + GroupBox2 + + + Phones + + + + unnamed + + + + TextLabel5 + + + Home: + + + + + TextLabel6 + + + Work: + + + + + m_phw + + + true + + + + + m_phh + + + true + + + + + TextLabel7 + + + Mobile: + + + + + m_phm + + + true + + + + + + + m_reversed + + + I am on &the contact list of this contact + + + Show whether you are on the contact list of this user + + + If this box is checked, you are on this user's contact list. +If not, the user has not added you to their list, or has removed you. + + + + + Spacer10 + + + Vertical + + + Expanding + + + + 20 + 40 + + + + + + + -- cgit v1.2.1