diff --git a/AUTHORS b/AUTHORS index de05a1f..19bdbd7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -66,6 +66,7 @@ Lauri Võsandi Mihkel Tõnnov Rivo Laks + Timo Tambet Finnish: @@ -82,6 +83,8 @@ Andrea Blankenstijn Barthe Guillaume Scias + Grégory Bellier + Anthony Rey Galician: @@ -245,6 +248,12 @@ - Internationalization fixes - Drag'n'drop of images into display pictures + Francesco Nwokeka + - Now Listening toggle button above the contact list. + + Timo Tambet + - Contact Changed and Group Changed notifications. + KMerlin - Inspiration and assorted code diff --git a/CMakeLists.txt b/CMakeLists.txt index c2eb1f8..9f3ec49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,7 +150,7 @@ INCLUDE_DIRECTORIES( ${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${LIBXM # Switch between the following two commands to force using a predefined version number # EXECUTE_PROCESS( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/get-git-version.sh OUTPUT_VARIABLE KMESS_VERSION ) -SET( KMESS_VERSION "2.0.4" ) +SET( KMESS_VERSION "2.0.5" ) #### Define compiler flags #### diff --git a/COPYING_ICONS b/COPYING_ICONS new file mode 100644 index 0000000..e6d6372 --- /dev/null +++ b/COPYING_ICONS @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/ChangeLog b/ChangeLog index 27f8c98..961df75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,66 @@ + +--- 2.0.5 released --- + +2010-10-23 (Valerio) + * Added new chats to the log records, no need to logout to see the chat logs of + the current session anymore. + * Made the HTTP connection timer fix from yesterday to compile with Qt < 4.7. + * Fixed building with certain compiler configurations. + +2010-10-22 (Valerio) + * Show user's display picture in chat by default. + * Fixed HTTP connection timers, now midnight and clock skews don't cause any + more the HTTP rate limiter to fail. + +2010-10-16 (Valerio) + * Integrated Chat History with the Chat Window: + - added a menu item and toolbar action, showing a menu containing the current + tab's contacts; + - added a context menu entry in the Contacts Panel. + * Removed some unused code in ContactFrame. + * Fixed logging in with long passwords (17+ characters). The Live servers don't + accept those, hehehe. + +2010-10-16 (Adam) + * Fix the parsing of offline IM messages. + +2010-09-19 (Adam) + * Fix a signal issue in MsnNotificationConnection, thanks Timo Tambet + +2010-09-10 (Pano) + * Merged an updated Traditional Chinese translation by Yen-chou Chen. + +2010-09-03 (Adam) + * Fix a crash caused when the contacts widget was deleted twice in a chat window. + +2010-09-02 (Sjors) + * Add tag to status notification messages so HTML is stripped correctly + by knotify. + +2010-08-13 (Pano) + * Merged an updated Estonian translation by Timo Tambet. + +2010-08-13 (Pano) + * Merged an updated Hungarian translation by József Makay. + +2010-08-11 (Adam) + * Merge modified patch by Timo Tambet that gives notifications for address + book changes (contact and group changes). + +2010-08-05 (Adam) + * Bump version number to 2.0.5dev + +2010-08-05 (Sjors) + * Made the SOAP request waiter its own object instead of a QTimer::singleShot + because now it can be stopped if logging in fails, fixing a crash. + +2010-08-04 (Pano) + * Merged an updated French translation by Anthony Rey. + +--- 2.0.4 released --- + 2010-07-25 (Adam) - * Merge fix for ticket #524, thanks to Timo Tambert + * Fix ticket #524, thanks to Timo Tambet 2010-07-24 (Adam) * Properly handle non-messenger Hotmail contacts that appear on our address book. @@ -53,6 +114,10 @@ * Fixed the ability to drag'n'drop into the message editor a received Ink drawing, and an issue with the Ink editor button when doing so. +2010-06-29 (Valerio) + * Added a class to autonomously manage the chat logs retrieval. + * Rewritten the Chat History dialog, now using a calendar to list dates with available chat logs. + 2010-06-27 (Pano) * Merged an updated Traditional Chinese translation by the Tryneeds-Chinese Translation Platform. diff --git a/Doxyfile b/Doxyfile index 963b92f..0076807 100644 --- a/Doxyfile +++ b/Doxyfile @@ -5,7 +5,7 @@ #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = KMess -PROJECT_NUMBER = 2.0.4 +PROJECT_NUMBER = 2.0.5 OUTPUT_DIRECTORY = ./apidocs CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English diff --git a/FEATURES b/FEATURES index ed81280..8e9c64b 100644 --- a/FEATURES +++ b/FEATURES @@ -1,11 +1,5 @@ KMess Feature list ======================== -- 2.0.4 - -New system tray icon when KMess is loaded onto KDE 4.4+. -Improved support for notifications on Mac. -Added a button on the contact list for quick "now listening" toggling. -Ability to drag and drop drawings into the editor to re-send them. - - 2.0.3 - Setting your friendly name and personal message by clicking on their labels in the contact list. A display of the unread email count in the system tray tooltip. diff --git a/NEWS b/NEWS index 09db855..0b07912 100644 --- a/NEWS +++ b/NEWS @@ -1,42 +1,57 @@ +Changes between KMess SVN and 2.0.5: +-------------------------------------- + +- None yet. + +Changes between KMess 2.0.5 and 2.0.4: +-------------------------------------- + +- added Chat History integration with the Chat Window, with a menu item, toolbar + action, and a context menu item. +- added KDE notifications for contact and group changes (Patch by Timo Tambet). +- fixed a crash due to changes by Microsoft in how Offline Messages are sent. +- fixed a possible crash during login. +- fixed a crash when closing a chat window. +- fixed logging in with long passwords (17+ characters). MSN cuts them to 16, hehehe. +- removed all HTML from KDE notifications to fix weird text cutting problems. +- updated French translation by Anthony Rey. +- updated Estonian translation by Timo Tambet. +- updated Hungarian translation by József Makay. +- updated Traditional Chinese translation by Yen-chou Chen. + Changes between KMess 2.0.4 and 2.0.3: -------------------------------------- -- added ability to drag and drop drawings into the message editor to be re-sent. -- added support for the new KDE 4.4+ system tray icon. -- added a toggle button for "now listening" to the contact list. -- added displaying the currently playing song above the contact list, even while appearing offline. + +- added a tip text on the contact list's search bar (Patch by Timo Tambet). +- added support for a new ISF-Qt feature, PNG fortification, allowing to drag + and drop handwriting drawings into the message editor to be edited. +- added support for notifications on the Mac. +- added a toggle button for Now Listening to the contact list (Patch by Francesco Nwokeka). - added Galician translation by Indalecio Freiría Santos. -- removed the "contact does not have you on their contact list" text from the tool tips, - as this feature is currently broken (the servers report incorrect data). -- fixed "contact added you" dialogs from appearing when they should not. -- fixed sending messages only containing whitespace. -- fixed pressing Enter to send a drawing worked even when nothing was in the drawing. -- fixed the ability to drag'n'drop into the message editor a received Ink drawing. -- fixed dimensions of the display picture in the contacts dock. -- fixed chat history box, now it respects the "Show contacts emails instead of friendly names" option. -- fixed ignoring non-messenger contacts, who are not supported by KMess 2.0.x . -- fixed retrieving display pictures from the server. -- fixed building KMess from Fedora 13. -- fixed compatibility with KDE 4.5 . -- fixed error at login when the user had a new display picture to download. -- fixed multiple copies of a single DP were appearing in the "set previous - display picture" dialog and the contact properties dialog. -- fixed bug in Now Listening when querying MPRIS-compatible media players. -- fixed account properties updating in some cases. -- fixed "Log in Automatically" option saving in some cases. -- fixed bug where the status was set to "Idle" upon waking up from sleep or disconnection. -- fixed the application icon under Windows and Mac. -- improved the contact list to be sorted by status, then alphabetically. -- improved notifications support on Mac. -- updated Traditional Chinese translation by Yen-chou Chen and the Tryneeds-Chinese Translation Platform. +- fixed invalid characters in contact frame tooltips. +- fixed "Contact Added User" dialog pop-ups, appearing for already added contacts. +- fixed the application icon resolution. +- fixed log in failure, due to a mismanaged remote display picture reception. +- fixed URL when retrieving display pictures from MSN. +- fixed saving account properties. +- fixed removal and blocking of contacts. +- fixed saving the automatic login option. +- fixed status changing bugs when disconnecting or waking up from sleep. +- improved compatibility with KDE 4.5. +- improved the Chat History dialog, now using a calendar to list dates with available chat logs. +- improved contact list sorting, now done by status, then alphabetically (Patch by dah_ at the boards). +- improved management of unknown contacts. +- improved widget sizes and behavior on the contact list. +- updated the system tray widget to the new KDE 4.3+ one. - updated Japanese translation by Daniel E. Moctezuma. -- updated Brazilian Portuguese translation by Morris Arozi Moraes. -- updated French translation by Grégory Bellier. -- updated German translation. - updated Dutch translation by Heimen Stoffels. -- updated Dutch translation by Heimen Stoffels. -- updated Japanese translation by Daniel E. Moctezuma. +- updated German translation by Panagiotis Papadopoulos. - updated Catalan translation by Adrià Arrufat. +- updated Traditional Chinese translation by the Tryneeds-Chinese Translation Platform. +- updated French translation by Grégory Bellier. +- updated Brazilian Portuguese translation by Morris Arozi Moraes. +- updated Traditional Chinese translation by Yen-chou Chen. Changes between KMess 2.0.3 and 2.0.2: -------------------------------------- @@ -77,8 +92,7 @@ Changes between KMess 2.0.2 and 2.0.1: Changes between KMess 2.0.1 and 2.0: -------------------------------------- - added a "Log in automatically" checkbox to the initial view (patch by Camille Begue). -- added ability to open the chat history dialog when not connected - (patch by Camille Begue). +- added ability to open the chat history dialog when not connected (patch by Camille Begue). - added Test Server support. - added shortcut checking of added/edited emoticons for invalid characters. - added usage of smooth pixmap scaling for display pictures in the contact list. diff --git a/README b/README index 82a6fbc..6b8e6f3 100644 --- a/README +++ b/README @@ -63,6 +63,17 @@ To build a TGZ package for Slackware, run: +Licensing +========= + +We provide along with KMess some Oxygen icons which are usually bundled with Kopete. +They are released under LGPL 3.0 (see http://www.oxygen-icons.org/). +See COPYING_ICONS for full license text. + +The remainder of KMess is released under the GPL2+ . See COPYING for full license text. + + + More Information ================ diff --git a/cmake/get-git-version.sh b/cmake/get-git-version.sh index f9d7eff..b84b6fc 100755 --- a/cmake/get-git-version.sh +++ b/cmake/get-git-version.sh @@ -7,19 +7,30 @@ appver="`egrep 'SET.*KMESS_VERSION' CMakeLists.txt | sed -e 's/.*"\([^"]*\)".*/\ date="`date +%Y%m%d`" # Make sure we have the right repository -if [ ! -f kmess.kdevelop ]; then +if [ ! -f kmess.kdev4 ]; then /bin/echo -n "git (unknown)" exit fi -# display app version if git isn't installed. -if [ ! -x `which git` ]; then +# Display normal version if git is not installed +if [ ! -x `which git 2>/dev/null` ]; then /bin/echo -n "$appver" exit fi # Display subversion version if this is a working copy -gitver=`git rev-parse HEAD` +gitname=`LANG=C git describe --all HEAD 2>/dev/null | sed -e 's:^heads/::g'` +gitver=`LANG=C git rev-parse --short HEAD 2>/dev/null` -# display last 8 digits of HEAD SHA-1 + date -/bin/echo -n "$appver-git (${gitver:0:8} >= $date)" +# see if this is not a repository. +if [ -z "$gitver" ]; then + if [ -z "$KMESS_VER" ]; then + /bin/echo -n "$appver"; + else + /bin/echo -n "$KMESS_VER"; + fi + exit; +fi + +# display subversion version and date +/bin/echo -n "$appver-git ($gitname@$gitver >= $date)" diff --git a/configure b/configure index 275ceb9..52f4049 100755 --- a/configure +++ b/configure @@ -54,7 +54,7 @@ DEBUG=0 # Globals cd `dirname $0` SRC_DIR="$PWD" -KMESS_VER="`./cmake/get-git-version.sh`" +KMESS_VER="`./cmake/get-svn-version.sh`" diff --git a/data/chatstyles/Classic-compact/CMakeLists.txt b/data/chatstyles/Classic-compact/CMakeLists.txt index 2d65616..7a674cc 100644 --- a/data/chatstyles/Classic-compact/CMakeLists.txt +++ b/data/chatstyles/Classic-compact/CMakeLists.txt @@ -4,5 +4,11 @@ include_directories( ${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ) ########### install files ############### -install( FILES Classic-compact.xsl Classic-compact.css DESTINATION ${DATA_INSTALL_DIR}/kmess/styles/Classic-compact/ ) +install( + FILES + Classic-compact.xsl + Classic-compact.css + DESTINATION + ${DATA_INSTALL_DIR}/kmess/styles/Classic-compact/ + ) diff --git a/data/chatstyles/Classic-compact/Classic-compact.css b/data/chatstyles/Classic-compact/Classic-compact.css index 9a08132..acdad74 100644 --- a/data/chatstyles/Classic-compact/Classic-compact.css +++ b/data/chatstyles/Classic-compact/Classic-compact.css @@ -67,6 +67,19 @@ div.conversation } +/* + * Style overrides for chat history messages + */ +.history { + margin-bottom: 3em; +} +.history * { + color: #444; + background-color: transparent; + border: 0; +} + + /** * Remaining markup is done inline in the .xsl file. diff --git a/data/chatstyles/Classic-compact/Classic-compact.xsl b/data/chatstyles/Classic-compact/Classic-compact.xsl index 850eea7..89e7bdd 100644 --- a/data/chatstyles/Classic-compact/Classic-compact.xsl +++ b/data/chatstyles/Classic-compact/Classic-compact.xsl @@ -27,6 +27,36 @@ omit-xml-declaration="yes" encoding="utf-8" /> + + + +
+ +
+
+ + + + +
+
+
+ Conversation time: +
+
+ +   + +
+
+
+
+ + + +
+ +
+
+ + + + + +
+
+
+ Conversation time: +
+
+ +   + +
+
+
+
+ + +
+ +
+
+ + @@ -68,6 +78,24 @@ + + +
+
+
+ Conversation time: +
+
+ +   + +
+
+
+
+ + +
+ +
+
+ + @@ -68,6 +78,24 @@ + + +
+
+
+ Conversation time: +
+
+ +   + +
+
+
+
+ diff --git a/data/chatstyles/Efficient/CMakeLists.txt b/data/chatstyles/Efficient/CMakeLists.txt index 6959469..e434a69 100644 --- a/data/chatstyles/Efficient/CMakeLists.txt +++ b/data/chatstyles/Efficient/CMakeLists.txt @@ -4,5 +4,11 @@ include_directories( ${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ) ########### install files ############### -install( FILES Efficient.xsl Efficient.css DESTINATION ${DATA_INSTALL_DIR}/kmess/styles/Efficient/ ) +install( + FILES + Efficient.xsl + Efficient.css + DESTINATION + ${DATA_INSTALL_DIR}/kmess/styles/Efficient/ + ) diff --git a/data/chatstyles/Efficient/Efficient.css b/data/chatstyles/Efficient/Efficient.css index 9241d46..148c370 100644 --- a/data/chatstyles/Efficient/Efficient.css +++ b/data/chatstyles/Efficient/Efficient.css @@ -271,3 +271,19 @@ div.conversation font-size: larger; color: purple; } + + + +/* + * Style overrides for chat history messages + */ +.history { + margin-bottom: 3em; +} +.history * { + color: #444; + background-color: transparent; + border: 0; +} + + diff --git a/data/chatstyles/Efficient/Efficient.xsl b/data/chatstyles/Efficient/Efficient.xsl index ae32030..fe158b3 100644 --- a/data/chatstyles/Efficient/Efficient.xsl +++ b/data/chatstyles/Efficient/Efficient.xsl @@ -38,6 +38,16 @@ + + +
+ +
+
+ + @@ -68,6 +78,24 @@ + + +
+
+
+ Conversation time: +
+
+ +   + +
+
+
+
+ diff --git a/data/chatstyles/Fresh-dark/CMakeLists.txt b/data/chatstyles/Fresh-dark/CMakeLists.txt index f31fd80..6ef00bb 100644 --- a/data/chatstyles/Fresh-dark/CMakeLists.txt +++ b/data/chatstyles/Fresh-dark/CMakeLists.txt @@ -4,5 +4,17 @@ include_directories( ${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ) ########### install files ############### -install( FILES Fresh-dark.xsl Fresh-dark.css bg_gravatar.gif bg_gravatar_rtl.gif buddy_icon.png DESTINATION ${DATA_INSTALL_DIR}/kmess/styles/Fresh-dark/ ) + +install( + FILES + Fresh-dark.xsl + Fresh-dark.css + bg_gravatar.gif + bg_gravatar_rtl.gif + bg_gravatar_gray.gif + bg_gravatar_gray_rtl.gif + buddy_icon.png + DESTINATION + ${DATA_INSTALL_DIR}/kmess/styles/Fresh-dark/ + ) diff --git a/data/chatstyles/Fresh-dark/Fresh-dark.css b/data/chatstyles/Fresh-dark/Fresh-dark.css index 7631207..56f4a40 100644 --- a/data/chatstyles/Fresh-dark/Fresh-dark.css +++ b/data/chatstyles/Fresh-dark/Fresh-dark.css @@ -300,3 +300,28 @@ div.conversation font-size: larger; color: #bb0; } + + + +/* + * Style overrides for chat history messages + */ +.history { + margin-bottom: 3em; +} +.history * { + color: #444; + background-color: transparent; + border: 0; +} + +.history .avatar +{ + background-image: url("bg_gravatar_gray.gif"); +} + +.history .rtl .avatar +{ + background-image: url("bg_gravatar_gray_rtl.gif"); +} + diff --git a/data/chatstyles/Fresh-dark/Fresh-dark.xsl b/data/chatstyles/Fresh-dark/Fresh-dark.xsl index 1e501fc..50a7394 100644 --- a/data/chatstyles/Fresh-dark/Fresh-dark.xsl +++ b/data/chatstyles/Fresh-dark/Fresh-dark.xsl @@ -39,6 +39,16 @@ + + +
+ +
+
+ + @@ -69,6 +79,24 @@ + + +
+
+
+ Conversation time: +
+
+ +   + +
+
+
+
+ diff --git a/data/chatstyles/Fresh-dark/bg_gravatar_gray.gif b/data/chatstyles/Fresh-dark/bg_gravatar_gray.gif new file mode 100644 index 0000000..589b927 Binary files /dev/null and b/data/chatstyles/Fresh-dark/bg_gravatar_gray.gif differ diff --git a/data/chatstyles/Fresh-dark/bg_gravatar_gray_rtl.gif b/data/chatstyles/Fresh-dark/bg_gravatar_gray_rtl.gif new file mode 100644 index 0000000..a51468f Binary files /dev/null and b/data/chatstyles/Fresh-dark/bg_gravatar_gray_rtl.gif differ diff --git a/data/chatstyles/Fresh/.swp.Fresh.css b/data/chatstyles/Fresh/.swp.Fresh.css new file mode 100644 index 0000000..fadab8e Binary files /dev/null and b/data/chatstyles/Fresh/.swp.Fresh.css differ diff --git a/data/chatstyles/Fresh/CMakeLists.txt b/data/chatstyles/Fresh/CMakeLists.txt index 8957b50..536545f 100644 --- a/data/chatstyles/Fresh/CMakeLists.txt +++ b/data/chatstyles/Fresh/CMakeLists.txt @@ -4,5 +4,16 @@ include_directories( ${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ) ########### install files ############### -install( FILES Fresh.xsl Fresh.css bg_gravatar.gif bg_gravatar_rtl.gif buddy_icon.png DESTINATION ${DATA_INSTALL_DIR}/kmess/styles/Fresh/ ) +install( + FILES + Fresh.xsl + Fresh.css + bg_gravatar.gif + bg_gravatar_rtl.gif + bg_gravatar_gray.gif + bg_gravatar_gray_rtl.gif + buddy_icon.png + DESTINATION + ${DATA_INSTALL_DIR}/kmess/styles/Fresh/ + ) diff --git a/data/chatstyles/Fresh/Fresh.css b/data/chatstyles/Fresh/Fresh.css index 026391c..c30d21e 100644 --- a/data/chatstyles/Fresh/Fresh.css +++ b/data/chatstyles/Fresh/Fresh.css @@ -52,7 +52,6 @@ dl, dt, dd position: relative; } - /* * general message layout and colors. */ @@ -300,3 +299,27 @@ div.conversation color: purple; text-align: center; } + + +/* + * Style overrides for chat history messages + */ +.history { + margin-bottom: 3em; +} +.history * { + color: #444; + background-color: transparent; + border: 0; +} + +.history .avatar +{ + background-image: url("bg_gravatar_gray.gif"); +} + +.history .rtl .avatar +{ + background-image: url("bg_gravatar_gray_rtl.gif"); +} + diff --git a/data/chatstyles/Fresh/Fresh.xsl b/data/chatstyles/Fresh/Fresh.xsl index 9f8c25f..dec9563 100644 --- a/data/chatstyles/Fresh/Fresh.xsl +++ b/data/chatstyles/Fresh/Fresh.xsl @@ -38,6 +38,16 @@ + + +
+ +
+
+ + @@ -68,6 +78,24 @@ + + +
+
+
+ Conversation time: +
+
+ +   + +
+
+
+
+ diff --git a/data/chatstyles/Fresh/bg_gravatar_gray.gif b/data/chatstyles/Fresh/bg_gravatar_gray.gif new file mode 100644 index 0000000..8a8b856 Binary files /dev/null and b/data/chatstyles/Fresh/bg_gravatar_gray.gif differ diff --git a/data/chatstyles/Fresh/bg_gravatar_gray_rtl.gif b/data/chatstyles/Fresh/bg_gravatar_gray_rtl.gif new file mode 100644 index 0000000..e8f82e3 Binary files /dev/null and b/data/chatstyles/Fresh/bg_gravatar_gray_rtl.gif differ diff --git a/data/chatstyles/Pure/CMakeLists.txt b/data/chatstyles/Pure/CMakeLists.txt index f57995d..31b34da 100644 --- a/data/chatstyles/Pure/CMakeLists.txt +++ b/data/chatstyles/Pure/CMakeLists.txt @@ -4,21 +4,22 @@ include_directories( ${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ) ########### install files ############### -set(kmess_pure_FILES - Pure.css - Pure.xsl - arrow0.png - arrow1.png - clock.png - contact.png - corner-bl.png - corner-br.png - corner-tl.png - corner-tr.png - important.png - myself.png - system.png -) - -install( FILES ${kmess_pure_FILES} DESTINATION ${DATA_INSTALL_DIR}/kmess/styles/Pure/ ) +install( + FILES + Pure.css + Pure.xsl + arrow0.png + arrow1.png + clock.png + contact.png + corner-bl.png + corner-br.png + corner-tl.png + corner-tr.png + important.png + myself.png + system.png + DESTINATION + ${DATA_INSTALL_DIR}/kmess/styles/Pure/ + ) diff --git a/data/chatstyles/Pure/Pure.css b/data/chatstyles/Pure/Pure.css index b04686a..c19241f 100644 --- a/data/chatstyles/Pure/Pure.css +++ b/data/chatstyles/Pure/Pure.css @@ -338,3 +338,19 @@ div.conversation font-size: larger; color: purple; } + + + +/* + * Style overrides for chat history messages + */ +.history { + margin-bottom: 3em; +} +.history * { + color: #444; + background-color: transparent; + border: 0; +} + + diff --git a/data/chatstyles/Pure/Pure.xsl b/data/chatstyles/Pure/Pure.xsl index 15dcfa3..8f51b4f 100644 --- a/data/chatstyles/Pure/Pure.xsl +++ b/data/chatstyles/Pure/Pure.xsl @@ -38,6 +38,16 @@ + + +
+ +
+
+ + @@ -68,6 +78,24 @@ + + +
+
+
+ Conversation time: +
+
+ +   + +
+
+
+
+ \n" + "\n" ); + const QByteArray footer( "\n" ); + + logFile_.write( header + footer ); + pointer_ = header.length(); + logFile_.seek( pointer_ ); + } + else + { + // Find the last conversation closing tag of the file, we'll append content from there + qint64 searchStartPoint = qMax( currentFileSize - END_SEEKING_BUFFER_SIZE, (qint64)0L ); + logFile_.seek( searchStartPoint ); + qint64 tagPosition = logFile_.read( END_SEEKING_BUFFER_SIZE ).lastIndexOf( CLOSING_TAG ); + + if( tagPosition < 0 ) + { +#ifdef KMESSDEBUG_CHATHISTORYWRITER + kmDebug() << "Unable to open existing log file:" << logFile_.fileName() << "- unrecognized file format!"; +#endif + logFile_.close(); + return; + } + + pointer_ = ( searchStartPoint + tagPosition + CLOSING_TAG_SIZE ); + logFile_.seek( pointer_ ); + } + + // Ready to log now! +} + + + +// Destructor +ChatHistoryWriter::~ChatHistoryWriter() +{ + delete conversation_; + delete messageStyle_; + + // Delete the log file if it was created just for this chat, and + // no messages were appended to it + if( logFile_.isOpen() && isNewLogFile_ && isFirstMessage_ ) + { + logFile_.remove(); + } + + logFile_.close(); + +#ifdef KMESSDEBUG_CHATHISTORYWRITER + kmDebug() << "Log file closed."; +#endif +} + + + +// Return whether the writer is capable of writing new messages +bool ChatHistoryWriter::isReady() const +{ + return logFile_.isOpen(); +} + + + +// Write a message to file +void ChatHistoryWriter::logMessage( const ChatMessage& message ) +{ + if( ! isReady() ) + { +#ifdef KMESSDEBUG_CHATHISTORYWRITER + kmDebug() << "Unable to write the log message:" << message.getBody(); +#endif + return; + } + + // Start the conversation if needed + if( isFirstMessage_ ) + { + // Don't log initial presence in messenger + if( message.getType() == ChatMessage::TYPE_PRESENCE ) + { + return; + } + + // Add the new chat to the logs +// ChatHistoryManager:: //no non qui, ogni msg ricevuto bisogna chiamare il manager x l'update della conv in corso + +#ifdef KMESSDEBUG_CHATHISTORYWRITER + kmDebug() << "Adding conversation tag.."; +#endif + + quint64 timestamp = message.getDateTime().toTime_t(); + isFirstMessage_ = false; + const QByteArray conversationHeader( "\n\n\n" ); + logFile_.write( conversationHeader ); + pointer_ += conversationHeader.length(); + logFile_.flush(); + + conversation_->filePath = logFile_.fileName(); + conversation_->timestamp = timestamp; + conversation_->startPosition = logFile_.pos(); + conversation_->endPosition = logFile_.size(); + } + +#ifdef KMESSDEBUG_CHATHISTORYWRITER + kmDebug() << "Adding a message to chat:" << message.getBody(); +#endif + + if( ! messageCache_.isEmpty() ) + { +#ifdef KMESSDEBUG_CHATHISTORYWRITER + kmDebug() << "Cache not empty, checking message grouping"; +#endif + + const ChatMessage& lastCached = messageCache_.last(); + + // Verify if the new message can be grouped with the older ones in cache + const QDateTime newMessageDate ( message.getDateTime() ); + const QDateTime lastMessageDate( lastCached.getDateTime() ); + + // It's not groupable, write the new one alone (the cache is already on disk) + if( ! message.isNormalMessage() + || message.getContactHandle() != lastCached.getContactHandle() + || message.getType() != lastCached.getType() + || ! lastMessageDate.isValid() || lastMessageDate.secsTo( newMessageDate ) > 600 ) + { +#ifdef KMESSDEBUG_CHATHISTORYWRITER + kmDebug() << "Message was not groupable, clearing cache first"; +#endif + + pointer_ = logFile_.pos(); + messageCache_.clear(); + } + } + + + if( lastMessage_ + && lastMessage_->getType() == ChatMessage::TYPE_PRESENCE + && lastMessage_->getType() == message.getType() + && lastMessage_->getContentsClass() == message.getContentsClass() + && lastMessage_->getContactHandle() == message.getContactHandle() ) + { +#ifdef KMESSDEBUG_CHATHISTORYWRITER + kmDebug() << "Not adding presence message for the same contact again."; +#endif + return; + } + + // Add the message and write the entire cache on file again + delete lastMessage_; + lastMessage_ = new ChatMessage( message ); + messageCache_.append( message ); + writeCache(); + + // Signal the chat history manager the new chat message + ChatHistoryManager::updateChatLog( handle_, *conversation_ ); +} + + + +// Write the cache contents to the file +void ChatHistoryWriter::writeCache() +{ + if( ! isReady() ) + { +#ifdef KMESSDEBUG_CHATHISTORYWRITER + kmDebug() << "Unable to write the message cache"; +#endif + return; + } + + // Nothing to do + if( messageCache_.isEmpty() ) + { + return; + } + + logFile_.seek( pointer_ ); + + // Write one message + if( messageCache_.count() == 1 ) + { + logFile_.write( messageStyle_->convertMessageToXml( messageCache_.first() ).toUtf8() ); + } + // Write a message group + else + { + QByteArray xml( "\n" ); + + foreach( const ChatMessage& message, messageCache_ ) + { + xml += messageStyle_->convertMessageToXml( message ).toUtf8(); + } + + xml += "\n"; + + logFile_.write( xml ); + logFile_.flush(); + } + + // Save the point in the log file where the conversation ends + conversation_->endPosition = logFile_.pos(); + + const QByteArray conversationFooter( "\n" + "\n" ); + + logFile_.write( conversationFooter ); + + // Following writes of new messageGroups will begin just after the closing messageGroup tag + logFile_.seek( logFile_.pos() - conversationFooter.length() ); + + logFile_.flush(); +} + + diff --git a/src/chat/chathistorywriter.h b/src/chat/chathistorywriter.h new file mode 100644 index 0000000..d4ed885 --- /dev/null +++ b/src/chat/chathistorywriter.h @@ -0,0 +1,128 @@ +/*************************************************************************** + chathistorywriter.h - chat logs writer + ------------------- + begin : Tue Jul 13 2010 + copyright : (C) 2010 by Valerio Pilo + email : valerio@kmess.org + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 CHATHISTORYWRITER_H +#define CHATHISTORYWRITER_H + +#include +#include + + +/** + * Maximum log file size, 4MB. + */ +const long MAX_LOG_FILE_SIZE = 4L * 1024L * 1024L; + + +// Forward declarations +class ChatMessage; +class ChatMessageStyle; +class Conversation; + + + +/** + * Class to incrementally save a chat log in XML format to file. + * + * Every time a message arrives or is sent, it is parsed into XML and stored here. + * + * low level description: + * As soon as a chat is opened, the xml log saving system choses a file name where + * to store the log. + * A quint64 pointer keeps track of the position in the file where to add new data. + * When writing anything to the file, if the pointer is 0 a file header gets added; + * then, if it is the first write of the chat, a first conversation tag is added with + * the time of the first message and the pointer is set to the end of that data; then + * the new data is written; finally, the XML conversation and messsageRoot closing tags + * are also added. To ensure integrity, the file is flushed on every write. + * + * medium level description: + * When someone sends a message, we store its XML into a cache, and also flush it into + * the file, writing from the file pointer position. + * When another message needs to be stored, we store its XML too into a cache, then flush + * to the logfile a messagegroup tags pair, containing all previously stored XML messages, + * and finally we check if it's applicable for message grouping: + * - if it is, do nothing (we'll continue stacking up messages for the group) + * - If it is not, empty the cache and set the pointer to the end of the written + * messageGroup tags. We'll start with a new message or group. + * As soon as the chat is closed, the file is already filled up and we can just close it. + * + * high level description: + * a class (keeping the logging state) is instantiated. a startLogging( handle ) method is + * called as soon as the chat is opened. + * When a message arrives, a logMessage( ChatMessage* ) method is called. + * When the chat is closed, an endLogging() method is called. + * + * @author Valerio Pilo + */ +class ChatHistoryWriter : public QObject +{ + Q_OBJECT + + friend class ChatHistoryManager; + + + private: // Private constructor + + // Constructor + ChatHistoryWriter( const QString& account, const QString& handle ); + + + public: // Public destructor + + // Destructor + virtual ~ChatHistoryWriter(); + + + public: // Public methods + + // Return whether the writer is capable of writing new messages + bool isReady() const; + // Write a message to file + void logMessage( const ChatMessage& message ); + + + private: // Private methods + + // Write the cache contents to the file + void writeCache(); + + + private: // Private properties + + // Conversation data, used for chat history manager data caching + Conversation* conversation_; + // Handle of the initial contact of the chat being logged + QString handle_; + // Whether at least one message was written to the file + bool isFirstMessage_; + // Whether the log file was created just for the chat being logged + bool isNewLogFile_; + // The last received message, to avoid storing duplicates (not using the cache since it gets cleared often) + ChatMessage* lastMessage_; + // Log file where to save the chat + QFile logFile_; + // List of messages currently being processed + QList messageCache_; + // The chat style converter, used to turn chat messages into XML + ChatMessageStyle* messageStyle_; + // Last appending position within the file + qint64 pointer_; + +}; + +#endif // CHATHISTORYWRITER_H diff --git a/src/chat/chatmaster.cpp b/src/chat/chatmaster.cpp index c4323d5..aa789e5 100644 --- a/src/chat/chatmaster.cpp +++ b/src/chat/chatmaster.cpp @@ -69,7 +69,7 @@ ChatMaster::~ChatMaster() disconnected(); // Delete all open windows - kDebug() << chatWindows_; + kmDebug() << chatWindows_; qDeleteAll( chatWindows_ ); chatWindows_.clear(); @@ -78,7 +78,7 @@ ChatMaster::~ChatMaster() pendingMimeMessages_.clear(); #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -94,7 +94,7 @@ void ChatMaster::connected() } #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Trying reactivation of" << chats_.count() << "open chats."; + kmDebug() << "Trying reactivation of" << chats_.count() << "open chats."; #endif QList windowsList; @@ -119,13 +119,13 @@ void ChatMaster::connected() const QStringList participants( chat->getParticipants() ); #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Reactivating chat:" << participants; + kmDebug() << "Reactivating chat:" << participants; #endif // Check if the participants list is empty: if so, there's something fishy going on. if( participants.isEmpty() ) { - kWarning() << "Tried to reactivate chat with no contacts - has a window?" << ( chat->getChatWindow() != 0 ); + kmWarning() << "Tried to reactivate chat with no contacts - has a window?" << ( chat->getChatWindow() != 0 ); chat->getChatWindow()->removeChatTab( chat ); continue; } @@ -134,7 +134,7 @@ void ChatMaster::connected() if( participants.count() > 1 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "This is a group chat, skipping it."; + kmDebug() << "This is a group chat, skipping it."; #endif continue; } @@ -145,14 +145,14 @@ void ChatMaster::connected() if( currentAccount_->getContactByHandle( handle ) == 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "This chat is with a non-listed contact, closing it."; + kmDebug() << "This chat is with a non-listed contact, closing it."; #endif chat->getChatWindow()->removeChatTab( chat ); continue; } #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Reactivating chat with listed contact:" << handle; + kmDebug() << "Reactivating chat with listed contact:" << handle; #endif // Create a new switchboard, setting it as empty but with an hint about @@ -192,7 +192,7 @@ void ChatMaster::disconnected() if( ! chatWindows_.isEmpty() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Disabling" << chatWindows_.count() << "open chat windows."; + kmDebug() << "Disabling" << chatWindows_.count() << "open chat windows."; #endif // Go through all the chats @@ -207,7 +207,7 @@ void ChatMaster::disconnected() if( ! switchboardConnections_.isEmpty() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Closing" << switchboardConnections_.count() << "open switchboards."; + kmDebug() << "Closing" << switchboardConnections_.count() << "open switchboards."; #endif // give each switchboard a chance to close properly. @@ -220,7 +220,7 @@ void ChatMaster::disconnected() if( ! chats_.isEmpty() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Closing" << chats_.count() << "open chats."; + kmDebug() << "Closing" << chats_.count() << "open chats."; #endif // Go through all the chats and disable them @@ -247,7 +247,7 @@ void ChatMaster::connecting() } #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Disabling reconnect button of" << chats_.count() << "open chats."; + kmDebug() << "Disabling reconnect button of" << chats_.count() << "open chats."; #endif QList windowsList; @@ -274,7 +274,7 @@ void ChatMaster::connecting() void ChatMaster::forwardRequestNewSwitchboard( QString handle ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Forwarding the new switchboard request signal for " + kmDebug() << "Forwarding the new switchboard request signal for " << handle << "." << endl; #endif @@ -324,7 +324,7 @@ ApplicationList * ChatMaster::getApplicationList(const QString &handle) if( handle == currentAccount_->getHandle() ) { - kWarning() << "Cannot start applications with yourself."; + kmWarning() << "Cannot start applications with yourself."; return 0; } @@ -337,7 +337,7 @@ ApplicationList * ChatMaster::getApplicationList(const QString &handle) { // Create object if it wasn't created yet for this contact. #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Creating application list for contact " << handle; + kmDebug() << "Creating application list for contact " << handle; #endif appList = contact->createApplicationList(); @@ -481,7 +481,7 @@ bool ChatMaster::initialize() { if ( initialized_ ) { - kDebug() << "Already initialized."; + kmDebug() << "Already initialized."; return false; } @@ -527,7 +527,7 @@ void ChatMaster::requestChat( QString handle ) // Forbid chatting with yourself if( handle == currentAccount_->getHandle() ) { - kWarning() << "Cannot chat with yourself."; + kmWarning() << "Cannot chat with yourself."; return; } @@ -554,7 +554,7 @@ void ChatMaster::requestChat( QString handle ) connectionType = ChatInformation::CONNECTION_OFFLINE; #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Starting an offline chat with " << handle; + kmDebug() << "Starting an offline chat with " << handle; #endif } else @@ -563,7 +563,7 @@ void ChatMaster::requestChat( QString handle ) connectionType = ChatInformation::CONNECTION_CHAT; #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Requesting a switchboard to chat with " << handle; + kmDebug() << "Requesting a switchboard to chat with " << handle; #endif } @@ -588,7 +588,7 @@ void ChatMaster::requestChat( QString handle ) void ChatMaster::slotChatClosing( Chat *chat ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Marking chat as closing."; + kmDebug() << "Marking chat as closing."; #endif // Make sure this chat window don't receive new messages. @@ -608,7 +608,7 @@ void ChatMaster::slotChatClosing( Chat *chat ) void ChatMaster::slotChatDestroyed( QObject *chatObject ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Removing chat from list."; + kmDebug() << "Removing chat from list."; #endif // Remove from the list @@ -623,7 +623,7 @@ void ChatMaster::slotChatDestroyed( QObject *chatObject ) void ChatMaster::slotChatWindowDestroyed(QObject *chatWindow) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Removing chat window from list."; + kmDebug() << "Removing chat window from list."; #endif // Remove from the list @@ -638,7 +638,7 @@ void ChatMaster::slotChatWindowDestroyed(QObject *chatWindow) void ChatMaster::slotConnectApplication(Application *application) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Connecting application signals."; + kmDebug() << "Connecting application signals."; #endif connect( application, SIGNAL( applicationMessage(const ChatMessage&) ), @@ -652,7 +652,7 @@ void ChatMaster::slotConnectApplication(Application *application) if( qobject_cast( application ) != 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Connecting additional signals for InkTransferP2P."; + kmDebug() << "Connecting additional signals for InkTransferP2P."; #endif connect( application, SIGNAL( inkReceived(const QString&,const QString&,InkFormat) ), @@ -660,7 +660,7 @@ void ChatMaster::slotConnectApplication(Application *application) } else { - kWarning() << "Unknown datacast application: " << application->metaObject()->className(); + kmWarning() << "Unknown datacast application: " << application->metaObject()->className(); } } } @@ -671,7 +671,7 @@ void ChatMaster::slotConnectApplication(Application *application) void ChatMaster::queueMessage( const MimeMessage &message, const QString &handle, bool privateChatRequired ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Adding message for '" << handle << "' to the queue " + kmDebug() << "Adding message for '" << handle << "' to the queue " << "(size=" << ( pendingMimeMessages_.count() + 1 ) << ")." << endl; #endif // NOTE: Store these pending in ApplicationList class instead? @@ -696,7 +696,7 @@ void ChatMaster::raiseChat( Chat *chat, bool force ) if( chat == 0 || ! chats_.contains( chat ) ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Invalid raising request received; chat is probably already closed."; + kmDebug() << "Invalid raising request received; chat is probably already closed."; #endif return; } @@ -705,7 +705,7 @@ void ChatMaster::raiseChat( Chat *chat, bool force ) if( chatWindow == 0 || ! chatWindows_.contains( chatWindow ) ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Invalid raising request received; chat is probably already closed."; + kmDebug() << "Invalid raising request received; chat is probably already closed."; #endif return; } @@ -713,7 +713,7 @@ void ChatMaster::raiseChat( Chat *chat, bool force ) if( chatWindow->isVisible() && ! force ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Window has focus already."; + kmDebug() << "Window has focus already."; #endif return; } @@ -730,7 +730,7 @@ void ChatMaster::raiseChat( Chat *chat, bool force ) if( ! force ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Showing minimized window."; + kmDebug() << "Showing minimized window."; #endif // Required for new chats chatWindow->showMinimized(); @@ -743,21 +743,21 @@ void ChatMaster::raiseChat( Chat *chat, bool force ) // Notify about the new window and force it to show and receive focus. Only use upon user request. #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Forcing window raise."; + kmDebug() << "Forcing window raise."; #endif // Show the chat's window if( chatWindow->isMinimized() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Window was minimized, showing it."; + kmDebug() << "Window was minimized, showing it."; #endif chatWindow->showNormal(); } else { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Window was not minimized, showing it again."; + kmDebug() << "Window was not minimized, showing it again."; #endif chatWindow->show(); } @@ -789,7 +789,7 @@ void ChatMaster::raiseChat( Chat *chat, bool force ) void ChatMaster::sendPendingMimeMessages( const QString &handle, MsnSwitchboardConnection *connection ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Sending pending messages for contact " << handle << ", if any."; + kmDebug() << "Sending pending messages for contact " << handle << ", if any."; #endif QList sentMessages; @@ -809,7 +809,7 @@ void ChatMaster::sendPendingMimeMessages( const QString &handle, MsnSwitchboardC if( pendingMimeMessage->privateChatRequired && ! isPrivateChat ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Switchboard is not a private chat, keeping message in queue."; + kmDebug() << "Switchboard is not a private chat, keeping message in queue."; #endif // Get next message @@ -820,7 +820,7 @@ void ChatMaster::sendPendingMimeMessages( const QString &handle, MsnSwitchboardC if( connection->isBusy() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Switchboard is busy again, keeping remaining messages in the queue."; + kmDebug() << "Switchboard is busy again, keeping remaining messages in the queue."; #endif goto cleanup_return; } @@ -830,7 +830,7 @@ void ChatMaster::sendPendingMimeMessages( const QString &handle, MsnSwitchboardC { // getContactsInChat() may be empty, don't re-invite the last contact to deviver the message #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Switchboard is not connected or contact left chat, keeping remaining messages in the queue."; + kmDebug() << "Switchboard is not connected or contact left chat, keeping remaining messages in the queue."; #endif goto cleanup_return; } @@ -856,13 +856,13 @@ cleanup_return: void ChatMaster::showSpecialMessage( const ChatMessage &message, const MsnSwitchboardConnection *switchboardChat ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Delivering application/ink/OIM chat message to chat window."; + kmDebug() << "Delivering application/ink/OIM chat message to chat window."; #endif const QString &handle = message.getContactHandle(); #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Message info, Contact: " << handle << " - Message body: '" << message.getBody() << "' - " + kmDebug() << "Message info, Contact: " << handle << " - Message body: '" << message.getBody() << "' - " "Message type: " << message.getType() << " - Message class: " << message.getContentsClass() << "." << endl; #endif @@ -880,7 +880,7 @@ void ChatMaster::showSpecialMessage( const ChatMessage &message, const MsnSwitch if( chat != 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Delivering message."; + kmDebug() << "Delivering message."; #endif // The chat window is currently closing @@ -890,12 +890,12 @@ void ChatMaster::showSpecialMessage( const ChatMessage &message, const MsnSwitch { // TODO: Sometimes, you close a window when the other contact sends a new message, and you lose it. // Maybe it's possible to avoid the loss, for example with a notification balloon to notify of the message. - kWarning() << "Chat window is closing, suppressing message '" << message.getBody() << "' from '" << handle << "'."; + kmWarning() << "Chat window is closing, suppressing message '" << message.getBody() << "' from '" << handle << "'."; } #ifdef KMESSDEBUG_CHATMASTER else { - kDebug() << "Chat window is closing, suppressing message."; + kmDebug() << "Chat window is closing, suppressing message."; } #endif @@ -916,13 +916,13 @@ void ChatMaster::showSpecialMessage( const ChatMessage &message, const MsnSwitch case ChatMessage::CONTENT_NOTIFICATION_WINK: case ChatMessage::CONTENT_APP_INVITE: #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Message is important, delivering it."; + kmDebug() << "Message is important, delivering it."; #endif break; default: #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Message is not important, will be ignored."; + kmDebug() << "Message is not important, will be ignored."; #endif return; } @@ -938,7 +938,7 @@ void ChatMaster::showSpecialMessage( const ChatMessage &message, const MsnSwitch if( switchboard == 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Could not create an offline switchboard."; + kmDebug() << "Could not create an offline switchboard."; #endif return; } @@ -949,7 +949,7 @@ void ChatMaster::showSpecialMessage( const ChatMessage &message, const MsnSwitch if( chat == 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Could not create a chat window."; + kmDebug() << "Could not create a chat window."; #endif return; } @@ -1013,7 +1013,7 @@ void ChatMaster::showMsnObject( const QString &handle, const MsnObject &msnObjec // handle background transfers default: - kWarning() << "Unable to handle MsnObject pictures of type '" << msnObject.getType() << "'."; + kmWarning() << "Unable to handle MsnObject pictures of type '" << msnObject.getType() << "'."; } } @@ -1041,7 +1041,7 @@ void ChatMaster::slotContactChangedMsnObject( Contact *contact ) { contact->getExtension()->setContactPicturePath( currentAccount_->getPicturePath() ); #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Updated user's own display picture"; + kmDebug() << "Updated user's own display picture"; #endif return; } @@ -1052,7 +1052,7 @@ void ChatMaster::slotContactChangedMsnObject( Contact *contact ) if( contact->getMsnObject() == 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Contact '" << handle << "' removed its MSN object"; + kmDebug() << "Contact '" << handle << "' removed its MSN object"; #endif contact->getExtension()->setContactPicturePath( QString::null ); @@ -1069,7 +1069,7 @@ void ChatMaster::slotContactChangedMsnObject( Contact *contact ) if( ! imageInvalid && msnObject.verifyFile( objectFileName ) ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Picture for '" << handle << "' is already downloaded."; + kmDebug() << "Picture for '" << handle << "' is already downloaded."; #endif contact->getExtension()->setContactPicturePath( objectFileName ); @@ -1078,7 +1078,7 @@ void ChatMaster::slotContactChangedMsnObject( Contact *contact ) else { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Picture for '" << handle + kmDebug() << "Picture for '" << handle << "' is already downloaded, but corrupt " << ( imageInvalid ? "(detected by QImageReader)" : "(detected by MsnObject)" ) << ", deleting it: '" << objectFileName << "'" << endl; @@ -1089,7 +1089,7 @@ void ChatMaster::slotContactChangedMsnObject( Contact *contact ) if( contact->getExtension()->getContactPicturePath() == objectFileName ) { #ifdef KMESSDEBUG_CHATMASTER - kWarning() << "Corrupt picture was already set, " + kmWarning() << "Corrupt picture was already set, " << "resetting contact picture." << endl; #endif contact->getExtension()->setContactPicturePath( QString::null ); @@ -1103,7 +1103,7 @@ void ChatMaster::slotContactChangedMsnObject( Contact *contact ) if( switchboard != 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Contact '" << handle << "' changed its MSN object."; + kmDebug() << "Contact '" << handle << "' changed its MSN object."; #endif // Automatically decides which switchboard is the best to use, @@ -1118,7 +1118,7 @@ void ChatMaster::slotContactChangedMsnObject( Contact *contact ) // since that may change between this point and the timedUpdate() call. #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Contact '" << handle << "' changed its MSN object, queueing a request for it."; + kmDebug() << "Contact '" << handle << "' changed its MSN object, queueing a request for it."; #endif // Request the contact's msnobject @@ -1147,13 +1147,13 @@ void ChatMaster::slotContactJoinedChat( ContactBase *contact ) { // Contact joined chat conversation with multiple partipipants, ignore this. #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Contact '" << handle << "' joined multi-chat, not sending pending messages."; + kmDebug() << "Contact '" << handle << "' joined multi-chat, not sending pending messages."; #endif } else { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Contact '" << handle << "' joined chat, checking for pending messages."; + kmDebug() << "Contact '" << handle << "' joined chat, checking for pending messages."; #endif // Send the messages @@ -1185,7 +1185,7 @@ void ChatMaster::slotContactJoinedChat( ContactBase *contact ) void ChatMaster::slotDeliverAppCommand(QString cookie, QString handle, QString command) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Delivering application command."; + kmDebug() << "Delivering application command."; #endif Application *app = 0; @@ -1203,7 +1203,7 @@ void ChatMaster::slotDeliverAppCommand(QString cookie, QString handle, QString c // App not found. if( app == 0 ) { - kWarning() << "Application not found to deliver user command (contact=" << contact << ", command=" << command << ")."; + kmWarning() << "Application not found to deliver user command (contact=" << contact << ", command=" << command << ")."; return; } @@ -1231,7 +1231,7 @@ void ChatMaster::slotDeliverAppCommand(QString cookie, QString handle, QString c void ChatMaster::slotDeliverMimeMessage(const MimeMessage &message, const QString &handle, bool privateChatRequired) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Delivering application message for '" << handle << "' to switchboard."; + kmDebug() << "Delivering application message for '" << handle << "' to switchboard."; #endif #ifdef KMESSTEST QString contentType( message.getValue("Content-Type") ); @@ -1252,7 +1252,7 @@ void ChatMaster::slotDeliverMimeMessage(const MimeMessage &message, const QStrin { // Connection has unacked messages, keep waiting until the switchboard is ready to send #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Switchboard is currently busy, queueing message until the switchboard is ready to send."; + kmDebug() << "Switchboard is currently busy, queueing message until the switchboard is ready to send."; #endif queueMessage( message, handle, privateChatRequired ); @@ -1272,7 +1272,7 @@ void ChatMaster::slotDeliverMimeMessage(const MimeMessage &message, const QStrin else { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "No switchboard available to deliver message," + kmDebug() << "No switchboard available to deliver message," << " requesting chat and queueing message " << (pendingMimeMessages_.count() + 1) << "." << endl; #endif @@ -1289,8 +1289,8 @@ void ChatMaster::slotGotInkMessage( const QString &ink, const QString &contactHa #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL switch( format ) { - case FORMAT_ISF: kDebug() << "Parsing ISF ink message"; break; - case FORMAT_GIF: kDebug() << "Parsing GIF ink message"; break; + case FORMAT_ISF: kmDebug() << "Parsing ISF ink message"; break; + case FORMAT_GIF: kmDebug() << "Parsing GIF ink message"; break; } #endif @@ -1328,8 +1328,8 @@ void ChatMaster::slotGotInkMessage( const QString &ink, const QString &contactHa QRegExp inkChars( "([^A-Za-z0-9:+/=])" ); if( ! inkData.startsWith( "base64:" ) || inkChars.indexIn( inkData ) != -1 ) { - kWarning() << "Received invalid ink message from" << contactHandle << ", found char 0x" << QString::number( inkChars.cap(1)[0].unicode(), 16 ) << "at position" << inkChars.pos(1); - kWarning() << "Ink data dump:" << inkData; + kmWarning() << "Received invalid ink message from" << contactHandle << ", found char 0x" << QString::number( inkChars.cap(1)[0].unicode(), 16 ) << "at position" << inkChars.pos(1); + kmWarning() << "Ink data dump:" << inkData; showSpecialMessage( ChatMessage( ChatMessage::TYPE_SYSTEM, ChatMessage::CONTENT_SYSTEM_ERROR, @@ -1464,7 +1464,7 @@ void ChatMaster::slotGotMsnObject(const QString &msnObjectData, const QString &h void ChatMaster::slotMsnObjectReceived(const QString &handle, const MsnObject &msnObject) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Received msn object from: " << handle << "."; + kmDebug() << "Received msn object from: " << handle << "."; #endif Chat *chat = 0; @@ -1477,7 +1477,7 @@ void ChatMaster::slotMsnObjectReceived(const QString &handle, const MsnObject &m if( chat != 0 && ! chats_.contains( chat ) ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Original chat not found for received MSNObject " + kmDebug() << "Original chat not found for received MSNObject " << "(objecttype=" << msnObject.getType() << " contact=" << handle << ")." << endl; #endif @@ -1497,7 +1497,7 @@ void ChatMaster::slotSwitchboardReady() if( pendingMimeMessages_.isEmpty() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "A switchboard is ready to send more messages, no messages pending."; + kmDebug() << "A switchboard is ready to send more messages, no messages pending."; #endif return; } @@ -1511,7 +1511,7 @@ void ChatMaster::slotSwitchboardReady() bool isPrivateChat = (contacts.size() < 2); #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "A switchboard is ready to send more messages, " << pendingMimeMessages_.count() << " messages pending."; + kmDebug() << "A switchboard is ready to send more messages, " << pendingMimeMessages_.count() << " messages pending."; #endif // Send all pending messages @@ -1523,7 +1523,7 @@ void ChatMaster::slotSwitchboardReady() if( ! pendingMimeMessages_.isEmpty() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Switchboard is busy again, not notifying applications."; + kmDebug() << "Switchboard is busy again, not notifying applications."; #endif return; } @@ -1597,7 +1597,7 @@ MsnSwitchboardConnection *ChatMaster::startSwitchboard( const ChatInformation &c const QString &handle = chatInfo.getContactHandle(); #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Starting new switchboard session with" << handle; + kmDebug() << "Starting new switchboard session with" << handle; #endif /** @@ -1614,7 +1614,7 @@ MsnSwitchboardConnection *ChatMaster::startSwitchboard( const ChatInformation &c if( chatInfo.getType() == ChatInformation::CONNECTION_REFRESH ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Finding the session to refresh."; + kmDebug() << "Finding the session to refresh."; #endif foreach( MsnSwitchboardConnection *currentSwitchboard, switchboardConnections_ ) { @@ -1622,7 +1622,7 @@ MsnSwitchboardConnection *ChatMaster::startSwitchboard( const ChatInformation &c && currentSwitchboard->isWaiting() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Session found, it will be refreshed."; + kmDebug() << "Session found, it will be refreshed."; #endif switchboard = currentSwitchboard; break; @@ -1631,7 +1631,7 @@ MsnSwitchboardConnection *ChatMaster::startSwitchboard( const ChatInformation &c if( switchboard == 0 ) { - kWarning() << "Unable to find which session requested a refresh."; + kmWarning() << "Unable to find which session requested a refresh."; return 0; } } @@ -1640,7 +1640,7 @@ MsnSwitchboardConnection *ChatMaster::startSwitchboard( const ChatInformation &c switchboard = createSwitchboardConnection(); if( KMESS_NULL(switchboard) ) return 0; #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Creating new session."; + kmDebug() << "Creating new session."; #endif } @@ -1697,7 +1697,7 @@ Chat *ChatMaster::createChat( MsnSwitchboardConnection *switchboard, bool reques if( newChat != 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "A chat with contacts" + kmDebug() << "A chat with contacts" << switchboard->getContactsInChat().join(",") << "already exists, raising it." << endl; #endif @@ -1724,14 +1724,14 @@ Chat *ChatMaster::createChat( MsnSwitchboardConnection *switchboard, bool reques if( newChat == 0 ) { - kDebug() << "Couldn't create a new chat tab."; + kmDebug() << "Couldn't create a new chat tab."; return 0; } // Initialize it if( ! newChat->initialize( switchboard ) ) { - kDebug() << "Couldn't initialize the chat tab."; + kmDebug() << "Couldn't initialize the chat tab."; return 0; } @@ -1742,7 +1742,7 @@ Chat *ChatMaster::createChat( MsnSwitchboardConnection *switchboard, bool reques newChat = newChatWindow->addChatTab( newChat, switchboard->getUserStartedChat() ); if( newChat == 0 ) { - kWarning() << "Couldn't add the initial chat."; + kmWarning() << "Couldn't add the initial chat."; return 0; } @@ -1799,7 +1799,7 @@ ChatWindow *ChatMaster::createChatWindow( Chat *chat ) // Create the new chat window #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "No existing chat window, creating new."; + kmDebug() << "No existing chat window, creating new."; #endif // Create the window: it should have no parent, so it will be displayed in the taskbar for Windows. window = new ChatWindow(); @@ -1807,7 +1807,7 @@ ChatWindow *ChatMaster::createChatWindow( Chat *chat ) // Bail out if the window could not be initialized if( ! window->initialize() ) { - kWarning() << "Couldn't initialize the new chat window!"; + kmWarning() << "Couldn't initialize the new chat window!"; return 0; } @@ -1831,7 +1831,7 @@ MsnSwitchboardConnection *ChatMaster::createSwitchboardConnection( MsnSwitchboar MsnSwitchboardConnection *switchboard; #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Creating a new switchboard connection."; + kmDebug() << "Creating a new switchboard connection."; #endif // Initialize the switchboard connection @@ -1845,7 +1845,7 @@ MsnSwitchboardConnection *ChatMaster::createSwitchboardConnection( MsnSwitchboar } if( ! switchboard || ! switchboard->initialize( handle ) ) { - kWarning() << "Couldn't initialize switchboard connection."; + kmWarning() << "Couldn't initialize switchboard connection."; delete switchboard; return 0; } @@ -1890,7 +1890,7 @@ void ChatMaster::startFileTransfer( const QString &handle, const QString &filena MsnSwitchboardConnection *connection = getContactSwitchboardConnection( handle, true ); if( ! connection || ( contact && contact->isOffline() && connection->isInactive() ) ) { -// kWarning() << "Attempted to start a file transfer with an offline contact!"; +// kmWarning() << "Attempted to start a file transfer with an offline contact!"; return; } @@ -1899,11 +1899,11 @@ void ChatMaster::startFileTransfer( const QString &handle, const QString &filena // This should be so rare that it justifies a warning message. if( contact == 0 ) { - kWarning() << "Contact" << handle << "object not found, using old MIME invitations because P2P might not be supported."; + kmWarning() << "Contact" << handle << "object not found, using old MIME invitations because P2P might not be supported."; } else { - kWarning() << "Contact" << handle << "does not support P2P transfers, using old MIME invitations instead."; + kmWarning() << "Contact" << handle << "does not support P2P transfers, using old MIME invitations instead."; } // The contact only supports file transfer the old way @@ -1913,7 +1913,7 @@ void ChatMaster::startFileTransfer( const QString &handle, const QString &filena } #if CHATMASTER_SEND_FILES_MSNFTP - kWarning() << "Sending files is forced over MSNFTP for debugging, using old MIME invitations."; + kmWarning() << "Sending files is forced over MSNFTP for debugging, using old MIME invitations."; MimeApplication *app = new FileTransfer(handle, filename); startApplication(app); #else @@ -1958,7 +1958,7 @@ void ChatMaster::startMsnObjectDownload( const QString &handle, const MsnObject if( appList->hasMsnObjectTransfer(*msnObject) ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "object is already being downloaded, not sending a second invite."; + kmDebug() << "object is already being downloaded, not sending a second invite."; #endif return; } @@ -1974,7 +1974,7 @@ void ChatMaster::startMsnObjectDownload( const QString &handle, const MsnObject if( imageCorrupt || ! msnObject->verifyFile( objectFileName ) ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Cached MsnObject is corrupt " + kmDebug() << "Cached MsnObject is corrupt " << ( imageCorrupt ? "(detected by QImage)" : "(detected by MsnObject)" ) << ", deleting it: '" << objectFileName << "'" << endl; #endif @@ -1987,7 +1987,7 @@ void ChatMaster::startMsnObjectDownload( const QString &handle, const MsnObject if( fileExists ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Contact MsnObject is already in cache."; + kmDebug() << "Contact MsnObject is already in cache."; #endif // Already have it, handle processing in a generic way. @@ -1997,7 +1997,7 @@ void ChatMaster::startMsnObjectDownload( const QString &handle, const MsnObject else { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Starting MsnObject download (type=" << msnObject->getType() << ")."; + kmDebug() << "Starting MsnObject download (type=" << msnObject->getType() << ")."; #endif // Create and initialize the application. @@ -2029,7 +2029,7 @@ void ChatMaster::timedUpdate() } #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "handling timed events."; + kmDebug() << "handling timed events."; #endif // See if there are pictures to download. @@ -2043,7 +2043,7 @@ void ChatMaster::timedUpdate() pendingDisplayPictures_.removeAll( handle ); #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "see if the display picture of '" << handle << "' should be downloaded."; + kmDebug() << "see if the display picture of '" << handle << "' should be downloaded."; #endif // See if the picture was already downloaded somehow (e.g. user opened a chat) @@ -2054,7 +2054,7 @@ void ChatMaster::timedUpdate() if( contact == 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "contact not found, was it removed?"; + kmDebug() << "contact not found, was it removed?"; #endif continue; } @@ -2063,7 +2063,7 @@ void ChatMaster::timedUpdate() if( contact->isOffline() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "contact is no longer online."; + kmDebug() << "contact is no longer online."; #endif continue; } @@ -2073,7 +2073,7 @@ void ChatMaster::timedUpdate() if( contact->isBlocked() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "contact is blocked."; + kmDebug() << "contact is blocked."; #endif continue; } @@ -2083,7 +2083,7 @@ void ChatMaster::timedUpdate() if( msnObject == 0 ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "MsnObject has been reset."; + kmDebug() << "MsnObject has been reset."; #endif continue; } @@ -2095,7 +2095,7 @@ void ChatMaster::timedUpdate() && msnObject->verifyFile( objectFileName ) ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Picture is already downloaded."; + kmDebug() << "Picture is already downloaded."; #endif continue; } @@ -2109,7 +2109,7 @@ void ChatMaster::timedUpdate() // Made the debug output easier to understand. if( ! contact->hasApplicationList() ) { - kDebug() << "Picture is not available, creating application list."; + kmDebug() << "Picture is not available, creating application list."; } #endif @@ -2121,7 +2121,7 @@ void ChatMaster::timedUpdate() if( appList->hasMsnObjectTransfer( *msnObject ) ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "transfer for the picture is already active."; + kmDebug() << "transfer for the picture is already active."; #endif continue; } @@ -2131,7 +2131,7 @@ void ChatMaster::timedUpdate() // Download the picture. #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Picture is not available, starting switchboard connection to download it."; + kmDebug() << "Picture is not available, starting switchboard connection to download it."; #endif // Start a chat to download the picture. @@ -2149,20 +2149,20 @@ void ChatMaster::updateChatGrouping() if( currentAccount_->getTabbedChatMode() == chatTabbedMode_ ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Chat grouping mode not changed, nothing to update"; + kmDebug() << "Chat grouping mode not changed, nothing to update"; #endif return; } #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Updating Chat grouping"; + kmDebug() << "Updating Chat grouping"; #endif chatTabbedMode_ = currentAccount_->getTabbedChatMode(); if( chatWindows_.empty() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "No ChatWindows, nothing to update"; + kmDebug() << "No ChatWindows, nothing to update"; #endif return; } @@ -2178,7 +2178,7 @@ void ChatMaster::updateChatGrouping() if( window == 0) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "No suited window found for chat" << chat; + kmDebug() << "No suited window found for chat" << chat; #endif ChatWindow* newChatWindow = createChatWindow( chat); @@ -2192,7 +2192,7 @@ void ChatMaster::updateChatGrouping() else if( window != currentWindow ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Moving chat" << chat << "to other window" << window; + kmDebug() << "Moving chat" << chat << "to other window" << window; #endif window->addChatTab( chat, false ); @@ -2216,7 +2216,7 @@ ChatWindow *ChatMaster::findWindowForChat( Chat *chat ) if( ! chatWindows_.empty() ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "At least one chat window is already open: checking the tabbed chatting settings."; + kmDebug() << "At least one chat window is already open: checking the tabbed chatting settings."; #endif if( currentAccount->getTabbedChatMode() == 0 ) // Always group in tabs @@ -2224,13 +2224,13 @@ ChatWindow *ChatMaster::findWindowForChat( Chat *chat ) // Pick the last open chat window window = chatWindows_.last(); #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Always group in tabs. Picking the last created window."; + kmDebug() << "Always group in tabs. Picking the last created window."; #endif } else if( currentAccount->getTabbedChatMode() == 1 ) // Group tabs by initial contact's group { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Group in tabs by contact group. Choosing a window."; + kmDebug() << "Group in tabs by contact group. Choosing a window."; #endif QString handle( chat->getSwitchboardConnection()->getFirstContact() ); Contact *contact = currentAccount->getContactList()->getContactByHandle( handle ); @@ -2239,7 +2239,7 @@ ChatWindow *ChatMaster::findWindowForChat( Chat *chat ) { QString group( contact->getGroupIds().first() ); #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Searching chats for one whose first contact is in the same group as the new one's."; + kmDebug() << "Searching chats for one whose first contact is in the same group as the new one's."; #endif foreach( Chat *chatItem, chats_ ) { @@ -2250,7 +2250,7 @@ ChatWindow *ChatMaster::findWindowForChat( Chat *chat ) && contact->getGroupIds().first() == group ) { #ifdef KMESSDEBUG_CHATMASTER - kDebug() << "Match found!"; + kmDebug() << "Match found!"; #endif window = chatItem->getChatWindow(); diff --git a/src/chat/chatmessagestyle.cpp b/src/chat/chatmessagestyle.cpp index e24dbdd..89df68b 100644 --- a/src/chat/chatmessagestyle.cpp +++ b/src/chat/chatmessagestyle.cpp @@ -91,7 +91,7 @@ QString ChatMessageStyle::convertMessage(const ChatMessage &message) if(xslTransformation_ == 0 || ! xslTransformation_->hasStylesheet()) { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "no XSL theme loaded (theme=" << name_ << ")," + kmWarning() << "no XSL theme loaded (theme=" << name_ << ")," << " using fallback theme." << endl; #endif @@ -109,7 +109,7 @@ QString ChatMessageStyle::convertMessage(const ChatMessage &message) if( parsedMessage.isNull() ) { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "XSL conversion failed (theme=" << name_ << ")," + kmWarning() << "XSL conversion failed (theme=" << name_ << ")," << " using fallback theme." << endl; #endif return createFallbackMessage(message); @@ -117,7 +117,7 @@ QString ChatMessageStyle::convertMessage(const ChatMessage &message) else if( isEmptyResult(parsedMessage) ) { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "XSL conversion returned no data (theme=" << name_ << ")," + kmWarning() << "XSL conversion returned no data (theme=" << name_ << ")," << " using fallback theme." << endl; #endif return createFallbackMessage(message); @@ -141,7 +141,7 @@ QString ChatMessageStyle::convertMessageList(const QList &messageL // Warn for empty list, avoid broken markup if( messageList.isEmpty() ) { - kWarning() << "no messages given!"; + kmWarning() << "no messages given!"; return QString::null; } else if( messageList.count() == 1 ) @@ -160,7 +160,7 @@ QString ChatMessageStyle::convertMessageList(const QList &messageL if( ! hasStyle ) { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "no XSL theme loaded (theme=" << name_ << ")," + kmWarning() << "no XSL theme loaded (theme=" << name_ << ")," << " using fallback theme." << endl; #endif } @@ -198,14 +198,14 @@ QString ChatMessageStyle::convertMessageList(const QList &messageL if( parsedMessage.isNull() ) { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "XSL conversion failed (theme=" << name_ << ")," + kmWarning() << "XSL conversion failed (theme=" << name_ << ")," << " using fallback theme." << endl; #endif } else if( isEmptyResult(parsedMessage) ) { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "XSL conversion returned no data (theme=" << name_ << ")," + kmWarning() << "XSL conversion returned no data (theme=" << name_ << ")," << " using fallback theme." << endl; #endif } @@ -241,13 +241,13 @@ QString ChatMessageStyle::convertXmlMessageList( const QString &xmlMessagesList if( parsedMessage.isNull() ) { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "XSL conversion failed (theme=" << name_ << "), cannot convert."; + kmWarning() << "XSL conversion failed (theme=" << name_ << "), cannot convert."; #endif } else if( isEmptyResult( parsedMessage ) ) { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "XSL conversion returned no data (theme=" << name_ << "), cannot convert."; + kmWarning() << "XSL conversion returned no data (theme=" << name_ << "), cannot convert."; #endif } else @@ -258,7 +258,7 @@ QString ChatMessageStyle::convertXmlMessageList( const QString &xmlMessagesList } #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "no XSL theme loaded (theme=" << name_ << "), cannot convert."; + kmWarning() << "no XSL theme loaded (theme=" << name_ << "), cannot convert."; #endif // Conversion failed, return the original string. @@ -278,7 +278,7 @@ QString ChatMessageStyle::convertMessageRoot() if( ! hasStyle() ) { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "no XSL theme loaded."; + kmWarning() << "no XSL theme loaded."; #endif } else @@ -302,7 +302,7 @@ QString ChatMessageStyle::convertMessageRoot() else { #ifdef KMESSDEBUG_CHATVIEW - kWarning() << "XSL conversion failed (theme=" << name_ << ")."; + kmWarning() << "XSL conversion failed (theme=" << name_ << ")."; #endif } } @@ -443,7 +443,7 @@ QString ChatMessageStyle::convertMessageToXml( const ChatMessage &message, bool #ifdef KMESSDEBUG_CHATVIEW else { - kDebug() << "Found invalid character with code " << (int)utf16[i] << ", not showing"; + kmDebug() << "Found invalid character with code " << (int)utf16[i] << ", not showing"; } #endif } @@ -993,7 +993,7 @@ bool ChatMessageStyle::setStyle(const QString &style) if(path.isNull()) { - kWarning() << "could not find the style named '" << style << "'."; + kmWarning() << "could not find the style named '" << style << "'."; return false; } @@ -1015,13 +1015,13 @@ bool ChatMessageStyle::setStyle(const QString &style) xslTransformation_->setParameters(parameters); #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Style" << style << "loaded from path:" << path << ". Base folder:" << baseFolder_; + kmDebug() << "Style" << style << "loaded from path:" << path << ". Base folder:" << baseFolder_; #endif } #ifdef KMESSDEBUG_CHATVIEW else { - kDebug() << "Unable to load style:" << style << "from path:" << path; + kmDebug() << "Unable to load style:" << style << "from path:" << path; } #endif @@ -1074,7 +1074,7 @@ QString ChatMessageStyle::stripDoctype( const QString &parsedMessage ) int endPos = parsedMessage.indexOf( re ); if( endPos == -1 ) { - kWarning() << "Could not strip DOCTYPE tag: end position not found!"; + kmWarning() << "Could not strip DOCTYPE tag: end position not found!"; return parsedMessage; } diff --git a/src/chat/chatmessageview.cpp b/src/chat/chatmessageview.cpp index 90bbfbf..5cb9532 100644 --- a/src/chat/chatmessageview.cpp +++ b/src/chat/chatmessageview.cpp @@ -65,6 +65,8 @@ ChatMessageView::ChatMessageView( QWidget *parentWidget, QObject *parent ) // Connect signals for browsing connect( browserExtension(), SIGNAL( openUrlRequestDelayed(const KUrl&,const KParts::OpenUrlArguments&,const KParts::BrowserArguments&) ), this, SIGNAL( openUrlRequest(const KUrl&) ) ); + connect( this, SIGNAL( completed() ), + this, SLOT ( scrollChatToBottom() ) ); // Make sure this widget can't get any focus. view()->setFocusPolicy( Qt::NoFocus ); @@ -112,7 +114,7 @@ ChatMessageView::~ChatMessageView() void ChatMessageView::addedEmoticon( QString shortcut ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Replacing add emoticon links with shortcut '" << shortcut << "'."; + kmDebug() << "Replacing add emoticon links with shortcut '" << shortcut << "'."; #endif // The shortcut in emoticon links is url-encoded, convert the original one to match it @@ -137,7 +139,7 @@ void ChatMessageView::addedEmoticon( QString shortcut ) if( link.isNull() || ! link.isHTMLElement() ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Link null, skipping."; + kmDebug() << "Link null, skipping."; #endif continue; } @@ -149,7 +151,7 @@ void ChatMessageView::addedEmoticon( QString shortcut ) if( parent.isNull() ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Parent null, skipping."; + kmDebug() << "Parent null, skipping."; #endif continue; } @@ -157,7 +159,7 @@ void ChatMessageView::addedEmoticon( QString shortcut ) if( image.isNull() ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Image null, skipping."; + kmDebug() << "Image null, skipping."; #endif continue; } @@ -166,6 +168,23 @@ void ChatMessageView::addedEmoticon( QString shortcut ) } } +void ChatMessageView::addXml( QString xmlString ) +{ + // Create new HTML node + DOM::HTMLElement newNode = document().createElement( "div" ); + newNode.setInnerHTML( chatStyle_->convertXmlMessageList( xmlString ) ); + + DOM::HTMLElement messageRoot = htmlDocument().getElementById( "messageRoot" ); + if( messageRoot.isNull() ) + { + messageRoot = htmlDocument().body(); + } + messageRoot.appendChild( document().createTextNode("\n") ); + messageRoot.appendChild( newNode ); + messageRoot.appendChild( document().createTextNode("\n") ); + + isEmpty_ = false; +} // Add the given html to the chat browser and scroll to the end @@ -224,6 +243,11 @@ void ChatMessageView::clearView( bool clearHistory ) // Return the HTML source of the page. QString ChatMessageView::getHistory( Account::ChatExportFormat format, bool append, QString &appendPoint ) { + if( chatMessages_.isEmpty() ) + { + return QString(); + } + QString chatHistory; QString handle( chatMessages_.first()->getContactHandle() ); uint date ( chatMessages_.first()->getDateTime().toTime_t() ); @@ -240,104 +264,6 @@ QString ChatMessageView::getHistory( Account::ChatExportFormat format, bool appe switch( format ) { - case Account::EXPORT_XML: - { - // Convert every message in the history to XML - // TODO - Make this extremely slow process faster by caching the chat's XML. - QList groupedMessages; - QListIterator it( chatMessages_ ); - - while( it.hasNext() ) - { - ChatMessage *chatMessage = it.next(); - - // Chat messages from the same person are always grouped together - if( chatMessage->isNormalMessage() ) - { - if( groupedMessages.isEmpty() ) - { - groupedMessages.append( chatMessage ); - continue; - } - - ChatMessage *lastContactMessage = groupedMessages.last(); - - // Check for contact handle and message type, so offline messages won't be - // grouped with normal incoming messages. - if( lastContactMessage->getContactHandle() == chatMessage->getContactHandle() - && lastContactMessage->getType() == chatMessage->getType() ) - { - groupedMessages.append( chatMessage ); - continue; - } - } - - // There are messages to flush - if( ! groupedMessages.isEmpty() ) - { - // Do not add message groups with only one message - if( groupedMessages.count() > 1 ) - { - chatHistory += "\n"; - foreach( ChatMessage *groupMessage, groupedMessages ) - { - chatHistory += chatStyle_->convertMessageToXml( *groupMessage, true ); - } - chatHistory += "\n"; - } - else - { - chatHistory += chatStyle_->convertMessageToXml( *( groupedMessages.first() ), true ); - } - groupedMessages.clear(); - } - - // All chat messages are grouped, special messages never are - if( chatMessage->isNormalMessage() ) - { - groupedMessages.append( chatMessage ); - } - else - { - chatHistory += chatStyle_->convertMessageToXml( *chatMessage, true ); - } - } - - // Flush the last group of messages, if any - if( ! groupedMessages.isEmpty() ) - { - chatHistory += "\n"; - foreach( ChatMessage *groupMessage, groupedMessages ) - { - chatHistory += chatStyle_->convertMessageToXml( *groupMessage, true ); - } - chatHistory += "\n"; - } - - chatHistory = "\n\n" + chatHistory + "\n"; - - // we've changed it at line 2 of this method. - // we MUST change it back here otherwise the style tag written - // below could be incorrect! - chatStyle_->setAllowEmoticonLinks( oldAllowEmoticonLinks ); - - if( append ) - { - // Tell the caller where this chat should be inserted - appendPoint = ""; - - return chatHistory; - } - - // Not appending: also add a root element to the history - return "\n" - "getStyleSheet() + "\" media=\"all\" ?>\n" - "\n" - "\n" - + chatHistory + - "\n\n"; - } - case Account::EXPORT_HTML: { chatHistory += "\n
" @@ -369,7 +295,7 @@ QString ChatMessageView::getHistory( Account::ChatExportFormat format, bool appe DOM::HTMLElement messageRoot( copy.getElementById( "messageRoot" ) ); if( messageRoot.isNull() ) { - kWarning() << "Current style does not define the 'messageRoot' element!"; + kmWarning() << "Current style does not define the 'messageRoot' element!"; chatStyle_->setAllowEmoticonLinks( oldAllowEmoticonLinks ); return chatHistory; } @@ -438,7 +364,7 @@ QString ChatMessageView::getHistory( Account::ChatExportFormat format, bool appe } default: - kWarning() << "Invalid export format: code" << format; + kmWarning() << "Invalid export format: code" << format; break; } @@ -575,7 +501,7 @@ QString ChatMessageView::rebuildHistory( bool fullHistory ) void ChatMessageView::removeCustomEmoticon( const QString &shortcut ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Deleting emoticons with shortcut:" << shortcut; + kmDebug() << "Deleting emoticons with shortcut:" << shortcut; #endif #ifdef KMESSTEST KMESS_ASSERT( ! shortcut.isEmpty() ); @@ -611,7 +537,7 @@ void ChatMessageView::removeCustomEmoticon( const QString &shortcut ) if( img.isNull() ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Skipped null element."; + kmDebug() << "Skipped null element."; #endif continue; } @@ -622,7 +548,7 @@ void ChatMessageView::removeCustomEmoticon( const QString &shortcut ) if( altAttribute != shortcut && altAttribute != originalShortcut ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Skipped element:" << img.getAttribute("alt").string() << "while searching for" << originalShortcut; + kmDebug() << "Skipped element:" << img.getAttribute("alt").string() << "while searching for" << originalShortcut; #endif continue; } @@ -659,7 +585,7 @@ void ChatMessageView::replaceLastMessage(const QString &text) DOM::HTMLElement lastNode( htmlDocument().getElementById( lastId ) ); if( lastNode.isNull() || ! lastNode.isHTMLElement() ) { - kWarning() << "message block with id" + lastId + "not found, appending message instead."; + kmWarning() << "message block with id" + lastId + "not found, appending message instead."; addHtmlMessage( text ); return; } @@ -678,8 +604,21 @@ void ChatMessageView::scrollChat( bool forward, bool fast ) -// Scroll to the bottom of the chat browser +// Force scrolling to the bottom of the chat browser void ChatMessageView::scrollChatToBottom() +{ + int contentsHeight = view()->contentsHeight(); + view()->scrollBy( 0, contentsHeight ); + +#ifdef KMESSDEBUG_CHATMESSAGEVIEW + kmDebug() << "Scrolled view down."; +#endif +} + + + +// Scroll to the bottom of the chat browser if needed +void ChatMessageView::scrollChatToBottomGently() { int contentsHeight = view()->contentsHeight(); int visibleHeight = view()->visibleHeight(); @@ -691,6 +630,10 @@ void ChatMessageView::scrollChatToBottom() } view()->scrollBy( 0, contentsHeight ); + +#ifdef KMESSDEBUG_CHATMESSAGEVIEW + kmDebug() << "Scrolled view down."; +#endif } @@ -768,7 +711,7 @@ void ChatMessageView::setHtml( const QString &newHtmlBody ) DOM::HTMLElement messageRoot = document().getElementById( "messageRoot" ); if( messageRoot.isNull() ) { - kWarning() << "Chat style does not define the 'messageRoot' element!"; + kmWarning() << "Chat style does not define the 'messageRoot' element!"; messageRoot = htmlDocument().body(); } messageRoot.setInnerHTML( "\n" + newHtmlBody + "\n" ); @@ -801,7 +744,7 @@ void ChatMessageView::showMessage( const ChatMessage &message ) && lastChatMessage->getContactHandle() == message.getContactHandle() ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Not showing presence message for the same contact again."; + kmDebug() << "Not showing presence message for the same contact again."; #endif return; } @@ -842,7 +785,7 @@ void ChatMessageView::showMessage( const ChatMessage &message ) if( lastContactMessages_.count() > 1 ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "replacing last contact message with new contents."; + kmDebug() << "replacing last contact message with new contents."; #endif messageHtml = chatStyle_->convertMessageList(lastContactMessages_); @@ -851,7 +794,7 @@ void ChatMessageView::showMessage( const ChatMessage &message ) else { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "appending new message."; + kmDebug() << "appending new message."; #endif messageHtml = chatStyle_->convertMessage( *chatMessage ); @@ -883,7 +826,7 @@ void ChatMessageView::showMessage( const ChatMessage &message ) // Call the scroll function a bit later, // so Qt/kde get a chance to update the height before the scrolling starts. - QTimer::singleShot( 50, this, SLOT( scrollChatToBottom() ) ); + QTimer::singleShot( 50, this, SLOT( scrollChatToBottomGently() ) ); } @@ -913,7 +856,7 @@ void ChatMessageView::updateApplicationMessage( const QString &messageId, const void ChatMessageView::updateChatStyle() { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "updating style."; + kmDebug() << "updating style."; #endif if(KMESS_NULL(chatStyle_)) return; @@ -935,7 +878,7 @@ void ChatMessageView::updateChatStyle() && currentAccount_->getEmoticonStyle() == chatStyle_->getEmoticonStyle() ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Update not needed."; + kmDebug() << "Update not needed."; #endif return; } @@ -967,7 +910,7 @@ void ChatMessageView::updateChatStyle() // Call the scroll function a bit later, // so Qt/kde get a chance to update the height before the scrolling starts. - QTimer::singleShot( 50, this, SLOT( scrollChatToBottom() ) ); + QTimer::singleShot( 50, this, SLOT( scrollChatToBottomGently() ) ); } @@ -977,7 +920,7 @@ void ChatMessageView::updateCustomEmoticon( const QString &code, const QString & const QString &handle ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Replacing emoticon '" << code << "' with '" << replacement << "' for '" << handle << "'"; + kmDebug() << "Replacing emoticon '" << code << "' with '" << replacement << "' for '" << handle << "'"; #endif #ifdef KMESSTEST KMESS_ASSERT( ! code.isEmpty() ); @@ -988,7 +931,7 @@ void ChatMessageView::updateCustomEmoticon( const QString &code, const QString & // Check for empty replacements. if( replacement.isEmpty() ) { - kWarning() << "can't update custom emoticon, replacement not found (contact=" << handle << ")."; + kmWarning() << "can't update custom emoticon, replacement not found (contact=" << handle << ")."; return; } @@ -1000,7 +943,7 @@ void ChatMessageView::updateCustomEmoticon( const QString &code, const QString & foreach( const QString &tag, pendingEmoticonTags_ ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Checking DOM element '" << tag << "'"; + kmDebug() << "Checking DOM element '" << tag << "'"; #endif // Check if the element is valid @@ -1008,7 +951,7 @@ void ChatMessageView::updateCustomEmoticon( const QString &code, const QString & if( img.isNull() ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Skipped null element."; + kmDebug() << "Skipped null element."; #endif continue; } @@ -1027,7 +970,7 @@ void ChatMessageView::updateCustomEmoticon( const QString &code, const QString & if( img.isNull() || imageAltText != code ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Skipped invalid element (searched '" << code << "', found '" << imageAltText << "')."; + kmDebug() << "Skipped invalid element (searched '" << code << "', found '" << imageAltText << "')."; #endif continue; } @@ -1036,7 +979,7 @@ void ChatMessageView::updateCustomEmoticon( const QString &code, const QString & if( img.getAttribute("contact") != handle ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Emoticon code found, but different handle: " << img.getAttribute("contact"); + kmDebug() << "Emoticon code found, but different handle: " << img.getAttribute("contact"); #endif continue; } @@ -1067,7 +1010,7 @@ void ChatMessageView::updateCustomEmoticon( const QString &code, const QString & } #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Emoticon replacement has attribute: " << attribRegExp.cap(1) << "=" << attribRegExp.cap(2); + kmDebug() << "Emoticon replacement has attribute: " << attribRegExp.cap(1) << "=" << attribRegExp.cap(2); #endif img.setAttribute( attribRegExp.cap(1), attribRegExp.cap(2) ); @@ -1084,7 +1027,7 @@ void ChatMessageView::updateCustomEmoticon( const QString &code, const QString & && ! customEmoticonsPattern.contains( code ) ) { #ifdef KMESSDEBUG_CHATMESSAGEVIEW - kDebug() << "Inserting emoticon addition link"; + kmDebug() << "Inserting emoticon addition link"; #endif // Copy the original image to a new one we'll modify DOM::HTMLElement newImage = img.cloneNode( true ); @@ -1124,7 +1067,7 @@ void ChatMessageView::updateCustomEmoticon( const QString &code, const QString & // Creates the default actions for a popup menu. Copy, Select All and Find. // Attaches them to slots on this class. // -// Users of this class can add their own entries to the popup menu by getting +// Users of this class can add their own entries to the popup menu by getting // the KMenu instance representing the popup using ChatMessageView::popupMenu(). // void ChatMessageView::createPopupMenuActions() diff --git a/src/chat/chatmessageview.h b/src/chat/chatmessageview.h index a1e33e4..b83a50e 100644 --- a/src/chat/chatmessageview.h +++ b/src/chat/chatmessageview.h @@ -48,6 +48,8 @@ class ChatMessageView : public KHTMLPart ChatMessageView( QWidget *parentWidget = 0, QObject *parent = 0 ); // The destructor virtual ~ChatMessageView(); + // Add new XML content to the view + void addXml( QString xmlString ); // Return the chat history in a specified format QString getHistory( Account::ChatExportFormat format, bool append, QString &appendPoint ); // Return a pointer to the message style parser @@ -83,8 +85,10 @@ class ChatMessageView : public KHTMLPart * @param fast Whether to scroll at normal speed or faster */ void scrollChat( bool forward, bool fast ); - // Scroll to the bottom of the chat browser + // Force scrolling to the bottom of the chat browser void scrollChatToBottom(); + // Scroll to the bottom of the chat browser if needed + void scrollChatToBottomGently(); // Add the given message to the message browser. void showMessage( const ChatMessage &message ); // Replace an application's accept/reject/cancel links with another text diff --git a/src/chat/chatview.cpp b/src/chat/chatview.cpp index 163bbe0..817d8c4 100644 --- a/src/chat/chatview.cpp +++ b/src/chat/chatview.cpp @@ -97,13 +97,19 @@ ChatView::ChatView( QWidget *parent ) ChatView::~ChatView() { // Delete the related widgets - delete contactsWidget_; delete inkDrawing_; delete messageEditContents_; } +// Parse and add the given XML string to the view +void ChatView::addContents( const QString& xmlString ) +{ + chatMessageView_->addXml( xmlString ); +} + + // Copy the currently selected text void ChatView::editCopy() { @@ -135,7 +141,7 @@ bool ChatView::eventFilter( QObject *obj, QEvent *event ) if( ! dragEvent ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Ignoring invalid drag event!"; + kmDebug() << "Ignoring invalid drag event!"; #endif return false; } @@ -146,14 +152,14 @@ bool ChatView::eventFilter( QObject *obj, QEvent *event ) || mimeData->hasFormat( "application/kmess.list.item" ) ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Accepting drag event of mimetypes:" << dragEvent->mimeData()->formats(); + kmDebug() << "Accepting drag event of mimetypes:" << dragEvent->mimeData()->formats(); #endif dragEvent->acceptProposedAction(); return true; } #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Ignoring invalid drop having mimetypes:" << dragEvent->mimeData()->formats(); + kmDebug() << "Ignoring invalid drop having mimetypes:" << dragEvent->mimeData()->formats(); #endif break; } @@ -167,7 +173,7 @@ bool ChatView::eventFilter( QObject *obj, QEvent *event ) if( ! dropEvent || dropEvent->source() != 0 ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Ignoring invalid drop!"; + kmDebug() << "Ignoring invalid drop!"; #endif break; } @@ -176,7 +182,7 @@ bool ChatView::eventFilter( QObject *obj, QEvent *event ) if( mimeData->hasUrls() ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Drag'n'dropped files:" << mimeData->urls(); + kmDebug() << "Drag'n'dropped files:" << mimeData->urls(); #endif // Send the files to the contact @@ -193,13 +199,13 @@ bool ChatView::eventFilter( QObject *obj, QEvent *event ) if( image.isNull() ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Drag'n'dropped an invalid image!"; + kmDebug() << "Drag'n'dropped an invalid image!"; #endif return true; } #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Drag'n'dropped a" << image.size() << "image"; + kmDebug() << "Drag'n'dropped a" << image.size() << "image"; #endif // Create a temporary file where the image will be stored. @@ -214,7 +220,7 @@ bool ChatView::eventFilter( QObject *obj, QEvent *event ) if( ! file.open() ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Cannot create temporary image file!"; + kmDebug() << "Cannot create temporary image file!"; #endif return true; } @@ -254,7 +260,7 @@ bool ChatView::eventFilter( QObject *obj, QEvent *event ) if( ! handles.isEmpty() ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Drag'n'dropped addresses:" << handles; + kmDebug() << "Drag'n'dropped addresses:" << handles; #endif inviteContacts( handles ); dropEvent->acceptProposedAction(); @@ -268,7 +274,7 @@ bool ChatView::eventFilter( QObject *obj, QEvent *event ) // Ensure that the chat shows the same contents when resizing it case QEvent::Resize: { - chatMessageView_->scrollChatToBottom(); + chatMessageView_->scrollChatToBottomGently(); break; } @@ -317,19 +323,19 @@ int ChatView::getZoomFactor() bool ChatView::initialize() { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "initializing."; + kmDebug() << "initializing."; #endif if ( initialized_ ) { - kDebug() << "already initialized."; + kmDebug() << "already initialized."; return false; } currentAccount_ = CurrentAccount::instance(); if ( currentAccount_ == 0 ) { - kDebug() << "Couldn't get the instance of the current account."; + kmDebug() << "Couldn't get the instance of the current account."; return false; } @@ -375,7 +381,7 @@ bool ChatView::isEmpty() const bool ChatView::saveChatToFile( const QString &path, Account::ChatExportFormat format, bool overwriteContents, bool allowUserInteraction ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "saving chat to '" << path << "'."; + kmDebug() << "saving chat to '" << path << "'."; #endif // Find out if the file already exists @@ -391,7 +397,7 @@ bool ChatView::saveChatToFile( const QString &path, Account::ChatExportFormat fo } QFileInfo info( file ); - kWarning() << "File save failed! Could not open file" << path << "."; + kmWarning() << "File save failed! Could not open file" << path << "."; KMessageBox::sorry( chatMessageView_->view(), i18n( "Could not save chat log in directory '%1'.\n" "Make sure you have permission to write in " "the folder where logs are being saved.", @@ -415,10 +421,9 @@ bool ChatView::saveChatToFile( const QString &path, Account::ChatExportFormat fo fileData = file.read( 512 ); if( fileData.indexOf( chatMessageView_->getStyleTag() ) == -1 ) { - kWarning() << "Style Tag not found in data:" << fileData << ", writing to a new file"; + kmWarning() << "Style Tag not found in data:" << fileData << ", writing to a new file"; // we return false, so the caller will write this data to a new file - // TODO: make *this* method decide where to write the data? return false; } } @@ -426,15 +431,15 @@ bool ChatView::saveChatToFile( const QString &path, Account::ChatExportFormat fo QString chatHistory( chatMessageView_->getHistory( format, willAppend, appendPoint ) ); #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Writing to file:" << file.fileName(); - kDebug() << "Current file exists?" << isExistingFile << " allow overwriting?" << overwriteContents; - kDebug() << "Will append to current file?" << willAppend; + kmDebug() << "Writing to file:" << file.fileName(); + kmDebug() << "Current file exists?" << isExistingFile << " allow overwriting?" << overwriteContents; + kmDebug() << "Will append to current file?" << willAppend; #endif if( willAppend ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Appending to existing chat file..."; + kmDebug() << "Appending to existing chat file..."; #endif const qint16 maxReadSize = 256; @@ -444,11 +449,11 @@ bool ChatView::saveChatToFile( const QString &path, Account::ChatExportFormat fo fileData = file.read( maxReadSize ); int pos = fileData.lastIndexOf( appendPoint ); - // The append point was not found: we'll fallback to creating a new file + // The append point was not found! if( pos < 0 ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Append process failed, insertion string not found."; + kmDebug() << "Append process failed, insertion string not found."; #endif return false; } @@ -462,7 +467,7 @@ bool ChatView::saveChatToFile( const QString &path, Account::ChatExportFormat fo else { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Creating new chat file..."; + kmDebug() << "Creating new chat file..."; #endif file.resize( 0 ); // Truncate it (99% useless precaution) } @@ -475,13 +480,14 @@ bool ChatView::saveChatToFile( const QString &path, Account::ChatExportFormat fo { textStream.setCodec( QTextCodec::codecForLocale() ); } - // For HTML and XML logs (that are created with charset attribute to UTF-8) we use UTF-8 encoding + // For HTML logs (which are created with the UTF-8 charset) we use UTF-8 encoding else { textStream.setCodec( QTextCodec::codecForName("UTF-8") ); } textStream << chatHistory; + textStream.flush(); file.close(); return true; @@ -507,6 +513,14 @@ void ChatView::setEnabled( bool isEnabled ) +// Replace the message browser's contents with the given XML string. +void ChatView::setContents( const QString& xmlString ) +{ + chatMessageView_->setXml( xmlString ); +} + + + // Set the zoom factor of the text void ChatView::setZoomFactor( int percentage ) { @@ -546,8 +560,7 @@ void ChatView::showSaveChatDialog() path = KFileDialog::getSaveFileName( path, i18nc( "Chat log saving dialog, file type filter", "*.html *.htm|Web Page (*.html)\n" - "*.txt|Plain Text Document (*.txt)\n" - "*.xml|XML Document (*.xml)" ) ); + "*.txt|Plain Text Document (*.txt)\n" ) ); // Verify if the user has canceled the command if( path.isEmpty() ) @@ -577,10 +590,6 @@ void ChatView::showSaveChatDialog() { format = Account::EXPORT_HTML; } - else if( targetFile.suffix() == "xml" ) - { - format = Account::EXPORT_XML; - } else { format = Account::EXPORT_TEXT; @@ -601,14 +610,14 @@ void ChatView::slotAddContact() if( ! chatViewClickedUrl_.isValid() ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Not adding anything from invalid URL: " << email; + kmDebug() << "Not adding anything from invalid URL: " << email; #endif return; } #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Adding contact from URL: " << email; + kmDebug() << "Adding contact from URL: " << email; #endif // Strip the pseudo-protocol 'mail to' from the email address @@ -633,7 +642,7 @@ void ChatView::slotAddNewEmoticon() if( ! chatViewClickedUrl_.isValid() || chatViewClickedUrl_.protocol() != "kmess" || chatViewClickedUrl_.host() != "emoticon" ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Ignoring request for invalid URL: " << chatViewClickedUrl_; + kmDebug() << "Ignoring request for invalid URL: " << chatViewClickedUrl_; #endif return; @@ -661,7 +670,7 @@ void ChatView::slotAddNewEmoticon() if( contact == 0 ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Contact handle not found: " << handle; + kmDebug() << "Contact handle not found: " << handle; #endif return; @@ -672,7 +681,7 @@ void ChatView::slotAddNewEmoticon() shortcut = KUrl::fromPercentEncoding( shortcut.toUtf8() ); #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Showing Add Emoticon dialog - shortcut=" << shortcut << " picture=" << picture; + kmDebug() << "Showing Add Emoticon dialog - shortcut=" << shortcut << " picture=" << picture; #endif // Finally, show the dialog, preselecting the picture file and shortcut @@ -703,14 +712,14 @@ void ChatView::slotCopyAddress() if( ! chatViewClickedUrl_.isValid() ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Not copying invalid URL: " << url; + kmDebug() << "Not copying invalid URL: " << url; #endif return; } #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Copying URL: " << url; + kmDebug() << "Copying URL: " << url; #endif // Strip the pseudo-protocol 'mail to' from email addresses @@ -750,7 +759,7 @@ void ChatView::slotIgnoreEmoticon() if( ! chatViewClickedUrl_.isValid() || chatViewClickedUrl_.protocol() != "kmess" || chatViewClickedUrl_.host() != "emoticon" ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Ignoring request for invalid URL: " << chatViewClickedUrl_; + kmDebug() << "Ignoring request for invalid URL: " << chatViewClickedUrl_; #endif return; @@ -777,7 +786,7 @@ void ChatView::slotIgnoreEmoticon() if( contact == 0 ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Contact handle not found: " << handle; + kmDebug() << "Contact handle not found: " << handle; #endif return; @@ -850,9 +859,16 @@ void ChatView::scrollTo( bool forward, bool fast ) // Scroll the view down to the last line -void ChatView::scrollToBottom() +void ChatView::scrollToBottom( bool force ) { - chatMessageView_->scrollChatToBottom(); + if( force ) + { + chatMessageView_->scrollChatToBottom(); + } + else + { + chatMessageView_->scrollChatToBottomGently(); + } } @@ -877,7 +893,7 @@ void ChatView::slotSendAppCommand() if( ! chatViewClickedUrl_.isValid() || chatViewClickedUrl_.protocol() != "kmess" || chatViewClickedUrl_.host() != "application" ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Not sending invalid application link: " << chatViewClickedUrl_.url(); + kmDebug() << "Not sending invalid application link: " << chatViewClickedUrl_.url(); #endif return; @@ -901,7 +917,7 @@ void ChatView::slotSendAppCommand() #endif #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Sending application link - method=" << method << " contact=" << contact << " cookie=" << cookie; + kmDebug() << "Sending application link - method=" << method << " contact=" << contact << " cookie=" << cookie; #endif emit appCommand( cookie, contact, method ); @@ -926,7 +942,7 @@ void ChatView::slotShowContextMenu( const QString &clickedUrl, const QPoint &poi KUrl url( clickedUrl ); #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Clicked URL: " << url.prettyUrl(); + kmDebug() << "Clicked URL: " << url.prettyUrl(); #endif if( url.protocol() == "kmess" && url.host() == "emoticon" ) @@ -967,7 +983,7 @@ void ChatView::slotShowContextMenu( const QString &clickedUrl, const QPoint &poi } #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Creating popup menu entries"; + kmDebug() << "Creating popup menu entries"; #endif // Create items @@ -1016,14 +1032,14 @@ void ChatView::slotVisitAddress() if( ! chatViewClickedUrl_.isValid() ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Not opening invalid URL: " << chatViewClickedUrl_; + kmDebug() << "Not opening invalid URL: " << chatViewClickedUrl_; #endif return; } #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Opening URL: " << chatViewClickedUrl_; + kmDebug() << "Opening URL: " << chatViewClickedUrl_; #endif // Launch the browser for the given URL @@ -1052,7 +1068,7 @@ void ChatView::updateCustomEmoticon( const QString &handle, const QString &code // Check for empty replacements. if( code.isEmpty() ) { - kWarning() << "can't update custom emoticon, emoticon code not given (contact=" << handle << ")."; + kmWarning() << "can't update custom emoticon, emoticon code not given (contact=" << handle << ")."; return; } diff --git a/src/chat/chatview.h b/src/chat/chatview.h index 0db344c..52e0e34 100644 --- a/src/chat/chatview.h +++ b/src/chat/chatview.h @@ -71,7 +71,7 @@ class ChatView : public QWidget // Scroll the view forward or backward void scrollTo( bool forward, bool fast ); // Scroll the view down to the last line - void scrollToBottom(); + void scrollToBottom( bool force = false ); // Change ink drawing object void setInkDrawing( Isf::Drawing* newDrawing ); // Change the text zoom factor @@ -80,10 +80,14 @@ class ChatView : public QWidget void updateCustomEmoticon( const QString &handle, const QString &code ); public slots: + // Parse and add the given XML string to the view + void addContents( const QString& xmlString ); // Enable or disable the parts of the chat which allow user interaction void setEnabled( bool isEnabled ); + // Replace the message browser's contents with the given XML string. + void setContents( const QString& xmlString ); // Add the given message to the message browser. - void showMessage( const ChatMessage &message ); + virtual void showMessage( const ChatMessage &message ); // Show a dialog to save the chat. void showSaveChatDialog(); // The user clicked the "find text" option in the context menu @@ -96,10 +100,6 @@ class ChatView : public QWidget private: // Private methods // Event filter to detect special actions in the message editor. bool eventFilter( QObject *obj, QEvent *event ); - // Set up the contacts widget - bool initializeContactsWidget(); - // Initialize the current account - bool initializeCurrentAccount(); // Invite a contact to the chat virtual void inviteContacts( const QStringList &contacts ) = 0; // Send a file to a contact. diff --git a/src/chat/chatwindow.cpp b/src/chat/chatwindow.cpp index 1c1c440..fe93ea0 100644 --- a/src/chat/chatwindow.cpp +++ b/src/chat/chatwindow.cpp @@ -20,6 +20,7 @@ #include "../contact/contact.h" #include "../contact/msnobject.h" #include "../contact/invitedcontact.h" +#include "../dialogs/chathistorydialog.h" #include "../dialogs/invitedialog.h" #include "../model/contactlist.h" #include "../network/msnswitchboardconnection.h" @@ -32,6 +33,7 @@ #include "../kmessdebug.h" #include "chat.h" #include "config-kmess.h" +#include "chathistorymanager.h" #include "contactswidget.h" #include "emoticonswidget.h" #include "winkswidget.h" @@ -245,7 +247,7 @@ ChatWindow::~ChatWindow() saveProperties(); #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -318,7 +320,7 @@ void ChatWindow::changeZoomFactor( bool increase ) if( newZoom < 20 || newZoom > 300 ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Zoom level out of bounds, not updating."; + kmDebug() << "Zoom level out of bounds, not updating."; #endif return; } @@ -406,19 +408,19 @@ bool ChatWindow::closeAllTabs() bool ChatWindow::closeTab() { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Close request detected."; + kmDebug() << "Close request detected."; #endif Chat *currentChat = getCurrentChat(); if( currentChat != 0 ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Closing current chat tab " << currentChat; + kmDebug() << "Closing current chat tab " << currentChat; #endif if( ! slotTabRemoved( currentChat ) ) { - kWarning() << "Unable to close the current chat!"; + kmWarning() << "Unable to close the current chat!"; } } @@ -458,6 +460,7 @@ void ChatWindow::createMenus() inviteButton_ = new KAction ( KIcon("list-add-user"), i18n("&Invite..."), this ); sendAction_ = new KAction ( KIcon("folder-remote"), i18n("Send a &File..."), this ); nudgeAction_ = new KAction ( KIcon("preferences-desktop-notification-bell"), i18n("Send a &Nudge!"), this ); + historyMenuAction_ = new KActionMenu ( KIcon("chronometer"), i18n("Chat &History..."), this ); saveAction = new KAction ( KIcon("document-save"), i18n("Save Chat..."), this ); closeAllAction_ = new KAction ( KIcon("dialog-close"), i18n("Close &All Tabs"), this ); closeAction = KStandardAction::close ( this, SLOT( closeWidgetOrTab() ) , actionCollection_ ); @@ -546,6 +549,8 @@ void ChatWindow::createMenus() this, SLOT ( startFileTransfer() ) ); connect( nudgeAction_, SIGNAL( triggered(bool) ), this, SLOT ( sendNudge() ) ); + connect( historyMenuAction_, SIGNAL( triggered(bool) ), + this, SLOT ( slotShowChatHistory() ) ); connect( saveAction, SIGNAL( triggered(bool) ), this, SLOT ( saveChat() ) ); connect( closeAllAction_, SIGNAL( triggered() ), @@ -572,6 +577,7 @@ void ChatWindow::createMenus() actionCollection_->addAction( "send", sendAction_ ); actionCollection_->addAction( "nudge", nudgeAction_ ); actionCollection_->addAction( "save", saveAction ); + actionCollection_->addAction( "historyMenu", historyMenuAction_ ); actionCollection_->addAction( "closeAll", closeAllAction_ ); actionCollection_->addAction( "invite", inviteButton_ ); @@ -691,7 +697,7 @@ void ChatWindow::editorColorChanged(const QColor &color) if ( color.name() != currentAccount_->getFontColor() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Color was reset to" << color.name() << ". Restoring it to the account setting."; + kmDebug() << "Color was reset to" << color.name() << ". Restoring it to the account setting."; #endif messageEdit_->setTextColor( QColor( currentAccount_->getFontColor() ) ); messageEdit_->setFont( QFont ( currentAccount_->getFont() ) ); @@ -929,7 +935,7 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event ) if( ! dragEvent ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Ignoring invalid drag event!"; + kmDebug() << "Ignoring invalid drag event!"; #endif return false; } @@ -939,14 +945,14 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event ) || mimeData->hasImage() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Accepting drag event of mimetypes:" << dragEvent->mimeData()->formats(); + kmDebug() << "Accepting drag event of mimetypes:" << dragEvent->mimeData()->formats(); #endif dragEvent->acceptProposedAction(); return true; } #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Ignoring invalid drop having mimetypes:" << dragEvent->mimeData()->formats(); + kmDebug() << "Ignoring invalid drop having mimetypes:" << dragEvent->mimeData()->formats(); #endif break; @@ -959,7 +965,7 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event ) if( ! dropEvent ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Ignoring invalid drop!"; + kmDebug() << "Ignoring invalid drop!"; #endif return true; } @@ -973,12 +979,12 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event ) const QString url( mimeData->urls().first().toString() ); #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Checking if the dropped inline image is a fortified-PNG..."; + kmDebug() << "Checking if the dropped inline image is a fortified-PNG..."; #endif if( url.startsWith( marker ) ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Setting drawing to the Ink Canvas."; + kmDebug() << "Setting drawing to the Ink Canvas."; #endif QByteArray isfData( url.mid( marker.length() ).toAscii() ); Isf::Drawing* drawing = &( Isf::Stream::readerPng( isfData, true ) ); @@ -1003,7 +1009,7 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event ) if( dropEvent->source() != 0 ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Ignoring internal drop!"; + kmDebug() << "Ignoring internal drop!"; #endif dropEvent->ignore(); return true; @@ -1013,7 +1019,7 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event ) if( mimeData->hasUrls() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Drag'n'dropped files:" << mimeData->urls(); + kmDebug() << "Drag'n'dropped files:" << mimeData->urls(); #endif // Send the files to the contact @@ -1030,13 +1036,13 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event ) if( image.isNull() ) { #ifdef KMESSDEBUG_CHATVIEW - kDebug() << "Drag'n'dropped an invalid image!"; + kmDebug() << "Drag'n'dropped an invalid image!"; #endif return true; } #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Drag'n'dropped a" << image.size() << "image"; + kmDebug() << "Drag'n'dropped a" << image.size() << "image"; #endif // Create a temporary file where the image will be stored. @@ -1051,7 +1057,7 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event ) if( ! file.open() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Cannot create temporary image file!"; + kmDebug() << "Cannot create temporary image file!"; #endif return true; } @@ -1279,13 +1285,13 @@ bool ChatWindow::initialize() { if( initialized_ ) { - kDebug() << "already initialized."; + kmDebug() << "already initialized."; return false; } if( ! initializeCurrentAccount() ) { - kDebug() << "Couldn't setup the current account."; + kmDebug() << "Couldn't setup the current account."; return false; } @@ -1341,7 +1347,7 @@ bool ChatWindow::initializeCurrentAccount() currentAccount_ = CurrentAccount::instance(); if ( currentAccount_ == 0 ) { - kWarning() << "Could not get an instance of the current account."; + kmWarning() << "Could not get an instance of the current account."; return false; } @@ -1378,7 +1384,7 @@ void ChatWindow::insertEmoticon( const QString &shortcut ) bool ChatWindow::queryClose() { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Closing all open chats"; + kmDebug() << "Closing all open chats"; #endif return closeAllTabs(); @@ -1390,7 +1396,7 @@ bool ChatWindow::queryClose() bool ChatWindow::queryExit() { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Closing all open chats"; + kmDebug() << "Closing all open chats"; #endif // Allow performing last operations to all open chats and delete them @@ -1409,7 +1415,7 @@ bool ChatWindow::queryExit() // Always accept this one, otherwise the chat window won't close. // The quit is presented in KMessApplication::slotLastWindowClosed() too. #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Accepting exit request."; + kmDebug() << "Accepting exit request."; #endif return true; @@ -1539,7 +1545,7 @@ void ChatWindow::sendInk() // was enabled... if( ! supportGifInk && ! supportIsfInk ) { - kWarning() << "Neither Ink formats are supported by the participants!"; + kmWarning() << "Neither Ink formats are supported by the participants!"; currentChat->showMessage( ChatMessage( ChatMessage::TYPE_SYSTEM, ChatMessage::CONTENT_SYSTEM_ERROR, @@ -1558,7 +1564,7 @@ void ChatWindow::sendInk() if( supportIsfInk ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Retrieving ISF ink data"; + kmDebug() << "Retrieving ISF ink data"; #endif format = FORMAT_ISF; @@ -1567,7 +1573,7 @@ void ChatWindow::sendInk() else if( supportGifInk && Isf::Stream::supportsGif() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Retrieving GIF ink data"; + kmDebug() << "Retrieving GIF ink data"; #endif format = FORMAT_GIF; @@ -1577,7 +1583,7 @@ void ChatWindow::sendInk() if( ink.isEmpty() ) { - kWarning() << "An error occured while creating the" << ( supportIsfInk ? "ISF" : "GIF" ) << "Ink data!"; + kmWarning() << "An error occured while creating the" << ( supportIsfInk ? "ISF" : "GIF" ) << "Ink data!"; currentChat->showMessage( ChatMessage( ChatMessage::TYPE_SYSTEM, ChatMessage::CONTENT_SYSTEM_ERROR, @@ -1913,7 +1919,7 @@ void ChatWindow::showMenuBar() void ChatWindow::showStatusMessage( ChatStatusBar::MessageType type, QString message ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Showing status message" << message << "(" << type << ")"; + kmDebug() << "Showing status message" << message << "(" << type << ")"; #endif statusLabel_->setMessage( type, message ); } @@ -1927,7 +1933,7 @@ void ChatWindow::showStatusMessage( QString message, int duration ) message = message.replace( "\n", " " ); #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Showing status bar text" << message << "with duration" << duration; + kmDebug() << "Showing status bar text" << message << "with duration" << duration; #endif // HACK: Empty strings are not rendered, and any previously set text is not removed. @@ -1951,7 +1957,7 @@ void ChatWindow::showStatusMessage( QString message, int duration ) } #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Setting status bar update timer to" << duration << "sec."; + kmDebug() << "Setting status bar update timer to" << duration << "sec."; #endif statusTimer_.start( duration * 1000 ); } @@ -2069,7 +2075,7 @@ void ChatWindow::slotGotNudge() if( lastShake_.secsTo( QTime::currentTime() ) < 15 ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Not shaking the window until" + kmDebug() << "Not shaking the window until" << lastShake_.secsTo( QTime::currentTime() ) << "more seconds."; #endif return; @@ -2116,13 +2122,13 @@ void ChatWindow::slotGotTypingMessage( Chat *chat ) { chat = getCurrentChat(); #ifdef KMESSDEBUG_CHATWINDOW_TYPING_MESSAGES - kDebug() << "Using current chat" << chat; + kmDebug() << "Using current chat" << chat; #endif } #ifdef KMESSDEBUG_CHATWINDOW_TYPING_MESSAGES else { - kDebug() << "Using chat:" << chat; + kmDebug() << "Using chat:" << chat; } #endif @@ -2131,7 +2137,7 @@ void ChatWindow::slotGotTypingMessage( Chat *chat ) const QStringList typingContacts( chat->getTypingContacts() ); #ifdef KMESSDEBUG_CHATWINDOW_TYPING_MESSAGES - kDebug() << "These contacts are typing:" << typingContacts; + kmDebug() << "These contacts are typing:" << typingContacts; #endif // Update the color of this chat's tab @@ -2156,7 +2162,7 @@ void ChatWindow::slotGotTypingMessage( Chat *chat ) if( chat != getCurrentChat() ) { #ifdef KMESSDEBUG_CHATWINDOW_TYPING_MESSAGES - kDebug() << "Typing message was not for the active chat, skipping status bar update."; + kmDebug() << "Typing message was not for the active chat, skipping status bar update."; #endif return; } @@ -2165,7 +2171,7 @@ void ChatWindow::slotGotTypingMessage( Chat *chat ) if( typingContacts.isEmpty() ) { #ifdef KMESSDEBUG_CHATWINDOW_TYPING_MESSAGES - kDebug() << "No contacts are typing anymore, cleaning up the status bar."; + kmDebug() << "No contacts are typing anymore, cleaning up the status bar."; #endif showStatusMessage(); return; @@ -2312,6 +2318,53 @@ void ChatWindow::slotSendButtonClicked() + +// Show the chat history for a contact +void ChatWindow::slotShowChatHistory() +{ + const KAction* action = qobject_cast< const KAction* >( sender() ); + + if( ! action ) + { +#ifdef KMESSDEBUG_CHATWINDOW + kmWarning() << "Called directly, action is not valid!"; +#endif + return; + } + + // The click came from the menu item itself, not from a sub item. + // Select the first contact of the list + if( action == historyMenuAction_ ) + { + if( historyMenuAction_->children().isEmpty() ) + { +#ifdef KMESSDEBUG_CHATWINDOW + kmWarning() << "No contacts available in the menu!"; +#endif + return; + } + + action = qobject_cast< const KAction* >( historyMenuAction_->children().first() ); + KMESS_ASSERT( action ); + } + + const QString handle( action->data().toString() ); + + if( handle.isEmpty() ) + { +#ifdef KMESSDEBUG_CHATWINDOW + kmWarning() << "Action did not contain a valid handle! (contained a" << action->data().typeName() << " instead)"; +#endif + return; + } + + ChatHistoryDialog *dialog = new ChatHistoryDialog( this ); + dialog->setInitialContact( currentAccount_->getHandle(), handle ); + dialog->show(); +} + + + // Switch to the message editor, or another one void ChatWindow::slotSwitchEditor( QObject* widget ) { @@ -2321,7 +2374,7 @@ void ChatWindow::slotSwitchEditor( QObject* widget ) bool disableNewLineButton = true; #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Switching editors: caller:" << caller; + kmDebug() << "Switching editors: caller:" << caller; #endif // Some widgets are pretty high, hide them unless they're needed @@ -2338,7 +2391,7 @@ void ChatWindow::slotSwitchEditor( QObject* widget ) if( caller == winksButton_ && winksButton_->isChecked() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Switching to winks list."; + kmDebug() << "Switching to winks list."; #endif winksWidget_->refresh(); winksWidget_->show(); @@ -2357,7 +2410,7 @@ void ChatWindow::slotSwitchEditor( QObject* widget ) else if( caller == inkButton_ && inkButton_->isChecked() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Switching to ink editor."; + kmDebug() << "Switching to ink editor."; #endif inkCanvas_->show(); @@ -2378,7 +2431,7 @@ void ChatWindow::slotSwitchEditor( QObject* widget ) && standardEmoticonButton_->isChecked() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Switching to standard emoticons widget."; + kmDebug() << "Switching to standard emoticons widget."; #endif standardEmoticonsWidget_->show(); @@ -2395,7 +2448,7 @@ void ChatWindow::slotSwitchEditor( QObject* widget ) && customEmoticonButton_->isChecked() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Switching to custom emoticons widget."; + kmDebug() << "Switching to custom emoticons widget."; #endif customEmoticonsWidget_->show(); @@ -2410,7 +2463,7 @@ void ChatWindow::slotSwitchEditor( QObject* widget ) else // Otherwise, show the message editor { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Switching to the message editor."; + kmDebug() << "Switching to the message editor."; #endif editorChooser_->setCurrentWidget( textPage_ ); winksButton_->setChecked( false ); @@ -2428,7 +2481,7 @@ void ChatWindow::slotSwitchEditor( QObject* widget ) newLineButton_->setDisabled( disableNewLineButton ); // Also scroll down the chat, in all cases - getCurrentChat()->scrollToBottom(); + getCurrentChat()->scrollToBottom( false /* no forced scrolling */ ); } @@ -2490,7 +2543,7 @@ void ChatWindow::slotTabChanged( int currentIndex ) if( ! initialized_ ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Not switching tab while not initialized."; + kmDebug() << "Not switching tab while not initialized."; #endif return; } @@ -2500,11 +2553,11 @@ void ChatWindow::slotTabChanged( int currentIndex ) #ifdef KMESSDEBUG_CHATWINDOW if( currentIndex == -1 ) { - kDebug() << "The window is closing."; + kmDebug() << "The window is closing."; } else { - kDebug() << "Chat tab index" << currentIndex << "doesn't exist in the tabs list!"; + kmDebug() << "Chat tab index" << currentIndex << "doesn't exist in the tabs list!"; } #endif @@ -2519,14 +2572,14 @@ void ChatWindow::slotTabChanged( int currentIndex ) if( chat == 0 ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Chat tab" << currentIndex << "was destroyed"; + kmDebug() << "Chat tab" << currentIndex << "was destroyed"; #endif return; } #ifdef KMESSDEBUG_CHATWINDOW else { - kDebug() << "Activating chat tab" << currentIndex; + kmDebug() << "Activating chat tab" << currentIndex; } #endif @@ -2559,6 +2612,38 @@ void ChatWindow::slotTabChanged( int currentIndex ) updateModeButtons(); slotGotTypingMessage( chat ); + QAction* action; + qDeleteAll( historyMenuAction_->children() ); + + const QStringList participantsList( chat->getParticipants() ); + const QStringList contactsWithHistory( ChatHistoryManager::contactsList() ); + foreach( const QString &handle, participantsList ) + { + const ContactBase *contact = currentAccount_->getContactByHandle( handle ); + if( contact == 0 ) + { + contact = currentAccount_->addInvitedContact( handle ); + } + + action = new KAction( KIcon( MsnStatus::getIconName( contact->getStatus() ) ), + contact->getFriendlyName( STRING_CLEANED ), + historyMenuAction_ ); + action->setData( handle ); + + // Only connect the items whose contact has recorded history + if( contactsWithHistory.contains( handle ) ) + { + connect( action, SIGNAL( triggered(bool) ), + this, SLOT ( slotShowChatHistory() ) ); + } + else + { + action->setEnabled( false ); + } + + historyMenuAction_->addAction( action ); + } + // Re-enable the spell checker for this tab. // FIXME KDE4.x bug this needs to be unset then set messageEdit_->setCheckSpellingEnabled( ! spellCheckAction_->isChecked() ); @@ -2576,7 +2661,7 @@ bool ChatWindow::slotTabRemoved( Chat *chat ) int closedTabIndex = chatTabs_->indexOf( chat ); #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Removing chat with index" << closedTabIndex; + kmDebug() << "Removing chat with index" << closedTabIndex; #endif // Remove the tab of the closed chat @@ -2586,7 +2671,7 @@ bool ChatWindow::slotTabRemoved( Chat *chat ) chat->queryClose(); #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Removed tab index" << closedTabIndex; + kmDebug() << "Removed tab index" << closedTabIndex; #endif // Free the memory @@ -2608,8 +2693,8 @@ bool ChatWindow::slotTabRemoved( QWidget *chatWidget ) #endif #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Forwarding removal command for a chat widget."; - kDebug() << "Currently open chats:" << chatTabs_->count(); + kmDebug() << "Forwarding removal command for a chat widget."; + kmDebug() << "Currently open chats:" << chatTabs_->count(); #endif // Cast the Widget to Chat pointer @@ -2617,7 +2702,7 @@ bool ChatWindow::slotTabRemoved( QWidget *chatWidget ) if( chat == 0 ) { - kWarning() << "Unable to find chat for widget:" << chatWidget; + kmWarning() << "Unable to find chat for widget:" << chatWidget; return false; } @@ -2642,7 +2727,7 @@ void ChatWindow::slotUpdateChatInfo( Chat *chat ) if( index == -1 ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Cannot find source chat!"; + kmDebug() << "Cannot find source chat!"; #endif return; } @@ -2695,7 +2780,7 @@ void ChatWindow::slotUpdateChatInfo( Chat *chat ) if ( chat == getCurrentChat() ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Source chat is the current one, updating UI."; + kmDebug() << "Source chat is the current one, updating UI."; #endif // Update the window title @@ -2738,7 +2823,7 @@ void ChatWindow::toggleSessionInfo( bool showSessionMessages ) void ChatWindow::toggleSpellCheck( bool useSpellCheck ) { #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Spell checking is now" << useSpellCheck; + kmDebug() << "Spell checking is now" << useSpellCheck; #endif // Sync the action with a manually set flag (ie in readProperties()) @@ -2802,7 +2887,7 @@ void ChatWindow::updateModeButtons() } #ifdef KMESSDEBUG_CHATWINDOW - kDebug() << "Winks/Ink button disabling check: all contacts support winks?" << enableWinksButton + kmDebug() << "Winks/Ink button disabling check: all contacts support winks?" << enableWinksButton << "and ink?" << enableInkButton; #endif diff --git a/src/chat/chatwindow.h b/src/chat/chatwindow.h index 7bb8e1a..01134c7 100644 --- a/src/chat/chatwindow.h +++ b/src/chat/chatwindow.h @@ -186,6 +186,8 @@ class ChatWindow : public KXmlGuiWindow, private Ui::ChatWindow void slotSwitchToRightTab(); // The user pressed return in the message editor, so send the message void slotSendButtonClicked(); + // Show the chat history for a contact + void slotShowChatHistory(); // Switch to the message editor, or another one void slotSwitchEditor( QObject* widget = 0 ); // The active tab was changed @@ -244,6 +246,8 @@ class ChatWindow : public KXmlGuiWindow, private Ui::ChatWindow KAction *emoticonAction_; // The first item in the Chat Menu (used to add the Invite menu before it) QAction *firstChatMenuItem_; + // The menu containing contacts chat history actions + KActionMenu *historyMenuAction_; // Index for quick-retype int indexSentences_; // Whether or not the object was initialized diff --git a/src/chat/chatwindowui.rc b/src/chat/chatwindowui.rc index 5904d18..0cb9a3d 100644 --- a/src/chat/chatwindowui.rc +++ b/src/chat/chatwindowui.rc @@ -1,5 +1,5 @@ - + &Chat @@ -8,6 +8,8 @@ + + @@ -35,6 +37,8 @@ + + diff --git a/src/chat/contactframe.cpp b/src/chat/contactframe.cpp index 768c446..5cc0c07 100644 --- a/src/chat/contactframe.cpp +++ b/src/chat/contactframe.cpp @@ -20,6 +20,7 @@ #include "../contact/contact.h" #include "../contact/contactextension.h" #include "../contact/msnstatus.h" +#include "../dialogs/chathistorydialog.h" #include "../dialogs/contactpropertiesdialog.h" #include "../model/contactlist.h" #include "../utils/kmessshared.h" @@ -27,6 +28,7 @@ #include "../currentaccount.h" #include "../emoticonmanager.h" #include "../kmessdebug.h" +#include "chathistorymanager.h" // HACK: Must go after 2.0-final #include "../network/msnnotificationconnection.h" @@ -104,7 +106,7 @@ void ContactFrame::activate( ContactBase *contact ) if( contact == 0 ) { #ifdef KMESSDEBUG_CONTACTFRAME - kDebug() << "Deactivating frame for contact:" << handle_; + kmDebug() << "Deactivating frame for contact:" << handle_; #endif contact_ = 0; @@ -194,11 +196,11 @@ void ContactFrame::contactDestroyed( QObject *object ) #ifdef KMESSDEBUG_CONTACTFRAME if( contact_ && contact_ != object ) { - kWarning() << "Received unexpected contact reference to" << object->metaObject()->className(); + kmWarning() << "Received unexpected contact reference to" << object->metaObject()->className(); } else { - kDebug() << "Resetting contact reference."; + kmDebug() << "Resetting contact reference."; } #else Q_UNUSED( object ); @@ -300,7 +302,7 @@ bool ContactFrame::eventFilter( QObject *obj, QEvent *event ) if( mimeUrl.isEmpty() ) { - kWarning() << "Dropped empty MIME URL"; + kmWarning() << "Dropped empty MIME URL"; return true; } @@ -308,7 +310,7 @@ bool ContactFrame::eventFilter( QObject *obj, QEvent *event ) if( ! pictureData.load( filePath ) ) { - kWarning() << "The file dropped is not an image or doesn't exist"; + kmWarning() << "The file dropped is not an image or doesn't exist"; return true; } @@ -351,11 +353,11 @@ bool ContactFrame::initContactPopup() } // Initialize context popup actions - popupStartPrivateChat_ = new KAction( KIcon("user-group-new"), i18n("&Start Private Chat"), this); - popupEmailContact_ = new KAction( KIcon("mail-message-new"), i18n("&Send Email"), this ); - popupMsnProfile_ = new KAction( KIcon("preferences-desktop-user"), i18n("&View Profile"), this ); - //popupEditNotes_ = new KAction( KIcon("user-properties"), i18n("Ed&it Notes"), this ); - popupContactProperties_ = new KAction( KIcon("user-properties"), i18n("&Properties"), this ); + popupStartPrivateChat_ = new KAction( KIcon("user-group-new"), i18n("&Start Private Chat"), this ); + popupEmailContact_ = new KAction( KIcon("mail-message-new"), i18n("&Send Email"), this ); + popupShowHistory_ = new KAction( KIcon("chronometer"), i18n("Chat &History"), this ); + popupMsnProfile_ = new KAction( KIcon("preferences-desktop-user"), i18n("&View Profile"), this ); + popupContactProperties_ = new KAction( KIcon("user-properties"), i18n("&Properties"), this ); popupAddContact_ = new KAction( KIcon("list-add"), i18n("&Add Contact"), this ); popupAllowContact_ = new KAction( KIcon("dialog-ok-apply"), i18n("A&llow Contact"), this ); @@ -379,9 +381,8 @@ bool ContactFrame::initContactPopup() connect( popupStartPrivateChat_, SIGNAL(triggered( bool )), this, SLOT( slotStartPrivateChat() ) ); connect( popupEmailContact_, SIGNAL(triggered(bool)), this, SLOT( sendEmail() ) ); + connect( popupShowHistory_, SIGNAL(triggered(bool)), this, SLOT( showChatHistory() ) ); connect( popupMsnProfile_, SIGNAL(triggered(bool)), this, SLOT( showProfile() ) ); - //connect( popupEditNotes_, SIGNAL(triggered(bool)), this, SLOT( showContactProperties() ) ); - //connect( popupContactProperties_, SIGNAL(triggered(bool)), this, SLOT( showContactProperties() ) ); connect( popupAddContact_, SIGNAL(triggered(bool)), this, SLOT( toggleContactAdded() ) ); connect( popupAllowContact_, SIGNAL(triggered(bool)), this, SLOT( allowContact() ) ); @@ -422,9 +423,9 @@ bool ContactFrame::initContactPopup() contactActionPopup_->addTitle( contact_->getHandle() ); contactActionPopup_->addAction( popupStartPrivateChat_ ); contactActionPopup_->addAction( popupEmailContact_ ); + contactActionPopup_->addAction( popupShowHistory_ ); contactActionPopup_->addAction( popupMsnProfile_ ); contactActionPopup_->addAction( popupCopyMenu_ ); - //contactActionPopup_->addAction( popupEditNotes_ ); contactActionPopup_->addSeparator(); contactActionPopup_->addAction( popupAddContact_ ); @@ -477,7 +478,7 @@ void ContactFrame::setDisplayMode( DisplayMode mode ) currentMode_ = mode; #ifdef KMESSDEBUG_CONTACTFRAME - kDebug() << "Frame mode:" << mode; + kmDebug() << "Frame mode:" << mode; #endif // Change the displayed widgets @@ -522,6 +523,16 @@ void ContactFrame::setEnabled( bool isEnabled ) +// Show the contact's chat history +void ContactFrame::showChatHistory() +{ + ChatHistoryDialog *dialog = new ChatHistoryDialog( this ); + dialog->setInitialContact( CurrentAccount::instance()->getHandle(), handle_ ); + dialog->show(); +} + + + // Update and show the contact popup menu void ContactFrame::showContactPopup( const QPoint &point ) { @@ -582,7 +593,8 @@ void ContactFrame::showContactPopup( const QPoint &point ) } } - //popupEditNotes_ ->setVisible( detailedContact_ != 0 ); + popupShowHistory_ ->setEnabled( ChatHistoryManager::contactsList().contains( handle_ ) ); + popupContactProperties_ ->setVisible( detailedContact_ != 0 ); popupMsnProfile_ ->setVisible( detailedContact_ != 0 ); @@ -610,16 +622,9 @@ void ContactFrame::showContactProperties() // Default is not to open notes tab ContactPropertiesDialog::DefaultTab defaultTab = ContactPropertiesDialog::Information; - // If we've been called via the edit notes action, open that tab - if( sender() == popupEditNotes_ ) - { - defaultTab = ContactPropertiesDialog::Notes; - } - else if( sender() == popupPropImages_ ) - { - defaultTab = ContactPropertiesDialog::Images; - } - else if( sender() == popupPropEmoticons_ ) + // If we've been called via a specialized properties action, + // open the corresponding tab + if( sender() == popupPropEmoticons_ ) { defaultTab = ContactPropertiesDialog::Emoticons; } @@ -752,13 +757,13 @@ void ContactFrame::updatePicture() && contactPictureDate == contactPictureDate_ ) { #ifdef KMESSDEBUG_CONTACTFRAME - kDebug() << "Picture was already loaded."; + kmDebug() << "Picture was already loaded."; #endif return; } #ifdef KMESSDEBUG_CONTACTFRAME - kDebug() << "New contact picture:" << contactPicturePath; + kmDebug() << "New contact picture:" << contactPicturePath; #endif QImage contactImage( contactPicturePath ); diff --git a/src/chat/contactframe.h b/src/chat/contactframe.h index 0e8e3d4..2263b56 100644 --- a/src/chat/contactframe.h +++ b/src/chat/contactframe.h @@ -93,6 +93,8 @@ class ContactFrame : public QWidget, private Ui::ContactFrame void copyText(); // Email the contact void sendEmail(); + // Show the contact's chat history + void showChatHistory(); // Update and show the contact popup menu void showContactPopup( const QPoint &point ); // Show the contact properties window @@ -161,14 +163,14 @@ class ContactFrame : public QWidget, private Ui::ContactFrame KAction *popupCopyLink_; // Contact popup KAction to copy contact's media message KAction *popupCopyMusic_; - // Contact popup KAction to edit notes - KAction *popupEditNotes_; // Contact popup KAction to send an email to the contact KAction *popupEmailContact_; // Contact popup KAction to show the contact's profile KAction *popupMsnProfile_; // Contact popup KAction to remove a contact from the contact list KAction *popupRemoveContact_; + // Contact popup KAction to show a contact's chat history (if any) + KAction *popupShowHistory_; // Contact popup KAction to start a private chat with the contact while the user is in a multi-chat KAction *popupStartPrivateChat_; // Contact popup KAction to unblock the contact diff --git a/src/chat/contactswidget.cpp b/src/chat/contactswidget.cpp index 32085c4..a8c72ff 100644 --- a/src/chat/contactswidget.cpp +++ b/src/chat/contactswidget.cpp @@ -71,7 +71,7 @@ ContactsWidget::~ContactsWidget() contactFrames_.clear(); #ifdef KMESSDEBUG_CONTACTSWIDGET - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -105,7 +105,7 @@ void ContactsWidget::contactJoined( ContactBase* contact ) } #ifdef KMESSDEBUG_CONTACTSWIDGET - kDebug() << handle; + kmDebug() << handle; #endif ContactFrame::DisplayMode frameMode; @@ -141,7 +141,7 @@ void ContactsWidget::contactLeft( ContactBase *contact, bool /*isChatIdle*/ ) } #ifdef KMESSDEBUG_CONTACTSWIDGET - kDebug() << handle; + kmDebug() << handle; #endif @@ -204,7 +204,7 @@ bool ContactsWidget::eventFilter( QObject *obj, QEvent *event ) if( obj != userPixmapLabel_ ) { #ifdef KMESSDEBUG_CONTACTSWIDGET - kWarning() << "Received event '" << eventType << "' from object '" << obj->objectName() << "'."; + kmWarning() << "Received event '" << eventType << "' from object '" << obj->objectName() << "'."; #endif return false; } @@ -280,7 +280,7 @@ bool ContactsWidget::eventFilter( QObject *obj, QEvent *event ) if( mimeUrl.isEmpty() ) { - kWarning() << "Dropped empty MIME URL"; + kmWarning() << "Dropped empty MIME URL"; return true; } @@ -304,7 +304,7 @@ bool ContactsWidget::eventFilter( QObject *obj, QEvent *event ) if( ! pictureData.load( localFilePath ) ) { - kWarning() << "The file dropped is not an image or doesn't exist"; + kmWarning() << "The file dropped is not an image or doesn't exist"; return true; } @@ -346,7 +346,7 @@ bool ContactsWidget::eventFilter( QObject *obj, QEvent *event ) { if( ! pictureFolder.rename( tempPictureFile, pictureName ) ) { - kWarning() << "The display picture file could not be renamed from" << tempPictureFile << "to" << pictureName << "."; + kmWarning() << "The display picture file could not be renamed from" << tempPictureFile << "to" << pictureName << "."; return true; } } @@ -510,7 +510,7 @@ void ContactsWidget::setDockWidget( QDockWidget *dockWidget, Qt::DockWidgetArea void ContactsWidget::slotLocationChanged( Qt::DockWidgetArea area ) { #ifdef KMESSDEBUG_CONTACTSWIDGET - kDebug() << "Changing location to" << area; + kmDebug() << "Changing location to" << area; #endif switch( area ) @@ -589,7 +589,7 @@ void ContactsWidget::slotUpdateDisplayPicture() if( ! isVisible ) { #ifdef KMESSDEBUG_CONTACTSWIDGET - kDebug() << "Not updating hidden user picture widget"; + kmDebug() << "Not updating hidden user picture widget"; #endif return; } @@ -599,13 +599,13 @@ void ContactsWidget::slotUpdateDisplayPicture() if( userPixmapLabel_->property( "PictureFileName" ) == pictureFileName ) { #ifdef KMESSDEBUG_CONTACTSWIDGET - kDebug() << "User picture unchanged, not updating widget"; + kmDebug() << "User picture unchanged, not updating widget"; #endif return; } #ifdef KMESSDEBUG_CONTACTSWIDGET - kDebug() << "Updating user picture widget"; + kmDebug() << "Updating user picture widget"; #endif // Change the picture diff --git a/src/chat/emoticonswidget.cpp b/src/chat/emoticonswidget.cpp index d578a0f..8837b32 100644 --- a/src/chat/emoticonswidget.cpp +++ b/src/chat/emoticonswidget.cpp @@ -112,7 +112,7 @@ void EmoticonsWidget::slotRequestPreview( const QListWidgetItem *item ) { if( ! initialized_ ) { - kWarning() << "Uninitialized usage of EmoticonsWidget!"; + kmWarning() << "Uninitialized usage of EmoticonsWidget!"; return; } @@ -233,7 +233,7 @@ void EmoticonsWidget::slotItemClicked( const QListWidgetItem * item ) { if( ! initialized_ ) { - kWarning() << "Uninitialized usage of EmoticonsWidget!"; + kmWarning() << "Uninitialized usage of EmoticonsWidget!"; return; } @@ -258,19 +258,19 @@ void EmoticonsWidget::slotThemeUpdated() { if( ! initialized_ ) { - kWarning() << "Uninitialized usage of EmoticonsWidget!"; + kmWarning() << "Uninitialized usage of EmoticonsWidget!"; return; } #ifdef KMESSDEBUG_EMOTICONSWIDGET - kDebug() << "Removing old theme."; + kmDebug() << "Removing old theme."; #endif // Clear list list_->clear(); #ifdef KMESSDEBUG_EMOTICONSWIDGET - kDebug() << "Updating with current emoticons."; + kmDebug() << "Updating with current emoticons."; #endif // Add all theme emoticons to the list @@ -306,7 +306,7 @@ void EmoticonsWidget::slotThemeUpdated() previewLabel_->hide(); #ifdef KMESSDEBUG_EMOTICONSWIDGET - kDebug() << "Custom emoticon theme is empty"; + kmDebug() << "Custom emoticon theme is empty"; #endif return; } @@ -338,7 +338,7 @@ void EmoticonsWidget::slotThemeUpdated() } #ifdef KMESSDEBUG_EMOTICONSWIDGET - kDebug() << "Updated total" << emoticons.count() << "emoticons"; + kmDebug() << "Updated total" << emoticons.count() << "emoticons"; #endif } @@ -349,7 +349,7 @@ void EmoticonsWidget::initialize( bool useCustomTheme ) { if( initialized_ ) { - kWarning() << "EmoticonsWidget is already initialized!"; + kmWarning() << "EmoticonsWidget is already initialized!"; return; } @@ -384,7 +384,7 @@ void EmoticonsWidget::setDockWidget( QDockWidget *dockWidget, Qt::DockWidgetArea void EmoticonsWidget::slotLocationChanged( Qt::DockWidgetArea area ) { #ifdef KMESSDEBUG_EMOTICONSWIDGET - kDebug() << "Changing location to" << area; + kmDebug() << "Changing location to" << area; #endif switch( area ) @@ -421,7 +421,7 @@ void EmoticonsWidget::showContextMenu( const QListWidgetItem *item, const QPoint { if( ! initialized_ ) { - kWarning() << "Uninitialized usage of EmoticonsWidget!"; + kmWarning() << "Uninitialized usage of EmoticonsWidget!"; return; } diff --git a/src/chat/winkswidget.cpp b/src/chat/winkswidget.cpp index cb91405..e8cfa84 100644 --- a/src/chat/winkswidget.cpp +++ b/src/chat/winkswidget.cpp @@ -102,7 +102,7 @@ void WinksWidget::refresh() list_->hide(); #ifdef KMESSDEBUG_WINKSWIDGET - kDebug() << "There are no winks"; + kmDebug() << "There are no winks"; #endif return; } @@ -192,7 +192,7 @@ WinksWidget::CABEXTRACTOR WinksWidget::getHtmlFromWink( const QString &filename, if( exitCode != 0 ) { const QByteArray errorOutput( cabextract.readAll() ); - kWarning().nospace() << "cabextract failed with the following output: " << errorOutput.trimmed(); + kmWarning().nospace() << "cabextract failed with the following output: " << errorOutput.trimmed(); return FAILED; } @@ -206,7 +206,7 @@ WinksWidget::CABEXTRACTOR WinksWidget::getHtmlFromWink( const QString &filename, // Open the file if( ! metaFile.open( QIODevice::ReadOnly ) ) { - kWarning() << "file could not be opened: " << metaFile.fileName() << "!"; + kmWarning() << "file could not be opened: " << metaFile.fileName() << "!"; return UNKNOW; } @@ -215,7 +215,7 @@ WinksWidget::CABEXTRACTOR WinksWidget::getHtmlFromWink( const QString &filename, QDomDocument xml; if( ! xml.setContent( &metaFile, true, &xmlErrorMessage ) ) { - kWarning() << "parsing of wink XML failed: " << xmlErrorMessage << "!"; + kmWarning() << "parsing of wink XML failed: " << xmlErrorMessage << "!"; return UNKNOW; } @@ -223,19 +223,19 @@ WinksWidget::CABEXTRACTOR WinksWidget::getHtmlFromWink( const QString &filename, const QDomElement packageNode( xml.namedItem("package").toElement() ); if( packageNode.isNull() ) { - kWarning() << "XML element /package not found!"; + kmWarning() << "XML element /package not found!"; return UNKNOW; } if( packageNode.attribute( "type" ) != "wink" ) { - kWarning() << "XML element /package/@type is not 'wink'!"; + kmWarning() << "XML element /package/@type is not 'wink'!"; return UNKNOW; } if( packageNode.attribute( "contenttype" ) != "D" ) { - kWarning() << "XML element /package/@contenttype is not 'D'!"; + kmWarning() << "XML element /package/@contenttype is not 'D'!"; } // Get the child nodes @@ -262,14 +262,14 @@ WinksWidget::CABEXTRACTOR WinksWidget::getHtmlFromWink( const QString &filename, } else { - kWarning() << "unknown wink element type: '" << type << "'!"; + kmWarning() << "unknown wink element type: '" << type << "'!"; } } } if( thumbnail.isEmpty() || animation.isEmpty() || animationType.isEmpty() ) { - kWarning() << "XML elements are missing, could not play wink!"; + kmWarning() << "XML elements are missing, could not play wink!"; return UNKNOW; } diff --git a/src/chat/xsltransformation.cpp b/src/chat/xsltransformation.cpp index 162c24c..1583a00 100644 --- a/src/chat/xsltransformation.cpp +++ b/src/chat/xsltransformation.cpp @@ -101,7 +101,7 @@ QString XslTransformation::convertXmlString( const QString &xml ) const sourceXmlDoc = xmlParseMemory( xmlCString.data(), xmlCString.length() ); if( sourceXmlDoc == 0 ) { - kWarning() << "could not parse the XML data."; + kmWarning() << "could not parse the XML data."; return QString::null; } @@ -109,7 +109,7 @@ QString XslTransformation::convertXmlString( const QString &xml ) const resultXmlDoc = xsltApplyStylesheet( styleSheet_, sourceXmlDoc, (const char**)xslParams_ ); if( resultXmlDoc == 0 ) { - kWarning() << "could not convert the XML data."; + kmWarning() << "could not convert the XML data."; goto cleanSource; } @@ -181,7 +181,7 @@ void XslTransformation::setStylesheet(const QString &xslFileName) xslFileName_ = xslFileName; #ifdef KMESSDEBUG_XSLTRANSFORMATION - kDebug() << "loading new style sheet '" << xslFileName << "'"; + kmDebug() << "loading new style sheet '" << xslFileName << "'"; #endif // Clean up previous stylesheet @@ -201,7 +201,7 @@ void XslTransformation::setStylesheet(const QString &xslFileName) QFile file(xslFileName); if( ! file.open(QIODevice::ReadOnly) ) { - kWarning() << "could not load '" << xslFileName << "'!"; + kmWarning() << "could not load '" << xslFileName << "'!"; return; } @@ -213,7 +213,7 @@ void XslTransformation::setStylesheet(const QString &xslFileName) xslDoc_ = xmlParseMemory( fileData.data(), fileData.size() ); if(xslDoc_ == 0) { - kWarning() << "could not parse XML from '" << xslFileName << "'!"; + kmWarning() << "could not parse XML from '" << xslFileName << "'!"; return; } @@ -238,7 +238,7 @@ void XslTransformation::setStylesheet(const QString &xslFileName) xmlNs *xslNs = xmlSearchNsByHref( xslDoc_, xslRoot, (xmlChar*) "http://www.w3.org/1999/XSL/Transform" ); if( xslNs == 0 ) { - kWarning() << "Could not find XSL namespace in chat style."; + kmWarning() << "Could not find XSL namespace in chat style."; } */ @@ -248,7 +248,7 @@ void XslTransformation::setStylesheet(const QString &xslFileName) xmlNs *kmessNs = xmlSearchNsByHref( xslDoc_, xslRoot, (xmlChar*) "http://www.kmess.org/xmlns/ChatStyles/v1/" ); if( xslNs == 0 || kmessNs == 0 ) { - kWarning() << "'xsl' and 'kmess' namespaces not found in '" + kmWarning() << "'xsl' and 'kmess' namespaces not found in '" << xslFileName << "' chat style, " << "chat style can't be translated." << endl; } @@ -263,14 +263,14 @@ void XslTransformation::setStylesheet(const QString &xslFileName) if( styleSheet_ == 0 || styleSheet_->errors != 0 ) { // Also happens when an fails - kWarning() << "could not parse XSL from '" << xslFileName << "'!"; + kmWarning() << "could not parse XSL from '" << xslFileName << "'!"; xmlFreeDoc( xslDoc_ ); xslDoc_ = 0; } #ifdef KMESSDEBUG_XSLTRANSFORMATION else { - kDebug() << "style sheet loaded."; + kmDebug() << "style sheet loaded."; } #endif @@ -385,7 +385,7 @@ void XslTransformation::updateXslTranslations( xmlNode *node, const xmlNs *xslNs } #ifdef KMESSDEBUG_XSLTRANSFORMATION - kDebug() << "translated node \"" << oldContent << "\"" + kmDebug() << "translated node \"" << oldContent << "\"" << " to \"" << content << "\" using i18n(\"" << oldContent.simplified() << "\")." << endl; #endif diff --git a/src/contact/contact.cpp b/src/contact/contact.cpp index e065bc6..cad7e8d 100644 --- a/src/contact/contact.cpp +++ b/src/contact/contact.cpp @@ -86,7 +86,7 @@ Contact::Contact( const QString& handle, const QString& friendlyName, int lists, Contact::~Contact() { #ifdef KMESSDEBUG_CONTACT_GENERAL - kDebug() << "DESTROYED. [handle=" << handle_ << "]"; + kmDebug() << "DESTROYED. [handle=" << handle_ << "]"; #endif delete extension_; @@ -101,13 +101,13 @@ void Contact::addGroupId(const QString &groupId) // Protect against invalid use, causes problems in KMessView. if( groupId.isEmpty() ) { - kWarning() << "Group-ID is empty (contact=" << handle_ << ")!"; + kmWarning() << "Group-ID is empty (contact=" << handle_ << ")!"; return; } // Check whether contact is already added to the group. if( groupIds_.contains(groupId) ) { - kWarning() << handle_ << " is already a member of group " << groupId << "."; + kmWarning() << handle_ << " is already a member of group " << groupId << "."; return; } @@ -115,7 +115,7 @@ void Contact::addGroupId(const QString &groupId) groupIds_.append(groupId); #ifdef KMESSDEBUG_CONTACT_GENERAL - kDebug() << "groups of " << handle_ << " are '" << groupIds_.join(",") << "'"; + kmDebug() << "groups of " << handle_ << " are '" << groupIds_.join(",") << "'"; #endif emit changedGroup(this); @@ -324,7 +324,7 @@ void Contact::loadMsnObject( QString msnObject ) if( msnObject.isEmpty() ) { #ifdef KMESSDEBUG_CONTACT_GENERAL - kDebug() << "Contact " << getHandle() << " - MSN Object Removed!"; + kmDebug() << "Contact " << getHandle() << " - MSN Object Removed!"; #endif delete msnObject_; @@ -347,7 +347,7 @@ void Contact::loadMsnObject( QString msnObject ) } #ifdef KMESSDEBUG_CONTACT_GENERAL - kDebug() << "Contact " << getHandle() << " - MSN Object Changed!"; + kmDebug() << "Contact " << getHandle() << " - MSN Object Changed!"; #endif msnObject_ = new MsnObject( msnObject ); @@ -412,12 +412,12 @@ void Contact::removeGroupId( const QString &groupId ) int removeCount = groupIds_.removeAll( groupId ); if(removeCount == 0) { - kWarning() << handle_ << " was not registered to group " << groupId << "."; + kmWarning() << handle_ << " was not registered to group " << groupId << "."; return; } #ifdef KMESSDEBUG_CONTACT_GENERAL - kDebug() << "groups of " << handle_ << " are '" << groupIds_.join(",") << "'"; + kmDebug() << "groups of " << handle_ << " are '" << groupIds_.join(",") << "'"; #endif emit changedGroup( this ); @@ -494,7 +494,7 @@ void Contact::setFriendlyName( QString newName ) { if( newName.isEmpty() ) { - kWarning() << "Not setting the friendly name of " << handle_ << " to an empty value (previously: " << friendlyName_.getCleaned() << ")"; + kmWarning() << "Not setting the friendly name of " << handle_ << " to an empty value (previously: " << friendlyName_.getCleaned() << ")"; return; } @@ -581,7 +581,7 @@ void Contact::setStatus( const Status newStatus, bool showBaloon ) status_ = newStatus; #ifdef KMESSDEBUG_CONTACT_GENERAL - kDebug() << "Contact " << handle_ << " went from " << MsnStatus::getCode( lastStatus_ ) + kmDebug() << "Contact " << handle_ << " went from " << MsnStatus::getCode( lastStatus_ ) << " to " << MsnStatus::getCode( status_ ) << "."; #endif @@ -592,7 +592,7 @@ void Contact::setStatus( const Status newStatus, bool showBaloon ) if( status_ == STATUS_OFFLINE && lastStatus_ != STATUS_OFFLINE ) { #ifdef KMESSDEBUG_CONTACT_GENERAL - kDebug() << "Contact went offline."; + kmDebug() << "Contact went offline."; #endif emit contactOffline( this, showBaloon ); } @@ -601,7 +601,7 @@ void Contact::setStatus( const Status newStatus, bool showBaloon ) { // showBaloon is here to avoid showing notification when we connect #ifdef KMESSDEBUG_CONTACT_GENERAL - kDebug() << "Contact went online."; + kmDebug() << "Contact went online."; #endif emit contactOnline( this, showBaloon ); } diff --git a/src/contact/contactbase.cpp b/src/contact/contactbase.cpp index 12c1331..be11a4f 100644 --- a/src/contact/contactbase.cpp +++ b/src/contact/contactbase.cpp @@ -62,7 +62,7 @@ ContactBase::~ContactBase() void ContactBase::addEmoticonDefinition(const QString &emoticonCode, const QString &msnObjectDataHash ) { #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "adding '" << emoticonCode << "' to pending replacements"; + kmDebug() << "adding '" << emoticonCode << "' to pending replacements"; #endif // Escape the code so the HTML parser won't be fooled. @@ -84,7 +84,7 @@ void ContactBase::addEmoticonFile(const QString &msnObjectDataHash, const QStrin // Check whether the mapping is available. if( ! pendingEmoticons_.contains(msnObjectDataHash) ) { - kWarning() << "Received an custom emoticon, but no emoticon code found!"; + kmWarning() << "Received an custom emoticon, but no emoticon code found!"; return; } @@ -93,24 +93,24 @@ void ContactBase::addEmoticonFile(const QString &msnObjectDataHash, const QStrin pendingEmoticons_.remove(msnObjectDataHash); #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "linking '" << emoticonCode << "' to received file."; + kmDebug() << "linking '" << emoticonCode << "' to received file."; #endif // Check if filename exists, attempt to read it. if( ! QFile::exists(filename) ) { - kWarning() << "Could not read emoticon file: file not found!"; + kmWarning() << "Could not read emoticon file: file not found!"; return; } QImage emoticonData(filename); if( emoticonData.isNull() ) { - kWarning() << "Could not read emoticon file!"; + kmWarning() << "Could not read emoticon file!"; return; } #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "Setting image for '" << emoticonCode << " to " << filename; + kmDebug() << "Setting image for '" << emoticonCode << " to " << filename; #endif // Escape the code to insert it safely into a regular expression @@ -171,12 +171,12 @@ void ContactBase::addEmoticonFile(const QString &msnObjectDataHash, const QStrin void ContactBase::addSwitchboardConnection( const MsnSwitchboardConnection *connection ) { #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "adding connection to list."; + kmDebug() << "adding connection to list."; #endif if( chatSessions_.contains(connection) ) { - kWarning() << "chat session is already added."; + kmWarning() << "chat session is already added."; return; } @@ -190,7 +190,7 @@ ApplicationList * ContactBase::createApplicationList() { if( applicationList_ != 0 ) { - kWarning() << "application list already created for contact '" << handle_ << "'."; + kmWarning() << "application list already created for contact '" << handle_ << "'."; } else { @@ -232,7 +232,7 @@ void ContactBase::detectClientName( uint capabilities, const MsnObject *msnObjec case MSN_CAP_MSN90beta: msnVersion = 9.0f; suffix = " beta"; break; // default caps 0x963CC03C: case MSN_CAP_MSN2009: msnVersion = 2009.0f; break; default: - kWarning() << "Unable to parse the WLM version of for the contact" << handle_ << ", msncversion=" << ( clientVersion >> 28 ) << " capabilities=" << capabilities; + kmWarning() << "Unable to parse the WLM version of for the contact" << handle_ << ", msncversion=" << ( clientVersion >> 28 ) << " capabilities=" << capabilities; msnVersion = 9999999; } @@ -274,7 +274,7 @@ void ContactBase::detectClientName( uint capabilities, const MsnObject *msnObjec else { #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "NOTICE: Unknown client name in MsnObject location:" << pictureLocation; + kmDebug() << "NOTICE: Unknown client name in MsnObject location:" << pictureLocation; #endif } } @@ -395,7 +395,7 @@ void ContactBase::detectClientName( uint capabilities, const MsnObject *msnObjec if( capabilities & MSN_CAP_LIVE_SPACE ) caps << "has-space"; // 0x1000 if( capabilities & MSN_CAP_ONECARE ) caps << "has-onecare"; // 0x1000000 - kDebug() << "contact" << getHandle() << "uses client:" << clientName_ << "msn version:" << msnVersion << "capabilities:" << capabilities << caps; + kmDebug() << "contact" << getHandle() << "uses client:" << clientName_ << "msn version:" << msnVersion << "capabilities:" << capabilities << caps; } #endif } @@ -619,19 +619,19 @@ bool ContactBase::manageEmoticonBlackList( bool add, const QString &emoticonCode void ContactBase::removeSwitchboardConnection( const MsnSwitchboardConnection *connection, bool userInitiated ) { #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "removing connection, userInitiated=" << userInitiated; + kmDebug() << "removing connection, userInitiated=" << userInitiated; #endif bool found = chatSessions_.removeAll( connection ) > 0; if( ! found ) { - kWarning() << "chat session not found."; + kmWarning() << "chat session not found."; } if( chatSessions_.isEmpty() ) { #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << handle_ << " is no longer in any other chat conversation, cleaning up."; + kmDebug() << handle_ << " is no longer in any other chat conversation, cleaning up."; #endif // Inform the ApplicationList if we have one. @@ -647,7 +647,7 @@ void ContactBase::removeSwitchboardConnection( const MsnSwitchboardConnection *c if( ! hasAbortingApps && applicationList_ != 0 && ! applicationList_->hasAuthorizedDirectConnection() ) { #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "no applications to abort, deleting ApplicationList object."; + kmDebug() << "no applications to abort, deleting ApplicationList object."; #endif delete applicationList_; @@ -674,7 +674,7 @@ void ContactBase::setCapabilities( uint capabilities ) if( clientChanged && capabilities > 0 ) { #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "capabilities of" << handle_ << "changed from" << capabilities_ << "to" << capabilities << ", resetting detected app name."; + kmDebug() << "capabilities of" << handle_ << "changed from" << capabilities_ << "to" << capabilities << ", resetting detected app name."; #endif clientName_.clear(); @@ -718,13 +718,13 @@ void ContactBase::slotApplicationListAborted() if( ! applicationList_->isEmpty() || applicationList_->hasAuthorizedDirectConnection() ) { #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "requested abortion completed, but ApplicationList object has object references: not deleting object."; + kmDebug() << "requested abortion completed, but ApplicationList object has object references: not deleting object."; #endif return; } #ifdef KMESSDEBUG_CONTACTBASE - kDebug() << "requested abortion completed, deleting ApplicationList object."; + kmDebug() << "requested abortion completed, deleting ApplicationList object."; #endif diff --git a/src/contact/contactextension.cpp b/src/contact/contactextension.cpp index b53e145..d13d0db 100644 --- a/src/contact/contactextension.cpp +++ b/src/contact/contactextension.cpp @@ -212,11 +212,11 @@ void ContactExtension::saveProperties( KConfigGroup &config ) #ifdef KMESSDEBUG_CONTACTEXTENSION if( extensionGroup.hasGroup( "Extension" ) ) { - kDebug() << "Deleting unused contact info for" << handle_; + kmDebug() << "Deleting unused contact info for" << handle_; } else { - kDebug() << "Not saving unused contact info for" << handle_; + kmDebug() << "Not saving unused contact info for" << handle_; } #endif diff --git a/src/contact/group.cpp b/src/contact/group.cpp index f1ca9c8..21be63a 100644 --- a/src/contact/group.cpp +++ b/src/contact/group.cpp @@ -45,7 +45,7 @@ Group::Group(const QString &id, const QString &name) Group::~Group() { #ifdef KMESSDEBUG_GROUP - kDebug() << "DESTROYED. [handle=" << name_ << ", id=" << id_ << "]"; + kmDebug() << "DESTROYED. [handle=" << name_ << ", id=" << id_ << "]"; #endif } @@ -117,7 +117,7 @@ void Group::readProperties( const KConfigGroup &config ) } #ifdef KMESSDEBUG_GROUP - kDebug() << "Read sort position for group " << name_ << "=" << sortPosition_; + kmDebug() << "Read sort position for group " << name_ << "=" << sortPosition_; #endif // Is the group expanded? that is, can the user see the group's contacts? @@ -163,7 +163,7 @@ void Group::setName( const QString &newName ) void Group::setSortPosition( int sortPosition, bool signal ) { #ifdef KMESSDEBUG_GROUP - kDebug() << "Group " << name_ << " old sort position = " << sortPosition_ + kmDebug() << "Group " << name_ << " old sort position = " << sortPosition_ << "new sort position = " << sortPosition; #endif diff --git a/src/contact/invitedcontact.cpp b/src/contact/invitedcontact.cpp index 3165840..14c7c33 100644 --- a/src/contact/invitedcontact.cpp +++ b/src/contact/invitedcontact.cpp @@ -34,7 +34,7 @@ InvitedContact::InvitedContact( const QString &handle, const QString &friendlyNa InvitedContact::~InvitedContact() { #ifdef KMESSDEBUG_INVITEDCONTACT - kDebug() << "DESTROYED. [" << getHandle() << "]"; + kmDebug() << "DESTROYED. [" << getHandle() << "]"; #endif } diff --git a/src/contact/msnobject.cpp b/src/contact/msnobject.cpp index 95b41d7..a12c404 100644 --- a/src/contact/msnobject.cpp +++ b/src/contact/msnobject.cpp @@ -40,7 +40,7 @@ MsnObject::MsnObject(const QString &object) { if( object.isEmpty() ) { - kWarning() << "passed object is empty."; + kmWarning() << "passed object is empty."; return; } @@ -212,7 +212,7 @@ bool MsnObject::verifyFile( const QString &fileName ) const QFile file( fileName ); if( ! file.open( QIODevice::ReadOnly ) ) { - kWarning() << "unable to open file '" << fileName << "'."; + kmWarning() << "unable to open file '" << fileName << "'."; return false; } diff --git a/src/contact/msnstatus.cpp b/src/contact/msnstatus.cpp index d41a830..0f076a5 100644 --- a/src/contact/msnstatus.cpp +++ b/src/contact/msnstatus.cpp @@ -81,7 +81,7 @@ QPixmap MsnStatus::getIcon( const Status status, const Flags flags ) break; default: - kWarning() << "Invalid status" << status << "!"; + kmWarning() << "Invalid status" << status << "!"; } // Choose the picture's overlay, if any. @@ -140,7 +140,7 @@ QString MsnStatus::getIconName( const Status status ) case STATUS_OFFLINE: return "user-offline"; default: - kWarning() << "Invalid status" << status << "!"; + kmWarning() << "Invalid status" << status << "!"; } return "user-online"; @@ -170,7 +170,7 @@ QString MsnStatus::getCode( const Status status ) case STATUS_ON_THE_PHONE: return QString( "PHN" ); case STATUS_OUT_TO_LUNCH: return QString( "LUN" ); default: - kWarning() << "Invalid status" << status << "!"; + kmWarning() << "Invalid status" << status << "!"; return QString( "NLN" ); } } @@ -200,7 +200,7 @@ QString MsnStatus::getName( const Status status ) case STATUS_OFFLINE: return i18n( "Offline" ); default: - kWarning() << "Invalid status" << status << "!"; + kmWarning() << "Invalid status" << status << "!"; return i18n( "Online" ); } } @@ -285,7 +285,7 @@ Status MsnStatus::codeToStatus( const QString &status ) else if( status == "PHN" ) return STATUS_ON_THE_PHONE; else { - kWarning() << "Invalid status" << status << "!"; + kmWarning() << "Invalid status" << status << "!"; return STATUS_ONLINE; } } diff --git a/src/currentaccount.cpp b/src/currentaccount.cpp index 22f9bca..76e8b89 100644 --- a/src/currentaccount.cpp +++ b/src/currentaccount.cpp @@ -52,7 +52,7 @@ CurrentAccount::CurrentAccount() CurrentAccount::~CurrentAccount() { #ifdef KMESSDEBUG_CURRENTACCOUNT - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif // Delete all remaining invited contacts @@ -69,7 +69,7 @@ CurrentAccount::~CurrentAccount() InvitedContact * CurrentAccount::addInvitedContact( const QString &handle, const QString &friendlyName, const uint capabilities ) { #ifdef KMESSDEBUG_CURRENTACCOUNT - kDebug() << handle; + kmDebug() << handle; #endif #ifdef KMESSTEST KMESS_ASSERT( ! handle.isEmpty() ); @@ -77,7 +77,7 @@ InvitedContact * CurrentAccount::addInvitedContact( const QString &handle, const if(getContactByHandle(handle) != 0) { - kWarning() << "attempted to add contact " << handle << " twice."; + kmWarning() << "attempted to add contact " << handle << " twice."; return 0; } @@ -444,7 +444,7 @@ void CurrentAccount::setStatus( Status status ) } #ifdef KMESSDEBUG_CURRENTACCOUNT - kDebug() << "Status set to " << MsnStatus::getCode( status_ ) << "."; + kmDebug() << "Status set to " << MsnStatus::getCode( status_ ) << "."; #endif emit changedStatus(); @@ -453,7 +453,7 @@ void CurrentAccount::setStatus( Status status ) if( status_ == STATUS_OFFLINE ) { #ifdef KMESSDEBUG_CURRENTACCOUNT - kDebug() << "Account went offline."; + kmDebug() << "Account went offline."; #endif emit accountOffline(); } @@ -461,7 +461,7 @@ void CurrentAccount::setStatus( Status status ) if( status == STATUS_INVISIBLE ) { #ifdef KMESSDEBUG_CURRENTACCOUNT - kDebug() << "Account went invisible."; + kmDebug() << "Account went invisible."; #endif emit accountInvisible(); } @@ -469,7 +469,7 @@ void CurrentAccount::setStatus( Status status ) else if( oldStatus == STATUS_OFFLINE || oldStatus == STATUS_INVISIBLE ) { #ifdef KMESSDEBUG_CURRENTACCOUNT - kDebug() << "Account went online."; + kmDebug() << "Account went online."; #endif emit accountOnline(); } @@ -490,14 +490,14 @@ void CurrentAccount::slotInvitedContactLeftAllChats( ContactBase *contact ) { if(KMESS_NULL(contact)) return; #ifdef KMESSDEBUG_CURRENTACCOUNT - kDebug() << "invited contact " << contact->getHandle() << " left all chats, delete contact."; + kmDebug() << "invited contact " << contact->getHandle() << " left all chats, delete contact."; #endif // Remove from list bool removed = invitedContacts_.removeAll( static_cast( contact ) ) > 0; if( ! removed ) { - kWarning() << "could not remove invited contact '" << contact->getHandle() << "' from the list!"; + kmWarning() << "could not remove invited contact '" << contact->getHandle() << "' from the list!"; } // Delete after all slots are processed. diff --git a/src/dialogs/addemoticondialog.cpp b/src/dialogs/addemoticondialog.cpp index aff7544..b9ee797 100644 --- a/src/dialogs/addemoticondialog.cpp +++ b/src/dialogs/addemoticondialog.cpp @@ -95,7 +95,7 @@ AddEmoticonDialog::~AddEmoticonDialog() delete movie_; #ifdef KMESSDEBUG_EMOTICONS_ADDING - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -168,7 +168,7 @@ void AddEmoticonDialog::interfaceChanged() // The chosen file is valid, update the preview. #ifdef KMESSDEBUG_EMOTICONS_ADDING - kDebug() << "Updated preview."; + kmDebug() << "Updated preview."; #endif emoticonPreview_->setMovie( movie_ ); @@ -179,7 +179,7 @@ void AddEmoticonDialog::interfaceChanged() // The chosen file is not valid, reset the preview to the KMess logo. #ifdef KMESSDEBUG_EMOTICONS_ADDING - kDebug() << "Resetting preview."; + kmDebug() << "Resetting preview."; #endif enable = false; @@ -270,7 +270,7 @@ void AddEmoticonDialog::slotButtonClicked( int button ) QString shortcut, pictureName; #ifdef KMESSDEBUG_EMOTICONS_ADDING - kDebug() << "OK button was pressed!"; + kmDebug() << "OK button was pressed!"; #endif shortcut = shortcutEdit_->text(); @@ -288,7 +288,7 @@ void AddEmoticonDialog::slotButtonClicked( int button ) if( format.isEmpty() || shortcut.isEmpty() ) { - kWarning() << "Shortcut or picture is not valid!"; + kmWarning() << "Shortcut or picture is not valid!"; return; } @@ -296,7 +296,7 @@ void AddEmoticonDialog::slotButtonClicked( int button ) if( theme_->contains( shortcut ) ) { #ifdef KMESSDEBUG_EMOTICONS_ADDING - kDebug() << "Asking for overwrite."; + kmDebug() << "Asking for overwrite."; #endif int result = KMessageBox::questionYesNo( this, @@ -319,7 +319,7 @@ void AddEmoticonDialog::slotButtonClicked( int button ) if( isEditing ) { #ifdef KMESSDEBUG_EMOTICONS_ADDING - kDebug() << "Editing emoticon: shortcut changed from " << preselectedShortcut_ << " to " << shortcut; + kmDebug() << "Editing emoticon: shortcut changed from " << preselectedShortcut_ << " to " << shortcut; #endif theme_->renameEmoticon( preselectedShortcut_, shortcut ); theme_->saveTheme(); @@ -344,19 +344,19 @@ void AddEmoticonDialog::slotButtonClicked( int button ) QFile newThemePicture( theme_->getThemePath() + pictureInfo.fileName() ); #ifdef KMESSDEBUG_EMOTICONS_ADDING - kDebug() << "Copying original picture" << pictureName << "to theme as" << newThemePicture.fileName(); + kmDebug() << "Copying original picture" << pictureName << "to theme as" << newThemePicture.fileName(); #endif // Open the two images if( ! originalPicture.open( QIODevice::ReadOnly ) ) { - kWarning() << "Couldn't open source file: " << originalPicture.fileName(); + kmWarning() << "Couldn't open source file: " << originalPicture.fileName(); return; } if( ! newThemePicture.open( QIODevice::WriteOnly ) ) { - kWarning() << "Couldn't open destination file: " << newThemePicture.fileName(); + kmWarning() << "Couldn't open destination file: " << newThemePicture.fileName(); return; } @@ -368,7 +368,7 @@ void AddEmoticonDialog::slotButtonClicked( int button ) // Quick validity check if( newThemePicture.size() != originalPicture.size() ) { - kWarning() << "File sizes do not match: " + kmWarning() << "File sizes do not match: " << originalPicture.fileName() << " (" << originalPicture.size() << ")" << " != " << newThemePicture.fileName() << " (" << newThemePicture.size() << ")" << endl; return; @@ -379,7 +379,7 @@ void AddEmoticonDialog::slotButtonClicked( int button ) // Save the loaded picture as a PNG image. #ifdef KMESSDEBUG_EMOTICONS_ADDING - kDebug() << "Recoding original picture" << pictureName << "(which format was" << format << ") to theme as" << pictureInfo.completeBaseName() << ".png"; + kmDebug() << "Recoding original picture" << pictureName << "(which format was" << format << ") to theme as" << pictureInfo.completeBaseName() << ".png"; #endif emoticonData.read().save( theme_->getThemePath() + pictureInfo.completeBaseName() + ".png", "png" ); @@ -387,7 +387,7 @@ void AddEmoticonDialog::slotButtonClicked( int button ) #ifdef KMESSDEBUG_EMOTICONS_ADDING - kDebug() << "Adding new emoticon: " << shortcut << "."; + kmDebug() << "Adding new emoticon: " << shortcut << "."; #endif // We've just created a file whose name is like "file.name.png", so give to the theme a name "file.name" so it can guess diff --git a/src/dialogs/chathistorydialog.cpp b/src/dialogs/chathistorydialog.cpp index dfc552e..46ef7c3 100644 --- a/src/dialogs/chathistorydialog.cpp +++ b/src/dialogs/chathistorydialog.cpp @@ -1,4 +1,4 @@ - /*************************************************************************** +/*************************************************************************** chathistorydialog.cpp - chat logs browser ------------------- begin : Sun Feb 22 2009 @@ -17,6 +17,7 @@ #include "chathistorydialog.h" +#include "../chat/chathistorymanager.h" #include "../chat/chatmessagestyle.h" #include "../chat/chatmessageview.h" #include "../utils/kmessconfig.h" @@ -28,12 +29,14 @@ #include "../kmessdebug.h" #include +#include #include #include #include #include #include #include +#include #include #include @@ -46,19 +49,15 @@ #ifdef KMESSDEBUG_CHATHISTORYDIALOG -// #define KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE + #define KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE #endif // Constructor ChatHistoryDialog::ChatHistoryDialog( QWidget *parent ) : KDialog( parent ) -, logParser_( 0 ) , model_( new QStandardItemModel( this ) ) , proxyModel_( new QSortFilterProxyModel( this ) ) -, reloadingLogs_( false ) -, reloadLogsTimer_( 0 ) -, historyAccount_( 0 ) { // Set up the dialog QWidget *mainWidget = new QWidget( this ); @@ -82,7 +81,7 @@ ChatHistoryDialog::ChatHistoryDialog( QWidget *parent ) chatView_->updateChatStyle(); chatView_->getStyle()->setAllowEmoticonLinks( false ); - rightSplitter_->addWidget( chatView_->widget() ); + frame_->layout()->addWidget( chatView_->widget() ); // Make the splitter assign more space to the view than to the controls, // and set its minimum size @@ -91,17 +90,11 @@ ChatHistoryDialog::ChatHistoryDialog( QWidget *parent ) chatView_->widget()->setMinimumSize( 300, 200 ); chatView_->widget()->setSizePolicy( sizePolicy ); - // When we are not connected, there is no set chat style. Use the default -// if( Account::connectedAccount == 0 ) - { -// chatView_->getStyle()->setStyle( "Fresh" ); - } - // Fill the accounts list - handleComboBox_->insertItems( 0, KMessConfig::instance()->getAccountsList() ); + accountComboBox_->insertItems( 0, KMessConfig::instance()->getAccountsList() ); // If no accounts are available, disable the dialog - if( handleComboBox_->count() == 0 ) + if( accountComboBox_->count() == 0 ) { mainWidget->setEnabled( false ); } @@ -114,62 +107,48 @@ ChatHistoryDialog::ChatHistoryDialog( QWidget *parent ) if( ! kmessApp->getContactListWindow()->isConnected() || CurrentAccount::instance()->isGuestAccount() ) { - const QString currentHandle( handleComboBox_->itemText( 0 ) ); - historyAccount_ = AccountsManager::instance()->getAccountByHandle( currentHandle ); - handleComboBox_->setCurrentItem( currentHandle ); + const QString ¤tHandle( accountComboBox_->itemText( 0 ) ); + accountComboBox_->setCurrentItem( currentHandle ); } else { - historyAccount_ = CurrentAccount::instance(); - handleComboBox_->setCurrentItem( historyAccount_->getHandle() ); + accountComboBox_->setCurrentItem( CurrentAccount::instance()->getHandle() ); } } - loadContactsList(); - // Initialize the model for the list of contacts proxyModel_->setSourceModel( model_ ); proxyModel_->setDynamicSortFilter( true ); proxyModel_->setFilterCaseSensitivity( Qt::CaseInsensitive ); - listView_->setModel( proxyModel_ ); + contactListView_->setModel( proxyModel_ ); - QItemSelectionModel *selectionModel = listView_->selectionModel(); + QItemSelectionModel *selectionModel = contactListView_->selectionModel(); // Attach the signals - connect( searchEdit_, SIGNAL( textChanged(const QString&) ), - proxyModel_, SLOT ( setFilterRegExp(const QString&) ) ); - connect( selectionModel, SIGNAL( currentChanged(const QModelIndex&,const QModelIndex&) ), - this, SLOT ( cacheContactXml(const QModelIndex&) ) ); - connect( dateRadio_, SIGNAL( toggled(bool) ), - this, SLOT ( reloadLogs() ) ); - connect( fromBox_, SIGNAL( toggled(bool) ), - this, SLOT ( reloadLogs() ) ); - connect( toBox_, SIGNAL( toggled(bool) ), - this, SLOT ( reloadLogs() ) ); - connect( fromDate_, SIGNAL( changed(const QDate&) ), - this, SLOT ( checkDates() ) ); - connect( toDate_, SIGNAL( changed(const QDate&) ), - this, SLOT ( checkDates() ) ); - connect( conversationRadio_, SIGNAL( toggled(bool) ), - this, SLOT ( reloadLogs() ) ); - connect( conversationComboBox_, SIGNAL( currentIndexChanged(int) ), - this, SLOT ( reloadLogs() ) ); - connect( handleComboBox_, SIGNAL( currentIndexChanged(int) ), - this, SLOT ( reloadHandle(int) ) ); - - // Register QDomElement as a meta type to allow the thread to send signals here - qRegisterMetaType( "QDomElement" ); + connect( searchEdit_, SIGNAL( textChanged(const QString&) ), + proxyModel_, SLOT ( setFilterRegExp(const QString&) ) ); + connect( selectionModel, SIGNAL( currentChanged(const QModelIndex&,const QModelIndex&) ), + this, SLOT ( showAvailableDates(const QModelIndex&) ) ); + connect( datePicker_, SIGNAL( activated(const QDate&) ), + this, SLOT ( showLogs(const QDate&) ) ); + connect( datePicker_, SIGNAL( clicked(const QDate&) ), + this, SLOT ( showLogs(const QDate&) ) ); + connect( accountComboBox_, SIGNAL( currentIndexChanged(int) ), + this, SLOT ( slotAccountChanged(int) ) ); // Save the dialog and splitters sizes KConfigGroup group = KMessConfig::instance()->getGlobalConfig( "ChatHistoryDialog" ); restoreDialogSize( group ); - mainSplitter_ ->setSizes( group.readEntry( "mainSplitterSizes", QList() << 1 << 100 ) ); - rightSplitter_->setSizes( group.readEntry( "rightSplitterSizes", QList() << 1 << 100 ) ); + splitter_ ->setSizes( group.readEntry( "mainSplitterSizes", QList() << 1 << 100 ) ); // Normally the focus would be set on the Search box, thus making the // preset explanation text to disappear. - listView_->setFocus(); + contactListView_->setFocus(); + + searchEdit_->setEnabled( false ); + contactListView_->setEnabled( false ); + datePicker_->setEnabled( false ); } @@ -180,69 +159,14 @@ ChatHistoryDialog::~ChatHistoryDialog() // Save the dialog and splitters size KConfigGroup group = KMessConfig::instance()->getGlobalConfig( "ChatHistoryDialog" ); saveDialogSize( group ); - group.writeEntry( "mainSplitterSizes", mainSplitter_ ->sizes() ); - group.writeEntry( "rightSplitterSizes", rightSplitter_->sizes() ); + group.writeEntry( "mainSplitterSizes", splitter_ ->sizes() ); } -// A conversation has been parsed by the thread -void ChatHistoryDialog::addConversation( int timestamp, const QDomElement &newConversation ) +// Show on which dates there are logged chats with a certain contact +void ChatHistoryDialog::showAvailableDates( const QModelIndex &index ) { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Adding new conversation on" << timestamp; -#endif - - QMutexLocker lock( &addConversationLock_ ); - const QDateTime &date = QDateTime::fromTime_t( timestamp ); - - // Add this conversation to the internal list - conversations_[ timestamp ] = newConversation; - - // Add the chat to the chat selection combo box, keeping it sorted by date (most recent first) - // The first item (index 0) is skipped as it is a temporary item ("Loading...") which - // should remain the first - int index; - for( index = 1; index < conversationComboBox_->count(); ++index ) - { - int currentTimestamp = conversationComboBox_->itemData( index, Qt::UserRole ).toUInt(); - - if( currentTimestamp < 1 ) - { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG - kWarning() << "Invalid timestamp!"; -#endif - continue; - } - - if( currentTimestamp <= timestamp ) - { - break; - } - } - - // Prevent the insertion from generating a signal which regenerates the logs - conversationComboBox_->blockSignals( true ); - conversationComboBox_->insertItem( index, - KGlobal::locale()->formatDateTime( date, KLocale::ShortDate ), - timestamp ); - conversationComboBox_->blockSignals( false ); - -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Added as item" << index; -#endif -} - - - -// Caches the XML for the selected contact. Makes things a lot faster -void ChatHistoryDialog::cacheContactXml( const QModelIndex &index ) -{ - if( historyAccount_ == 0 ) - { - return; - } - const QModelIndex contactIndex( proxyModel_->mapToSource( index ) ); if( ! contactIndex.isValid() ) { @@ -251,56 +175,29 @@ void ChatHistoryDialog::cacheContactXml( const QModelIndex &index ) // Initially the list view emits a currentChanged() signal, but the list // doesn't bother to highlight the selected item - listView_->setCurrentIndex( index ); + contactListView_->setCurrentIndex( index ); - // Reset the xml loading thread - if( logParser_ != 0 ) - { - logParser_->end(); - logParser_ = 0; - } - - // Reset the UI - xml_.clear(); - conversations_.clear(); + // Block the UI while we're loading setLoading( true ); - // Avoid reentering while we're still loading a contact's chats - listView_->setEnabled( false ); - - // Reset the cache - xml_.setContent( QByteArray( "" ) ); - QDomNode cachedConversations( xml_.firstChildElement( "conversations" ) ); const QString handle( model_->itemFromIndex( contactIndex )->text() ); - QDir logsDir( KMessConfig::instance()->getAccountDirectory( historyAccount_->getHandle() ) - + "/chatlogs" ); -#ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << "Loading conversations for contact:" << handle; -#endif + ChatHistoryManager::setHandle( handle ); + const ConversationList timestamps( ChatHistoryManager::timestamps() ); - // Filter only to read from this contact's files, if any - logsDir.setFilter( QDir::Files ); - logsDir.setNameFilters( QStringList() << ( handle + "*.xml" ) ); - - bool showDate = chatView_->getStyle()->getShowMessageDate(); - bool showTime = chatView_->getStyle()->getShowMessageTime(); - bool showSeconds = chatView_->getStyle()->getShowMessageSeconds(); - - const QFileInfoList &list = logsDir.entryInfoList(); - foreach( const QFileInfo &entry, list ) + switch( ChatHistoryManager::result() ) { - QString currentHandle( entry.fileName() ); + case ChatHistoryManager::RESULT_OK: + break; -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Reading conversations from file:" << entry.fileName(); -#endif - - QFile file( entry.absoluteFilePath() ); - - if( ! file.open( QFile::ReadOnly | QFile::Text ) ) + case ChatHistoryManager::RESULT_NON_EXISTING_DIRECTORY: + case ChatHistoryManager::RESULT_UNREADABLE_LOGS: { - // Very unlikely, but... +#ifdef KMESSDEBUG_CHATHISTORYDIALOG + kmDebug() << "Unable to read logs: error" << ChatHistoryManager::result(); +#endif + setLoading( false ); + QDir logsDir( KMessConfig::instance()->getAccountDirectory( ChatHistoryManager::account() ) + "/chatlogs" ); KMessageBox::error( this, i18nc( "Dialog box text", "There has been an error while opening your logs. This " "is commonly a permission problem, check if you have " @@ -308,312 +205,170 @@ void ChatHistoryDialog::cacheContactXml( const QModelIndex &index ) "Otherwise, your logs may be corrupted.", logsDir.absolutePath() ), i18nc( "Dialog box title", "Could not open chat history" ) ); - - setLoading( false ); return; } - if( logParser_ == 0 ) + default: + setLoading( false ); + kmWarning() << "Unexpected result from the chat history manager: code" << ChatHistoryManager::result(); + return; + } + + // Highlight the days where conversations were logged + QTextCharFormat enabledDateFormat; + enabledDateFormat.setFontPointSize( QApplication::font().pointSizeF() + 1 ); + enabledDateFormat.setFontWeight( QFont::Black ); + enabledDateFormat.setFontUnderline( true ); + + // Mark the dates with available chats in the calendar + QList list = timestamps.keys(); + qSort( list ); + + QDate lastDate; + foreach( quint64 timestamp, list ) + { + lastDate = QDateTime::fromTime_t( timestamp ).date(); + + // Set the calendar's first and last available dates, while we're at it + if( timestamp == list.first() ) { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Starting log parser thread..."; -#endif - logParser_ = new XmlLogParser( showDate, showTime, showSeconds ); - connect( logParser_, SIGNAL( gotConversation(int,const QDomElement&) ), - this, SLOT ( addConversation(int,const QDomElement&) ) ); - connect( logParser_, SIGNAL( finished() ), - this, SLOT ( setLoading() ) ); + datePicker_->setMinimumDate( lastDate ); + } + else if( timestamp == list.last() ) + { + datePicker_->setMaximumDate( lastDate ); } -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Adding conversation" << entry.fileName() << "to log parser thread..."; -#endif - logParser_->addDocument( entry.fileName(), file.readAll() ); - - file.close(); + datePicker_->setDateTextFormat( lastDate, enabledDateFormat ); } - // start the thread - if( logParser_ != 0 && !logParser_->isRunning() ) +#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE + if( timestamps.isEmpty() ) { - kDebug() << "Starting the log parser thread!"; - logParser_->start( QThread::HighPriority ); + kmDebug() << "No conversations available."; } - - if( list.isEmpty() ) - { - setLoading( false ); - -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "No conversations available."; -#endif - } -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE else { - kDebug() << "Conversations are available."; + kmDebug() << timestamps.count() << "conversations were recorded."; } #endif - // Restore the UI: the view will be reenabled by reloadLogs() - listView_->setEnabled( true ); -} - - - -// Verify whether the chat date interval is valid or not -bool ChatHistoryDialog::checkDates( bool checkAndReloadLogs ) -{ - // When the user first clicks on the "filter by date" radio button, neither the "from" - // nor the "to" checkboxes are enabled, so show no chats. - // It's better than showing *everything*, which may mean YEARS of chats. - if( ! fromBox_->isChecked() && ! toBox_->isChecked() ) + // Change the date picker view to display the last date, and show the last log + if( lastDate.isValid() ) { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "No date filter chosen."; -#endif - return false; + datePicker_->setCurrentPage( lastDate.year(), lastDate.month() ); + datePicker_->setSelectedDate( lastDate ); + showLogs( lastDate ); } - QDate fromDate( fromDate_->date() ); - QDate toDate ( toDate_ ->date() ); - - // Disallow negative date intervals - if( fromDate > toDate ) - { - toDate_->setDate( fromDate ); - - // Setting the date calls this method for another check - return false; - } - - // Allow a maximum interval of one year of chats (and this may already - // be an ENORMOUS amount of data, depending on the contact...) - static const int maxDays = 365; - int daysDifference = fromDate.daysTo( toDate ) - maxDays; - if( daysDifference > 0 ) - { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Date difference is too long (" << maxDays << "days +" << daysDifference << "), fixing dates."; -#endif - - toDate = toDate.addDays( - daysDifference ); - toDate_->setDate( toDate ); - - // Setting the date calls this method for another check - return false; - } - - if( checkAndReloadLogs ) - { - reloadLogs(); - } - - return true; -} - - - -// Load the list of contacts for which logs are available -void ChatHistoryDialog::loadContactsList() -{ - // Clear the list - model_->clear(); - - if( historyAccount_ == 0 ) - { - return; - } - - // Find all XML chat log files in the logs directory - QDir logsDir( KMessConfig::instance()->getAccountDirectory( historyAccount_->getHandle() ) - + "/chatlogs" ); - - logsDir.setFilter( QDir::Files ); - logsDir.setNameFilters( QStringList() << "*.xml" ); - - // Add them to the list - const QFileInfoList &list = logsDir.entryInfoList(); - QHash loadedHandles; - - foreach( const QFileInfo &entry, list ) - { - QString handle( entry.fileName() ); - handle.remove( handle.length() - 4, 4 ); - - // strip off the number information too. - if( handle.at( handle.length() - 1 ).isNumber() ) - { - handle.truncate( handle.lastIndexOf( '.' ) ); - } - - // now, only add the handle if it hasn't already been loaded. - if ( loadedHandles.contains( handle ) ) continue; - - loadedHandles.insert( handle, true ); - model_->appendRow( new QStandardItem( handle ) ); - } + setLoading( false ); } // Change the account for which to show logs -void ChatHistoryDialog::reloadHandle( int index ) +void ChatHistoryDialog::slotAccountChanged( int index ) { - const QString handle( handleComboBox_->itemText( index ) ); + setLoading( true ); - historyAccount_ = AccountsManager::instance()->getAccountByHandle( handle ); - loadContactsList(); + ChatHistoryManager::setAccount( accountComboBox_->itemText( index ) ); + + datePicker_->setDateTextFormat( QDate(), QTextCharFormat() ); + + // Clear the contacts list + model_->clear(); + + const QStringList &list = ChatHistoryManager::contactsList(); + foreach( QString handle, list ) + { + model_->appendRow( new QStandardItem( handle ) ); + } + + setLoading( false ); + + // Disable the listview if there are no contacts + if( list.isEmpty() ) + { + searchEdit_->setEnabled( false ); + contactListView_->setEnabled( false ); + } } -// Reload the current chat log history -void ChatHistoryDialog::reloadLogs() +// Load and show the selected chats +void ChatHistoryDialog::showLogs( const QDate& day ) { - // Never load logs immediately: wait an instant to allow the user to do more changes. - // This makes the interface zippy and the user happy - if( reloadLogsTimer_ == 0 ) + // Don't reload the same chat + if( lastSelectedDate_.isValid() && lastSelectedDate_ == day ) { - reloadLogsTimer_ = new QTimer( this ); - reloadLogsTimer_->setSingleShot( true ); - connect( reloadLogsTimer_, SIGNAL( timeout() ), - this, SLOT ( reloadLogs() ) ); - } - - if( reloadLogsTimer_ != sender() ) - { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << "Scheduling reload..."; -#endif - reloadLogsTimer_->start( 250 ); return; } - // Reloading logs may be time consuming too, protect the operation from reentrancy -// QMutexLocker lock( &addConversationLock_ ); - if( reloadingLogs_ ) + lastSelectedDate_ = day; + + if( ChatHistoryManager::timestamps().isEmpty() ) { #ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << "Already running, exit."; + kmWarning() << "No conversations to load!"; #endif return; } - reloadingLogs_ = true; - chatView_->widget()->setEnabled( false ); - - if( conversations_.isEmpty() ) - { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG - kWarning() << "No cached conversations!"; -#endif - reloadingLogs_ = false; - return; - } + setLoading( true ); #ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << "Reloading..."; + kmDebug() << "Loading..."; #endif // The text stream is used to dump the DOM nodes to an XML byte array. QString xmlData; - QTextStream log( &xmlData ); + QList timestamps; - // Show a specific chat - if( conversationRadio_->isChecked() ) + // Find all chat log timestamps in the specified day + + // Get the initial and final timestamps of the range + const quint64 startingDate = QDateTime( day, QTime( 0, 0 ) ).toTime_t(); + const quint64 endingDate = QDateTime( day, QTime( 23, 59 ) ).toTime_t(); + + +#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE + kmDebug() << "Filtering out conversations before timestamp" << startingDate << "and after" << endingDate; +#endif + + ConversationList list( ChatHistoryManager::timestamps() ); + ConversationList::iterator startIt = list.lowerBound( startingDate ); + ConversationList::iterator endIt = list.upperBound( endingDate ); + + // How could the user have made it until here? + if( startIt == list.end() ) { - // Get the timestamp of the requested chat from the combobox. - int timestamp = conversationComboBox_->itemData( conversationComboBox_->currentIndex(), - Qt::UserRole ).toUInt(); - -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Conversation timestamp:" << timestamp; -#endif - - if( ! conversations_.contains( timestamp ) ) - { - kWarning() << "Chat not found!"; - reloadingLogs_ = false; - return; - } - - // Add the chat to the xml output - log << conversations_[ timestamp ]; - } - // There are two options only, but you *never* know. - else if( dateRadio_->isChecked() ) - { - // Assume the interval of dates makes sense: checkDates() fixes the dates for us. - if( ! checkDates( false /*checkAndReloadLogs */ ) ) - { - reloadingLogs_ = false; - return; - } - - // All chats in the specified time interval will be merged into one. - - // Add to the xml string the starting tag - log << "" ; - - QMapIterator it( conversations_ ); - while( it.hasNext() ) - { - it.next(); - const int timestamp = it.key(); - const QDomNode &conversation = it.value(); - const QDate &date = QDateTime::fromTime_t( timestamp ).date(); - -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Conversation date:" << date; -#endif - - if( fromBox_->isChecked() && date < fromDate_->date() ) - { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Filtering out conversation on:" << date << "<" << fromDate_->date(); -#endif - continue; - } - else if( toBox_->isChecked() && date > toDate_->date() ) - { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Filtering out conversation on:" << date << ">" << toDate_->date() - << "and all later ones"; -#endif - // We're at the last possible chat, skip the rest - break; - } - - // Add all messages of this conversation to the output - const QDomNodeList &messages = conversation.childNodes(); - for( int index = 0; index < messages.size(); ++index ) - { - log << messages.at( index ); - } - - // Without this, the data won't be fully sent to the byte array by the time setXml is called. - log.flush(); - } - - // Add the closing tag - log << ""; - } - else - { - kWarning() << "UI error, no chat selection choice was active!"; - reloadingLogs_ = false; + kmWarning() << "No conversations were logged in this date!"; + setLoading( false ); return; } - chatView_->setXml( xmlData ); - chatView_->widget()->setEnabled( true ); + // Add the matching timestamps to a list + do + { + timestamps << startIt.key(); + startIt++; + } + while( startIt != endIt ); + + // chatLog() takes a list of chat log times and joins all conversations together + QString xmlString( ChatHistoryManager::chatLog( timestamps, true, false ) ); + + // The string must be wrapped into a single tag, to have a valid XML tree even when + // there is more than one tag. + chatView_->setXml( "" + xmlString + "" ); + + setLoading( false ); #ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << "Reload done."; + kmDebug() << "Chat log loading returned" << ChatHistoryManager::result(); + kmDebug() << "Reload done."; #endif - - reloadingLogs_ = false; } @@ -621,30 +376,53 @@ void ChatHistoryDialog::reloadLogs() /** * Set the contact for whom the logs will be initially shown * + * @param handle the account to search logs in * @param handle the handle to get contact history for - * @returns whether there was history for the given contact contact + * @returns whether there was history for the given contact */ -bool ChatHistoryDialog::setContact( const QString &handle ) +bool ChatHistoryDialog::setInitialContact( const QString &account, const QString &handle ) { + if( account.isEmpty() ) + { +#ifdef KMESSDEBUG_CHATHISTORYDIALOG + kmDebug() << "Account is empty, selecting nothing."; +#endif + contactListView_->setCurrentIndex( QModelIndex() ); + return false; + } + +#ifdef KMESSDEBUG_CHATHISTORYDIALOG + kmDebug() << "Pre-selecting account" << account; +#endif + + // Select the account first (calling the slot directly, or no change signal would be fired) + slotAccountChanged( accountComboBox_->findText( account ) ); + if( handle.isEmpty() ) { #ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << "Handle is empty, pretending to have logs for the contact."; + kmDebug() << "Handle is empty, not selecting a contact."; #endif - return true; + contactListView_->setCurrentIndex( QModelIndex() ); + return false; } + // Then select the contact handle QList items = model_->findItems( handle, Qt::MatchContains ); if( items.isEmpty() ) { #ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << handle << "has no chat history"; + kmDebug() << handle << "has no chat history in account" << account; #endif return false; } - listView_->setCurrentIndex( proxyModel_->mapFromSource( items.first()->index() ) ); +#ifdef KMESSDEBUG_CHATHISTORYDIALOG + kmDebug() << "Pre-selecting handle" << handle; +#endif + + contactListView_->setCurrentIndex( proxyModel_->mapFromSource( items.first()->index() ) ); return true; } @@ -656,20 +434,20 @@ void ChatHistoryDialog::setLoading( bool isLoading ) { if( isLoading ) { +#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE + kmDebug() << "Now loading..."; +#endif + // Show the loading animation loadingLabel_->show(); loadingLabel_->start(); - // Clear the chooser - conversationComboBox_->clear(); - conversationComboBox_->insertItem( 0, i18nc( "Combo box default item", "Loading..." ), -1 ); + searchEdit_->setEnabled( false ); + contactListView_->setEnabled( false ); + datePicker_->setEnabled( false ); // Clear the view chatView_->clearView( true ); - -#ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << "Now loading..."; -#endif } else { @@ -677,187 +455,21 @@ void ChatHistoryDialog::setLoading( bool isLoading ) loadingLabel_->stop(); loadingLabel_->hide(); - if( conversationComboBox_->count() < 1 - || conversations_.isEmpty() ) - { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << "No more loading - list empty."; -#endif - conversationComboBox_->clear(); - conversationComboBox_->insertItem( 0, i18nc( "Combo box default item", "No logged chats" ), -1 ); - } - else if( conversationComboBox_->itemData( 0, Qt::UserRole ) == -1 ) - { - conversationComboBox_->removeItem( 0 ); -#ifdef KMESSDEBUG_CHATHISTORYDIALOG - kDebug() << "No more loading - removed temp item."; -#endif - } -#ifdef KMESSDEBUG_CHATHISTORYDIALOG - else - { - kDebug() << "Wtf?"; - } + searchEdit_->setEnabled( ! ChatHistoryManager::contactsList().isEmpty() ); + contactListView_->setEnabled( ! ChatHistoryManager::contactsList().isEmpty() ); + datePicker_->setEnabled( ! ChatHistoryManager::timestamps().isEmpty() ); + datePicker_->setFocus(); + +#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE + kmDebug() << "...loading ended"; #endif } - chatView_->widget()->setEnabled( ! isLoading ); + accountComboBox_->setEnabled( ! isLoading ); } - -// Worker thread's constructor -XmlLogParser::XmlLogParser( bool showDate, bool showTime, bool showSeconds ) -: end_( false ) -, showDate_( showDate ) -, showTime_( showTime ) -, showSeconds_( showSeconds ) -{ -} - - - -// Add another document to the worker thread's queue -void XmlLogParser::addDocument( const QString &fileName, const QByteArray &newDocument ) -{ - documents_[ fileName ] = newDocument; -} - - - -// Stop the worker thread -void XmlLogParser::end() -{ - disconnect( this ); - - end_ = true; - // quit() here makes the threads exec() return, so it effectively "detaches" - // from the main program; however, the run() method stays running until it's - // done with the current document and it notices end_ is true. If that takes - // more than the 5 seconds (in the wait() call below), it is terminated. - quit(); - - // Wait 5s for the thread to finish: if it's not enough, kill it - wait( 5000 ); - if( isRunning() ) - { - terminate(); - } - - deleteLater(); -} - - - -// Worker thread's method to parse XML files into conversations -void XmlLogParser::run() -{ -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Initially present:" << documents_.count() << "documents."; -#endif - - while( ! documents_.isEmpty() ) - { - // take the first document from the hash for processing - QHash::iterator it = documents_.begin(); - const QString fileName = it.key(); - const QByteArray documentBytes = documents_.take( fileName ); - - QDomDocument document; - document.setContent( documentBytes ); - -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Parsing document from XML file:" << fileName; -#endif - - // There is no message root in this XML file - QDomNode messageRoot( document.firstChildElement( "messageRoot" ) ); - if( messageRoot.isNull() ) - { - kWarning() << "Invalid XML file!"; - continue; - } - - // Since in the chat logs only the message timestamps are saved, add to each message - // the date and time in the current format - const QDomNodeList &messages = document.elementsByTagName( "message" ); -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << messages.size() << "messages to parse."; -#endif - for( int indexMsg = 0; indexMsg < messages.size(); ++indexMsg ) - { - QDomElement message( messages.at( indexMsg ).toElement() ); - int timestamp = message.attribute( "timestamp" ).toUInt(); - const QDateTime &datetime = QDateTime::fromTime_t( timestamp ); - - if( ! message.hasAttribute( "timestamp" ) || timestamp == 0 ) - { - continue; - } - - if ( showDate_ ) - { - message.setAttribute( "time", KGlobal::locale()->formatDateTime( datetime, KLocale::ShortDate, showSeconds_ ) ); - } - else - { - message.setAttribute( "time", KGlobal::locale()->formatTime( datetime.time(), showSeconds_ ) ); - } - } -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << messages.size() << "messages parsed."; -#endif - - // Add all conversations from this file to the cached XML and the UI - const QDomNodeList &fileConversations = messageRoot.childNodes(); - for( int index = 0; index < fileConversations.size(); ++index ) - { - QDomElement conversation( fileConversations.at( index ).toElement() ); - - if( conversation.nodeName() != "conversation" ) - { - kWarning() << "Unexpected element" << conversation.nodeName() << "found in the XML log:" - << fileName; - continue; - } - - - // Check if the has a valid timestamp - const QDomNode ×tampNode = conversation.attributes().namedItem( "timestamp" ); - const int timestamp = timestampNode.nodeValue().toInt(); - - if( timestampNode.isNull() ) - { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG - kWarning() << "Invalid XML: invalid timestamp!"; -#endif - continue; - } - - // Change it to a so that it'll be readily usable when selected - conversation.setTagName( "messageRoot" ); -// conversation.removeAttribute( "timestamp" ); // Ignored by ChatMessageView? - - emit gotConversation( timestamp, conversation ); - } - - // if we're supposed to stop processing now, just stop. - if( end_ ) - { -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "Caught end, closing."; -#endif - return; - } - } - -#ifdef KMESSDEBUG_CHATHISTORYDIALOG_VERBOSE - kDebug() << "All documents have been parsed."; -#endif -} - - // The user right clicked at the KHTMLPart to show a popup. void ChatHistoryDialog::slotShowContextMenu( const QString &clickedUrl, const QPoint &point ) { diff --git a/src/dialogs/chathistorydialog.h b/src/dialogs/chathistorydialog.h index 2eeacc8..acbe126 100644 --- a/src/dialogs/chathistorydialog.h +++ b/src/dialogs/chathistorydialog.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -34,9 +33,7 @@ class QSortFilterProxyModel; class QStandardItemModel; class QTimer; -class Account; class ChatMessageView; -class XmlLogParser; @@ -50,87 +47,32 @@ class ChatHistoryDialog : public KDialog, private Ui::historyDialog // Destructor virtual ~ChatHistoryDialog(); // Set the contact for whom the logs will be initially shown - bool setContact( const QString &handle ); - - private: - // Load the list of contacts for which logs are available - void loadContactsList(); + bool setInitialContact( const QString &account, const QString &handle = QString() ); private slots: - // A conversation has been parsed by the thread - void addConversation( int timestamp, const QDomElement &newConversation ); - // Verify whether the chat date interval is valid or not - bool checkDates( bool reloadLogs = true ); - // Caches the XML for the selected contact. Makes things a lot faster - void cacheContactXml(const QModelIndex &index); - // Reload the current chat log history - void reloadLogs(); + // Show on which dates there are logged chats with a certain contact + void showAvailableDates(const QModelIndex &index); + // Load and show the selected chats + void showLogs( const QDate& day ); // Set whether the dialog is loading chats or not void setLoading( bool isLoading = false ); // Show the context menu for the chat message view void slotShowContextMenu( const QString &clickedUrl, const QPoint &point ); // Change the account for which to show logs - void reloadHandle( int index ); + void slotAccountChanged( int index ); - private: - // Mutex to watch over the chats addition - QMutex addConversationLock_; + private: // Private structures + + // Last chat date selected + QDate lastSelectedDate_; + // Mutex to watch over the most time-consuming activities + QMutex logLoadingLock_; // View used to show the chat logs ChatMessageView *chatView_; - // Cache to store a contact's list of available conversations - QMap conversations_; - // XML log parsing thread - XmlLogParser *logParser_; // Model for the list of contacts QStandardItemModel *model_; // Filter for the list of contacts QSortFilterProxyModel *proxyModel_; - // Flag used to avoid reloading multiple times - bool reloadingLogs_; - // Timer to reload the shown chats - QTimer *reloadLogsTimer_; - // Cache to store a contact's entire chat history - QDomDocument xml_; - // The account which to display logs of - Account *historyAccount_; -}; - - - -// Service class to make use of threads to fill in the list of available chats -class XmlLogParser : public QThread -{ - Q_OBJECT - - public: - // Constructor - XmlLogParser( bool showDate, bool showTime, bool showSeconds ); - // Destructor - ~XmlLogParser() {} - // Add another document to the queue - void addDocument( const QString &fileName, const QByteArray &newDocument ); - // Stop the thread - void end(); - - protected: - // Parse XML files into conversations - void run(); - - private: - // List of documents to parse - QHash documents_; - // An order of stopping has been received - bool end_; - // Show dates in messages - bool showDate_; - // Show time in generated messages - bool showTime_; - // Show seconds in messages - bool showSeconds_; - - signals: - // A conversation has been parsed - void gotConversation( int timestamp, const QDomElement &conversation ); }; diff --git a/src/dialogs/chathistorydialog.ui b/src/dialogs/chathistorydialog.ui index 8f8ef57..b6edd89 100644 --- a/src/dialogs/chathistorydialog.ui +++ b/src/dialogs/chathistorydialog.ui @@ -6,16 +6,16 @@ 0 0 - 680 - 472 + 629 + 606 - + - + Qt::Horizontal @@ -25,7 +25,7 @@ - + @@ -38,7 +38,7 @@ - + 100 @@ -55,57 +55,32 @@ - - - - 100 - 0 - - - - Qt::Vertical - - - false - - - - Chat Log Filter + + + + -1 - - - - - QFormLayout::ExpandingFieldsGrow - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - Filter by &chat - - - true - - - - - + + 0 + + + + + + 0 + 0 + + + + Chat Log Filter + + + + - - - true - - - - 0 - 0 - - - - true + + + Chat date: @@ -132,83 +107,80 @@ - + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 17 - 17 + 22 + 22 + + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 22 + 22 - - - - Filter by &date + + + + QFrame::StyledPanel + + QFrame::Raised + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Qt::ClickFocus + + + + - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - false - - - from - - - - - - - false - - - - - - - false - - - to - - - - - - - false - - - - - - - - + + + - - KDateWidget - QWidget -
kdatewidget.h
-
KAnimatedButton QToolButton @@ -227,94 +199,8 @@
searchEdit_ - listView_ - conversationRadio_ - dateRadio_ - conversationComboBox_ - fromBox_ - toBox_ + contactListView_ - - - dateRadio_ - toggled(bool) - fromBox_ - setEnabled(bool) - - - 305 - 74 - - - 437 - 82 - - - - - dateRadio_ - toggled(bool) - toBox_ - setEnabled(bool) - - - 295 - 73 - - - 449 - 113 - - - - - fromBox_ - toggled(bool) - fromDate_ - setEnabled(bool) - - - 439 - 80 - - - 535 - 82 - - - - - toBox_ - toggled(bool) - toDate_ - setEnabled(bool) - - - 456 - 106 - - - 564 - 114 - - - - - conversationRadio_ - toggled(bool) - conversationComboBox_ - setEnabled(bool) - - - 377 - 145 - - - 463 - 142 - - - - + diff --git a/src/dialogs/contactpropertiesdialog.cpp b/src/dialogs/contactpropertiesdialog.cpp index 42a893a..52a27ee 100644 --- a/src/dialogs/contactpropertiesdialog.cpp +++ b/src/dialogs/contactpropertiesdialog.cpp @@ -97,7 +97,7 @@ ContactPropertiesDialog::~ContactPropertiesDialog() delete mediaSound_; #ifdef KMESSDEBUG_CONTACTPROPERTIES - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -268,7 +268,7 @@ bool ContactPropertiesDialog::eventFilter(QObject *obj, QEvent *event ) bool ContactPropertiesDialog::launch( Contact *contact, DefaultTab defaultTab ) { #ifdef KMESSDEBUG_CONTACTPROPERTIES - kDebug() << "Launch with contact " << contact->getHandle(); + kmDebug() << "Launch with contact " << contact->getHandle(); #endif // Copy the pointer to the contact class @@ -614,7 +614,7 @@ void ContactPropertiesDialog::slotRemoveEmoticon() if( item == 0 ) { #ifdef KMESSDEBUG_CONTACTPROPERTIES - kDebug() << "No emoticon selected!"; + kmDebug() << "No emoticon selected!"; #endif return; } @@ -622,7 +622,7 @@ void ContactPropertiesDialog::slotRemoveEmoticon() bool removed = contact_->manageEmoticonBlackList( false, item->data( Qt::UserRole ).toString() ); #ifdef KMESSDEBUG_CONTACTPROPERTIES - kDebug() << "Blacklist operation succeeded?" << removed; + kmDebug() << "Blacklist operation succeeded?" << removed; #endif if( removed ) @@ -709,7 +709,7 @@ void ContactPropertiesDialog::slotUsePicture() bool ContactPropertiesDialog::checkNotificationSoundFile( const KUrl &url ) { #ifdef KMESSDEBUG_CONTACTPROPERTIES - kDebug() << "Checking filetype"; + kmDebug() << "Checking filetype"; #endif if( Phonon::BackendCapabilities::availableMimeTypes().contains( diff --git a/src/dialogs/invitedialog.cpp b/src/dialogs/invitedialog.cpp index 629d4a4..77ceade 100644 --- a/src/dialogs/invitedialog.cpp +++ b/src/dialogs/invitedialog.cpp @@ -19,12 +19,11 @@ #include "contactentry.h" #include "../currentaccount.h" +#include "../kmessdebug.h" #include "../contact/contact.h" #include "../model/contactlist.h" #include "../utils/kmessconfig.h" -#include - // Constructor @@ -80,7 +79,7 @@ InviteDialog::InviteDialog( const QStringList &usersAlreadyInChat, QStringList & usersToInvite = QStringList(); } - kDebug() << "Users to invite: " << usersToInvite; + kmDebug() << "Users to invite: " << usersToInvite; // Schedule the dialog for deletion deleteLater(); @@ -91,7 +90,7 @@ InviteDialog::InviteDialog( const QStringList &usersAlreadyInChat, QStringList & // Destructor InviteDialog::~InviteDialog() { - kDebug() << "DESTROYED"; + kmDebug() << "DESTROYED"; // Save the dialog size and position KConfigGroup group = KMessConfig::instance()->getGlobalConfig( "InviteDialog" ); @@ -177,7 +176,7 @@ void InviteDialog::contactClicked() ContactEntry *contactEntry = static_cast( sender() ); if( contactEntry != 0 ) { - kDebug() << contactEntry->isSelected(); + kmDebug() << contactEntry->isSelected(); contactEntry->click(); } } @@ -263,7 +262,7 @@ void InviteDialog::updateInterface( const QStringList &usersAlreadyInChat, bool { continue; } - + // Check if the contact is online or if we want also the offline contacts if( contact->isOnline() || ! onlyOnline ) { diff --git a/src/dialogs/listexportdialog.cpp b/src/dialogs/listexportdialog.cpp index 538bdbf..e5d2548 100644 --- a/src/dialogs/listexportdialog.cpp +++ b/src/dialogs/listexportdialog.cpp @@ -51,7 +51,7 @@ ListExportDialog::ListExportDialog( QWidget *parent ) ListExportDialog::~ListExportDialog() { - kDebug() << "DESTROYED"; + kmDebug() << "DESTROYED"; } diff --git a/src/dialogs/networkwindow.cpp b/src/dialogs/networkwindow.cpp index 34621b7..4ec6574 100644 --- a/src/dialogs/networkwindow.cpp +++ b/src/dialogs/networkwindow.cpp @@ -45,6 +45,58 @@ NetworkWindow * NetworkWindow::instance_(0); +#ifdef KMESS_NETWORK_WINDOW + +// The network window can optionally be compiled. +// The macro's from kmessdebug.h make it easy to handle this +// without optionally depending on networkwindow.h everywhere. + +/** + * @brief Inform the network window the connection was closed, used by KMESS_NET_CLOSE. + * @param connection Reference to the caller object, to distinguish between connections. + * @ingroup Debug + */ +void _kmessNetClose(QObject *connection) +{ + NetworkWindow::instance()->connectionClosed(connection); +} + +/** + * @brief Inform the network window about a new connection, used by KMESS_NET_INIT. + * @param connection Reference to the caller object, to distinguish between connections. + * @param title The title for the connection in the network window. + * @ingroup Debug + */ +void _kmessNetInit(QObject *connection, const QString &title) +{ + NetworkWindow::instance()->setConnectionTitle(connection, title); +} + +/** + * @brief Add the received data to the network window, used by KMESS_NET_RECEIVED. + * @param connection Reference to the caller object, to distinguish between connections. + * @param message The data received from the connection, should be a complete message. + * @ingroup Debug + */ +void _kmessNetReceived(QObject *connection, const QByteArray &message) +{ + NetworkWindow::instance()->addIncomingMessage(connection, message); +} + +/** + * @brief Add the sent data to the network window, used by KMESS_NET_SENT. + * @param connection Reference to the caller object, to distinguish between connections. + * @param message The data sent to the connection, should be a complete message. + * @ingroup Debug + */ +void _kmessNetSent(QObject *connection, const QByteArray &message) +{ + NetworkWindow::instance()->addOutgoingMessage(connection, message); +} + +#endif + + // Constructor NetworkWindow::NetworkWindow( QWidget *parent ) : KDialog( parent, Qt::Dialog ) // Explicitly set the window type to disable the destructive close behavior @@ -709,7 +761,7 @@ NetworkWindow::~NetworkWindow() // If no type is found, assume it's a standard MSN connection. if( entry->type == TYPE_UNKNOWN ) { - kWarning() << "Could not determine connection type for message: " << message.data(); + kmWarning() << "Could not determine connection type for message: " << message.data(); entry->type = TYPE_NS; } } @@ -1107,7 +1159,7 @@ NetworkWindow::~NetworkWindow() if( path.isEmpty() ) return; - kDebug() << "NetworkWindow - saving network log for window '" << name << "' to '" << path << "'."; + kmDebug() << "NetworkWindow - saving network log for window '" << name << "' to '" << path << "'."; bool failed = false; @@ -1116,7 +1168,7 @@ NetworkWindow::~NetworkWindow() if( ! file.open( QIODevice::WriteOnly ) ) { failed = true; - kWarning() << "File save failed - couldn't open file."; + kmWarning() << "File save failed - couldn't open file."; } // Output the HTML with the right text encoding diff --git a/src/dialogs/transferentry.cpp b/src/dialogs/transferentry.cpp index 2ff30bd..f813a69 100644 --- a/src/dialogs/transferentry.cpp +++ b/src/dialogs/transferentry.cpp @@ -49,7 +49,7 @@ TransferEntry::TransferEntry( QWidget *parent, const QString filename, const ulo preview_ = QPixmap::fromImage( preview ); #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "Initializing, file='" << filename_ + kmDebug() << "Initializing, file='" << filename_ << "', preview=" << ( preview_.isNull() ? "null" : "set" ) << "." << endl; #endif @@ -109,7 +109,7 @@ TransferEntry::TransferEntry( QWidget *parent, const QString filename, const ulo TransferEntry::~TransferEntry() { #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "DESTROYED. [file=" << filename_ << "]"; + kmDebug() << "DESTROYED. [file=" << filename_ << "]"; #endif delete timer_; } @@ -120,7 +120,7 @@ TransferEntry::~TransferEntry() void TransferEntry::cancelClicked() { #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "Notifying listeners."; + kmDebug() << "Notifying listeners."; #endif emit cancelTransfer( transferID_ ); @@ -165,13 +165,13 @@ void TransferEntry::failTransfer( const QString &message ) if( isDone_ ) { #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "already done."; + kmDebug() << "already done."; #endif return; } #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "Displaying error message."; + kmDebug() << "Displaying error message."; #endif // Update the widgets @@ -208,13 +208,13 @@ void TransferEntry::finishTransfer() if( isDone_ ) { #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "already done."; + kmDebug() << "already done."; #endif return; } #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "Displaying success message."; + kmDebug() << "Displaying success message."; #endif // Make sure the widget does not resize when the progressbar hides @@ -291,13 +291,13 @@ void TransferEntry::setStatusMessage( const QString &message ) if( isDone_ ) { #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "already done."; + kmDebug() << "already done."; #endif return; } #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "displaying '" << message << "'."; + kmDebug() << "displaying '" << message << "'."; #endif statusLabel_->setText( message ); @@ -315,7 +315,7 @@ void TransferEntry::updateProgress( ulong bytesTransferred ) if( isDone_ ) { #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "already done."; + kmDebug() << "already done."; #endif return; } @@ -340,7 +340,7 @@ void TransferEntry::updateProgress( ulong bytesTransferred ) } #ifdef KMESSDEBUG_TRANSFERENTRY - kDebug() << "transfer is at " << ((float)percent/10) << " percent."; + kmDebug() << "transfer is at " << ((float)percent/10) << " percent."; #endif if( incoming_ ) diff --git a/src/dialogs/transferwindow.cpp b/src/dialogs/transferwindow.cpp index db59b16..5f784a7 100644 --- a/src/dialogs/transferwindow.cpp +++ b/src/dialogs/transferwindow.cpp @@ -81,7 +81,7 @@ TransferWindow::~TransferWindow() } #ifdef KMESSDEBUG_TRANSFERWINDOW - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif // Save the window size and position @@ -99,7 +99,7 @@ TransferWindow::~TransferWindow() int TransferWindow::addEntry( const QString filename, ulong filesize, bool incoming, const QImage preview ) { #ifdef KMESSDEBUG_TRANSFERWINDOW - kDebug() << "adding entry for '" << filename << "'."; + kmDebug() << "adding entry for '" << filename << "'."; #endif // Create a new entry @@ -114,7 +114,7 @@ int TransferWindow::addEntry( const QString filename, ulong filesize, bool incom this, SIGNAL( cancelTransfer(int) ) ); #ifdef KMESSDEBUG_TRANSFERWINDOW - kDebug() << "Adding entry to layout, showing it."; + kmDebug() << "Adding entry to layout, showing it."; #endif // Add it to the list of entries @@ -206,7 +206,7 @@ void TransferWindow::destroy() void TransferWindow::cleanUp() { #ifdef KMESSDEBUG_TRANSFERWINDOW - kDebug() << "Cleaning up"; + kmDebug() << "Cleaning up"; #endif int id; @@ -229,7 +229,7 @@ void TransferWindow::cleanUp() entryList_.remove( id ); #ifdef KMESSDEBUG_TRANSFERWINDOW - kDebug() << "Removed " << entry->getFileName(); + kmDebug() << "Removed " << entry->getFileName(); #endif delete entry; diff --git a/src/dialogs/userpicturesdialog.cpp b/src/dialogs/userpicturesdialog.cpp index 20edea3..64e91f6 100644 --- a/src/dialogs/userpicturesdialog.cpp +++ b/src/dialogs/userpicturesdialog.cpp @@ -56,7 +56,7 @@ UserPicturesDialog::UserPicturesDialog( QWidget *parent ) UserPicturesDialog::~UserPicturesDialog() { clearList(); - kDebug() << "DESTROYED"; + kmDebug() << "DESTROYED"; } diff --git a/src/emoticon.cpp b/src/emoticon.cpp index ed452e3..f2e1e6d 100644 --- a/src/emoticon.cpp +++ b/src/emoticon.cpp @@ -403,7 +403,7 @@ void Emoticon::update() if( picturePath_.isEmpty() || ! emoticonData.load( picturePath_ ) || emoticonData.isNull() ) { #ifdef KMESSDEBUG_EMOTICONS_GENERAL - kDebug() << "Update failed: " << picturePath_ << "(" << (isCustomEmoticon_?"custom":"standard") << ", shortcut" << originalPictureName_ << ")"; + kmDebug() << "Update failed: " << picturePath_ << "(" << (isCustomEmoticon_?"custom":"standard") << ", shortcut" << originalPictureName_ << ")"; #endif valid_ = false; return; @@ -428,7 +428,7 @@ void Emoticon::update() // emoticonFile.close(); #ifdef KMESSDEBUG_EMOTICONS_GENERAL - kDebug() << "Read data hash from filename for " << picturePath_ << ": " << dataHash_; + kmDebug() << "Read data hash from filename for " << picturePath_ << ": " << dataHash_; #endif } diff --git a/src/emoticonmanager.cpp b/src/emoticonmanager.cpp index 3e9768c..c6bbfd5 100644 --- a/src/emoticonmanager.cpp +++ b/src/emoticonmanager.cpp @@ -51,7 +51,7 @@ EmoticonManager::EmoticonManager() // Create the default KMess standard theme, to always have a fallback theme if( ! standardTheme_->loadTheme( "KMess-new", false ) ) { - kWarning() << "Cannot create standard emoticon theme!"; + kmWarning() << "Cannot create standard emoticon theme!"; } else { @@ -111,7 +111,7 @@ void EmoticonManager::connected( QString handle ) } #ifdef KMESSDEBUG_EMOTICONS_GENERAL - kDebug() << "Loading custom emoticon theme of: " << themeName; + kmDebug() << "Loading custom emoticon theme of: " << themeName; #endif // When this call fails, it'll give feedback about the cause. No need to do it here too. @@ -139,7 +139,7 @@ void EmoticonManager::destroy() void EmoticonManager::disconnected() { #ifdef KMESSDEBUG_EMOTICONS_GENERAL - kDebug() << "Destroying custom emoticon theme."; + kmDebug() << "Destroying custom emoticon theme."; #endif // Only save the theme when the account is not temporary @@ -153,7 +153,7 @@ void EmoticonManager::disconnected() // NOTE If a guest user adds emoticons, there will be its folder with the relative images. // I don't delete nor move them, since it may be a registered account which, for once, has // been made not to remember changes. - kDebug() << "Guest account - do not save the theme."; + kmDebug() << "Guest account - do not save the theme."; } #endif } @@ -294,7 +294,7 @@ EmoticonManager* EmoticonManager::instance() void EmoticonManager::replaceCustomTheme( EmoticonTheme *newTheme ) { #ifdef KMESSDEBUG_EMOTICONS_GENERAL - kDebug() << "Replacing custom emoticon theme with a new one."; + kmDebug() << "Replacing custom emoticon theme with a new one."; #endif delete customTheme_; @@ -319,7 +319,7 @@ void EmoticonManager::replaceCustomTheme( EmoticonTheme *newTheme ) void EmoticonManager::slotChangedEmoticonSettings() { #ifdef KMESSDEBUG_EMOTICONS_GENERAL - kDebug() << "Emoticon theme changed, updating emoticons."; + kmDebug() << "Emoticon theme changed, updating emoticons."; #endif // Find out which theme is used now. @@ -331,7 +331,7 @@ void EmoticonManager::slotChangedEmoticonSettings() // Warn if something has gone wrong if( ! isLoaded ) { - kWarning() << "Cannot set standard emoticon theme '" << currentStyle << "'."; + kmWarning() << "Cannot set standard emoticon theme '" << currentStyle << "'."; return; } diff --git a/src/emoticontheme.cpp b/src/emoticontheme.cpp index 3f1f81e..96e3f2b 100644 --- a/src/emoticontheme.cpp +++ b/src/emoticontheme.cpp @@ -157,14 +157,14 @@ bool EmoticonTheme::createTheme( const QString& themeDir ) QFile xmlFile( themeFileName ); #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Loading emoticons from theme XML: '" << themeFileName << "'"; + kmDebug() << "Loading emoticons from theme XML: '" << themeFileName << "'"; #endif // Try to read the XML if( ! xmlFile.open( QIODevice::ReadOnly ) ) { #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Could not open '" << themeFileName << "'"; + kmDebug() << "Could not open '" << themeFileName << "'"; #endif return false; } @@ -175,7 +175,7 @@ bool EmoticonTheme::createTheme( const QString& themeDir ) if( ! xml.setContent( xmlFile.readAll(), false, &xmlError ) ) { #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Failure parsing '" << themeFileName << "': " << xmlError; + kmDebug() << "Failure parsing '" << themeFileName << "': " << xmlError; #endif xmlFile.close(); return false; @@ -215,7 +215,7 @@ bool EmoticonTheme::createTheme( const QString& themeDir ) } #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Added " << emoticons_.count() << " emoticons."; + kmDebug() << "Added " << emoticons_.count() << " emoticons."; #endif return true; @@ -390,14 +390,14 @@ QString EmoticonTheme::getThemeIcon( QString themeDir ) QFile xmlFile( themeFileName ); #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Getting first emoticon from theme XML: '" << themeFileName << "'"; + kmDebug() << "Getting first emoticon from theme XML: '" << themeFileName << "'"; #endif // Try to read the XML if( ! xmlFile.open( QIODevice::ReadOnly ) ) { #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Could not open '" << themeFileName << "'"; + kmDebug() << "Could not open '" << themeFileName << "'"; #endif return QString::null; } @@ -408,7 +408,7 @@ QString EmoticonTheme::getThemeIcon( QString themeDir ) if( ! xml.setContent( xmlFile.readAll(), false, &xmlError ) ) { #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Failure parsing '" << themeFileName << "': " << xmlError; + kmDebug() << "Failure parsing '" << themeFileName << "': " << xmlError; #endif xmlFile.close(); return QString::null; @@ -459,7 +459,7 @@ bool EmoticonTheme::loadTheme( QString themeName, bool isCustomTheme ) isCustomTheme_ = isCustomTheme; #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Loading " << themeName << " as " << (isCustomTheme?"custom":"default") << " theme."; + kmDebug() << "Loading " << themeName << " as " << (isCustomTheme?"custom":"default") << " theme."; #endif // Change the theme name (where it is stored) @@ -468,7 +468,7 @@ bool EmoticonTheme::loadTheme( QString themeName, bool isCustomTheme ) if( oldThemePath == themePath_ ) { #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Theme" << themeName << "was already loaded!"; + kmDebug() << "Theme" << themeName << "was already loaded!"; #endif return true; } @@ -512,7 +512,7 @@ bool EmoticonTheme::removeEmoticon( QString shortcut ) } #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Removing emoticon" << shortcut << "."; + kmDebug() << "Removing emoticon" << shortcut << "."; #endif foreach( Emoticon *emoticon, emoticons_ ) @@ -555,7 +555,7 @@ bool EmoticonTheme::renameEmoticon( QString oldShortcut, QString newShortcut ) } #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Renaming emoticon" << oldShortcut << "to" << newShortcut << "."; + kmDebug() << "Renaming emoticon" << oldShortcut << "to" << newShortcut << "."; #endif foreach( Emoticon *emoticon, emoticons_ ) @@ -607,7 +607,7 @@ bool EmoticonTheme::saveTheme() if( ! dir.exists() ) { // The theme hasn't been created! - kWarning() << "Couldn't create the new theme folder '" << themePath_ << "'!"; + kmWarning() << "Couldn't create the new theme folder '" << themePath_ << "'!"; return false; } @@ -616,14 +616,14 @@ bool EmoticonTheme::saveTheme() QFile xmlFile( themeFileName ); #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Saving emoticons to theme XML: '" << themeFileName << "'"; + kmDebug() << "Saving emoticons to theme XML: '" << themeFileName << "'"; #endif // Open the destination XML file if( ! xmlFile.open( QIODevice::WriteOnly ) ) { - kWarning() << "Save failed - couldn't open file '" << themeFileName << "'."; + kmWarning() << "Save failed - couldn't open file '" << themeFileName << "'."; KMessageBox::sorry( 0, i18n("Could not save the emoticon theme. Make sure you have permission to write to the theme folder '%1'.", themePath_ ) ); return false; } @@ -715,7 +715,7 @@ void EmoticonTheme::updateCache() QFileInfo file; #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Updating the caches."; + kmDebug() << "Updating the caches."; #endif // Remove all replacements, some emoticons may be no longer valid @@ -732,7 +732,7 @@ void EmoticonTheme::updateCache() if( ! emoticon->isValid() ) { #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Invalid emoticon '" << emoticon->getPicturePath() + kmDebug() << "Invalid emoticon '" << emoticon->getPicturePath() << "' with code: " << emoticon->getShortcut() << endl; #endif continue; @@ -777,7 +777,7 @@ void EmoticonTheme::updateCache() } #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Cache contains " << largeReplacements_.count() << " emoticon shortcuts."; + kmDebug() << "Cache contains " << largeReplacements_.count() << " emoticon shortcuts."; #endif // Cache the patterns. @@ -815,7 +815,7 @@ void EmoticonTheme::updateTitles() } #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Updating standard emoticons names..."; + kmDebug() << "Updating standard emoticons names..."; #endif QHash emoticonTitles; @@ -926,7 +926,7 @@ bool EmoticonTheme::updateTheme( const QString& themeDir ) QFile xmlFile( themeFileName ); #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Updating emoticons from theme XML: '" << themeFileName << "'"; + kmDebug() << "Updating emoticons from theme XML: '" << themeFileName << "'"; #endif @@ -934,7 +934,7 @@ bool EmoticonTheme::updateTheme( const QString& themeDir ) if( ! xmlFile.open( QIODevice::ReadOnly ) ) { #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Could not open '" << themeFileName << "'"; + kmDebug() << "Could not open '" << themeFileName << "'"; #endif return false; } @@ -945,7 +945,7 @@ bool EmoticonTheme::updateTheme( const QString& themeDir ) if( ! xml.setContent( xmlFile.readAll(), false, &xmlError ) ) { #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Failure parsing '" << themeFileName << "': " << xmlError; + kmDebug() << "Failure parsing '" << themeFileName << "': " << xmlError; #endif xmlFile.close(); @@ -976,7 +976,7 @@ bool EmoticonTheme::updateTheme( const QString& themeDir ) } #ifdef KMESSDEBUG_EMOTICON_THEMES - kDebug() << "Updated " << themeFiles.count() << " emoticons, setting them up."; + kmDebug() << "Updated " << themeFiles.count() << " emoticons, setting them up."; #endif // Loop through all current emoticons. diff --git a/src/initialview.cpp b/src/initialview.cpp index fee303b..2f2e7f8 100644 --- a/src/initialview.cpp +++ b/src/initialview.cpp @@ -154,7 +154,7 @@ InitialView::InitialView( QWidget *parent ) InitialView::~InitialView() { #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -229,7 +229,7 @@ void InitialView::changedAccount( QString oldName, QString newName ) if( ! foundItem ) { - kWarning() << "Account not found in pulldown list!"; + kmWarning() << "Account not found in pulldown list!"; } } @@ -247,14 +247,14 @@ void InitialView::changedAccount( QString oldName, QString newName ) void InitialView::reconnect( QString handle, bool connectImmediately ) { #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Reconnecting account" << handle; + kmDebug() << "Reconnecting account" << handle; #endif Account *account = accounts_[ handle ]; if( account == 0 ) { #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Account not found, aborting."; + kmDebug() << "Account not found, aborting."; #endif statusMessage( i18nc( "Status message on login screen", @@ -267,7 +267,7 @@ void InitialView::reconnect( QString handle, bool connectImmediately ) if( account->getPassword().isEmpty() || ! account->getSavePassword() ) { #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Account has no password, aborting."; + kmDebug() << "Account has no password, aborting."; #endif statusMessage( i18nc( "Status message on login screen", @@ -285,7 +285,7 @@ void InitialView::reconnect( QString handle, bool connectImmediately ) // We're connected to the network, try connecting now case Solid::Networking::Connected: #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Network status: Connected. Scheduling reconnection."; + kmDebug() << "Network status: Connected. Scheduling reconnection."; #endif if( connectImmediately ) { @@ -302,7 +302,7 @@ void InitialView::reconnect( QString handle, bool connectImmediately ) case Solid::Networking::Unconnected: case Solid::Networking::Connecting: #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Network status: Unconnected/connecting. Waiting for a connection."; + kmDebug() << "Network status: Unconnected/connecting. Waiting for a connection."; #endif setEnabled( false ); statusMessage( i18nc( "Status message on login screen", @@ -314,7 +314,7 @@ void InitialView::reconnect( QString handle, bool connectImmediately ) // The connection is being brought down, wait for it case Solid::Networking::Disconnecting: #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Network status: disconnecting. Waiting a moment for reconnection."; + kmDebug() << "Network status: disconnecting. Waiting a moment for reconnection."; #endif reconnectionRemainingSeconds_ = 30; return; @@ -324,7 +324,7 @@ void InitialView::reconnect( QString handle, bool connectImmediately ) case Solid::Networking::Unknown: #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Network status: Unknown. Scheduling reconnection."; + kmDebug() << "Network status: Unknown. Scheduling reconnection."; #endif // When the user starts kmess and the connection status is unknown, connect immediately. if( connectImmediately ) @@ -370,7 +370,7 @@ void InitialView::slotConnectionStatusChanged( Solid::Networking::Status newStat case Solid::Networking::Connected: status = "Connected"; break; default: status = "Other (not known)"; break; } - kDebug() << "The network connection status has changed to:" << status << "."; + kmDebug() << "The network connection status has changed to:" << status << "."; #endif // If Solid is unable to retrieve the status, assume we're connected @@ -380,7 +380,7 @@ void InitialView::slotConnectionStatusChanged( Solid::Networking::Status newStat if( ! triedConnecting_ ) { #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "no connection attempt active, do nothing."; + kmDebug() << "no connection attempt active, do nothing."; #endif statusMessage(); setEnabled( true ); @@ -388,13 +388,13 @@ void InitialView::slotConnectionStatusChanged( Solid::Networking::Status newStat else { #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "A connection attempt was in progress, continuing..."; + kmDebug() << "A connection attempt was in progress, continuing..."; #endif if( ! reconnectionHandle_.isEmpty() ) { #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Reconnection asked, scheduling."; + kmDebug() << "Reconnection asked, scheduling."; #endif reconnect( reconnectionHandle_ ); } @@ -476,7 +476,7 @@ void InitialView::deleteAccount(Account *account) if( ! foundItem ) { - kWarning() << "Account not found in pulldown list!"; + kmWarning() << "Account not found in pulldown list!"; } } @@ -675,7 +675,7 @@ void InitialView::setEnabled( bool isEnabled ) void InitialView::slotConnectClicked() { #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Connect button clicked," << ( isConnectingUI_ ? "disconnecting" : "connecting" ); + kmDebug() << "Connect button clicked," << ( isConnectingUI_ ? "disconnecting" : "connecting" ); #endif // The button was acting as Disconnect button when it was clicked @@ -751,7 +751,7 @@ bool InitialView::startConnecting( const QString handle, bool emitConnectionSign } #ifdef KMESSDEBUG_INITIALVIEW - kDebug() << "Connecting with handle:" << handle; + kmDebug() << "Connecting with handle:" << handle; #endif // Disable the widgets to start connecting diff --git a/src/kmess.cpp b/src/kmess.cpp index 61178db..45a207d 100644 --- a/src/kmess.cpp +++ b/src/kmess.cpp @@ -22,6 +22,7 @@ #include "emoticonmanager.h" // #include "chat/chat.h" +#include "chat/chathistorymanager.h" #include "chat/chatmaster.h" #include "contact/contact.h" #include "contact/group.h" @@ -38,6 +39,7 @@ #include "notification/chatnotification.h" #include "notification/contactstatusnotification.h" #include "notification/newemailnotification.h" +#include "notification/addressbooknotifications.h" #include "notification/systemtraywidget.h" #include "settings/accountsettingsdialog.h" #include "utils/idletimer.h" @@ -72,6 +74,8 @@ #include #include + + #ifdef KMESSTEST #include "dialogs/networkwindow.h" #endif @@ -83,6 +87,7 @@ KMess::KMess( QWidget *parent ) chatNotification_(0), contactStatusNotification_(0), newEmailNotification_(0), + addressBookNotifications_(0), idleTimer_(0), initialized_(false), initialView_(0), @@ -98,7 +103,7 @@ KMess::KMess( QWidget *parent ) KMess::~KMess() { #ifdef KMESSDEBUG_KMESS - kDebug() << "shutting down KMess..."; + kmDebug() << "shutting down KMess..."; #endif /* @@ -140,6 +145,7 @@ KMess::~KMess() delete newEmailNotification_; delete nowListeningClient_; delete msnNotificationConnection_; + delete addressBookNotifications_; AccountsManager::destroy(); CurrentAccount::destroy(); @@ -150,7 +156,7 @@ KMess::~KMess() #endif #ifdef KMESSDEBUG_KMESS - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -203,7 +209,7 @@ void KMess::addNewContact() return; } #ifdef KMESSDEBUG_KMESS - kDebug() << "Adding " << newHandle << "to groups: " << groupsId; + kmDebug() << "Adding " << newHandle << "to groups: " << groupsId; #endif // Check if the contact is already in contact list @@ -238,7 +244,7 @@ void KMess::addNewGroup() KMESS_ASSERT( msnNotificationConnection_ != 0 ); #endif #ifdef KMESSDEBUG_KMESS - kDebug(); + kmDebug(); #endif QString newGroupName; bool okPressed = false; @@ -276,7 +282,7 @@ void KMess::applicationClosing() if( chatMaster_ != 0 ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "destroying chat master"; + kmDebug() << "destroying chat master"; #endif // Close the chat windows earlier, so logs are saved. @@ -293,7 +299,7 @@ void KMess::slotAccountChanged( Account *account, QString oldHandle, QString old QString newHandle( account->getHandle() ); #ifdef KMESSDEBUG_KMESS - kDebug() << "Saving UI settings for" << newHandle; + kmDebug() << "Saving UI settings for" << newHandle; #endif if ( msnNotificationConnection_ != 0 ) @@ -321,7 +327,7 @@ void KMess::slotAccountChanged( Account *account, QString oldHandle, QString old if( initialView_ ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Updating initial view"; + kmDebug() << "Updating initial view"; #endif // Notify the initial view when the account handle has changed. initialView_->changedAccount( oldHandle, newHandle ); @@ -399,7 +405,7 @@ void KMess::changeStatus( QAction *action ) void KMess::changeStatus( Status newStatus, QString autoReplyMessage ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Selected status:" << MsnStatus::getCode( newStatus ); + kmDebug() << "Selected status:" << MsnStatus::getCode( newStatus ); #endif // Is the status is set manually, idle is forced. @@ -433,7 +439,7 @@ void KMess::changedNowListeningSettings() nowListeningClient_->setEnabled( currentAccount_->getShowNowListening() && isOnline ); #ifdef KMESSDEBUG_KMESS - kDebug() << "Now listening setting is now" + kmDebug() << "Now listening setting is now" << ( currentAccount_->getShowNowListening() ? "enabled" : "disabled") << endl; #endif } @@ -486,12 +492,12 @@ void KMess::changedStatus( Account *account ) } else { - kWarning() << "Changed status dropdown without an account set!"; + kmWarning() << "Changed status dropdown without an account set!"; return; } #ifdef KMESSDEBUG_KMESS - kDebug() << "Changed status to" << MsnStatus::getCode( newStatus ) + kmDebug() << "Changed status to" << MsnStatus::getCode( newStatus ) << "Autoreply is" << currentAccount_->getAutoreply() << endl; #endif @@ -528,7 +534,7 @@ void KMess::changeViewMode(int mode) void KMess::showContactAddedUserDialog( const QString handle ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Contact" << handle << "added user, showing dialog."; + kmDebug() << "Contact" << handle << "added user, showing dialog."; #endif // Show a dialog and let the user choose whether to add, allow, or block the contact. @@ -617,7 +623,7 @@ void KMess::showRemoveGroupDialog(QString groupId) // If the group was not found, bail out if(group == 0) { - kDebug() << "Couldn't find a matching group."; + kmDebug() << "Couldn't find a matching group."; return; } @@ -658,7 +664,7 @@ void KMess::showRenameGroupDialog( QString groupId ) // If the group was found if ( group == 0 ) { - kDebug() << "Couldn't find a matching group."; + kmDebug() << "Couldn't find a matching group."; return; } @@ -698,7 +704,7 @@ void KMess::showChatHistory( const QString &handle ) { ChatHistoryDialog *dialog = new ChatHistoryDialog( this ); - dialog->setContact( handle ); + dialog->setInitialContact( currentAccount_->getHandle(), handle ); dialog->show(); } @@ -722,7 +728,7 @@ void KMess::checkAutologin(QString handle) if ( handle.isEmpty() ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "No handle was given, find an account that uses autologin."; + kmDebug() << "No handle was given, find an account that uses autologin."; #endif const QList accountsList = AccountsManager::instance()->getAccounts(); @@ -741,7 +747,7 @@ void KMess::checkAutologin(QString handle) else { #ifdef KMESSDEBUG_KMESS - kDebug() << "finding account: " << handle << "."; + kmDebug() << "finding account: " << handle << "."; #endif loginAccount = AccountsManager::instance()->getAccountByHandle(handle); } @@ -820,13 +826,16 @@ void KMess::connected() // Show the connected message statusMessage( i18n("Connected"), false ); + // Start the chat history manager + ChatHistoryManager::setAccount( currentAccount_->getHandle() ); + // The connection was successful, this means the supplied // email and password were correct: save the settings now if( ! currentAccount_->getSavePassword() ) { // we reset the password here if it shouldn't be saved (so accountsmanager removes it) #ifdef KMESSDEBUG_KMESS - kDebug() << "Resetting password in currentAccount because it shouldn't be saved."; + kmDebug() << "Resetting password in currentAccount because it shouldn't be saved."; #endif currentAccount_->setPassword( "" ); } @@ -856,7 +865,7 @@ void KMess::connectWithAccount(Account *account) if(KMESS_NULL(account)) return; #ifdef KMESSDEBUG_KMESS - kDebug() << "Connecting account:" << account->getHandle(); + kmDebug() << "Connecting account:" << account->getHandle(); #endif startConnection( account ); @@ -868,7 +877,7 @@ void KMess::connectWithAccount(Account *account) void KMess::connectWithAccount(QString handle, QString password, bool rememberAccount, bool rememberPassword, bool autologin, Status initialStatus ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Connecting with handle " << handle; + kmDebug() << "Connecting with handle " << handle; #endif // Try to find an existing account @@ -942,7 +951,7 @@ void KMess::connectWithAccount(QString handle, QString password, bool rememberAc void KMess::reconnect() { #ifdef KMESSDEBUG - kDebug() << "Reconnecting"; + kmDebug() << "Reconnecting"; #endif connectWithAccount( currentAccount_ ); } @@ -953,7 +962,7 @@ void KMess::reconnect() bool KMess::createDirectories() { #ifdef KMESSDEBUG_KMESS - kDebug() << "Creating default directories."; + kmDebug() << "Creating default directories."; #endif KStandardDirs *dirs = KGlobal::dirs(); QString localKdeDir; @@ -961,7 +970,7 @@ bool KMess::createDirectories() localKdeDir = dirs->localkdedir(); #ifdef KMESSDEBUG_KMESS - kDebug() << "Local KDE dir is " << localKdeDir << "."; + kmDebug() << "Local KDE dir is " << localKdeDir << "."; #endif appsDir.setPath( localKdeDir + "/share/apps" ); @@ -969,12 +978,12 @@ bool KMess::createDirectories() { kmessDir.setPath( appsDir.absolutePath() + "/kmess" ); #ifdef KMESSDEBUG_KMESS - kDebug() << "kmess dir should be at " << kmessDir.absolutePath() << "."; + kmDebug() << "kmess dir should be at " << kmessDir.absolutePath() << "."; #endif if ( !kmessDir.exists() ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Creating kmess dir."; + kmDebug() << "Creating kmess dir."; #endif appsDir.mkdir( kmessDir.absolutePath() ); } @@ -982,7 +991,7 @@ bool KMess::createDirectories() #ifdef KMESSDEBUG_KMESS else { - kDebug() << "" << appsDir.absolutePath() << " doesn't exist!"; + kmDebug() << "" << appsDir.absolutePath() << " doesn't exist!"; } #endif #ifdef KMESSTEST @@ -1029,7 +1038,7 @@ void KMess::slotAccountDeleted( Account *account ) void KMess::slotContactAddedUserDialogChoice( const QString &handle, const QStringList &groupIds, const int code ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Contact" << handle << "added user, who has choosen option:" << code + kmDebug() << "Contact" << handle << "added user, who has choosen option:" << code << "Group list:" << groupIds; #endif @@ -1063,7 +1072,7 @@ void KMess::slotContactAddedUserDialogChoice( const QString &handle, const QStri void KMess::slotConnectionStatusChanged( Solid::Networking::Status newStatus ) { #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Solid status changed to " << newStatus; + kmDebug() << "Solid status changed to " << newStatus; #endif // If Solid is unable to retrieve the status, assume we're connected @@ -1095,7 +1104,7 @@ void KMess::disconnectClicked() KMESS_ASSERT( msnNotificationConnection_ != 0 ); #endif #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Disconnecting."; + kmDebug() << "Disconnecting."; #endif msnNotificationConnection_->closeConnection(); } @@ -1109,7 +1118,7 @@ void KMess::disconnected() KMESS_ASSERT( chatMaster_ != 0 ); #endif #ifdef KMESSDEBUG_KMESS - kDebug() << "Disconnected."; + kmDebug() << "Disconnected."; #endif // this method is also called when initializing the GUI, avoid mangling the settings at that point. @@ -1127,14 +1136,14 @@ void KMess::disconnected() if( account->isDeleted() ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Account" << account->getHandle() << "was deleted, removing menu items."; + kmDebug() << "Account" << account->getHandle() << "was deleted, removing menu items."; #endif slotAccountDeleted( account ); } else { #ifdef KMESSDEBUG_KMESS - kDebug() << "Saving the CurrentAccount."; + kmDebug() << "Saving the CurrentAccount."; #endif // Transfer account settings @@ -1163,14 +1172,14 @@ void KMess::disconnected() currentAccount_->setStatus( STATUS_OFFLINE ); currentAccount_->setAutoreply( false ); #ifdef KMESSDEBUG_KMESS - kDebug() << "Swap views."; + kmDebug() << "Swap views."; #endif // Show the screen where to insert login details to log back in switchViewToInitialScreen(); #ifdef KMESSDEBUG_KMESS - kDebug() << "Blank the caption."; + kmDebug() << "Blank the caption."; #endif // Set the caption @@ -1184,12 +1193,12 @@ bool KMess::initialize() { if ( initialized_ ) { - kDebug() << "Already initialized."; + kmDebug() << "Already initialized."; return false; } #ifdef KMESSDEBUG_KMESS - kDebug() << "initializing main class."; + kmDebug() << "initializing main class."; #endif // Initialize the Rich Text parser engine @@ -1199,52 +1208,52 @@ bool KMess::initialize() currentAccount_ = CurrentAccount::instance(); if ( currentAccount_ == 0 ) { - kDebug() << "Couldn't get a pointer to the instance of the current account."; + kmDebug() << "Couldn't get a pointer to the instance of the current account."; return false; } if ( !KMessInterface::initialize() ) { - kDebug() << "Couldn't initialize ancestor."; + kmDebug() << "Couldn't initialize ancestor."; return false; } if ( !initMsnNotificationConnection() ) { - kDebug() << "Couldn't initialize the MsnNotificationConnection class."; + kmDebug() << "Couldn't initialize the MsnNotificationConnection class."; return false; } if ( !initIdleTimer() ) { - kDebug() << "Couldn't initialize the IdleTimer class."; + kmDebug() << "Couldn't initialize the IdleTimer class."; return false; } if ( !initChatMaster() ) { - kDebug() << "Couldn't initialize the Chat master."; + kmDebug() << "Couldn't initialize the Chat master."; return false; } if ( !initNotifications() ) { - kDebug() << "Couldn't initialize the notifications."; + kmDebug() << "Couldn't initialize the notifications."; return false; } if ( !initNowListening() ) { - kDebug() << "Couldn't initialize the now listening support."; + kmDebug() << "Couldn't initialize the now listening support."; return false; } if ( !initEmoticonManager() ) { - kDebug() << "Couldn't initialize the emoticon manager."; + kmDebug() << "Couldn't initialize the emoticon manager."; return false; } if ( !initProxy() ) { - kDebug() << "Couldn't initialize the proxy support."; + kmDebug() << "Couldn't initialize the proxy support."; return false; } if ( !createDirectories() ) { - kDebug() << "Couldn't create local KDE directories."; + kmDebug() << "Couldn't create local KDE directories."; return false; } @@ -1256,7 +1265,6 @@ bool KMess::initialize() // Connect current account signals for Now Listening connect( currentAccount_, SIGNAL( changedStatus() ), this, SLOT ( changedNowListeningSettings() )); - // Connect current account connect( currentAccount_, SIGNAL( changedFriendlyName() ), this, SLOT ( setCaptionToUser() )); @@ -1295,7 +1303,7 @@ bool KMess::initialize() // Added debug here because this has a potential to cause problems.. // It would be better if each class got things right from it's construtor or initialize method. #ifdef KMESSDEBUG_KMESS - kDebug() << "faking disconnect signal."; + kmDebug() << "faking disconnect signal."; #endif disconnected(); @@ -1304,7 +1312,7 @@ bool KMess::initialize() // All done, mark as initialized #ifdef KMESSDEBUG_KMESS - kDebug() << "main class is initialized."; + kmDebug() << "main class is initialized."; #endif initialized_ = true; @@ -1321,18 +1329,18 @@ bool KMess::initChatMaster() #endif if ( msnNotificationConnection_ == 0 ) { - kDebug() << "The notification connection must be initialized before the chat master."; + kmDebug() << "The notification connection must be initialized before the chat master."; return false; } chatMaster_ = new ChatMaster( this ); if ( chatMaster_ == 0 ) { - kDebug() << "Couldn't create the chat master."; + kmDebug() << "Couldn't create the chat master."; return false; } if ( !chatMaster_->initialize() ) { - kDebug() << "Couldn't initialize the chat master."; + kmDebug() << "Couldn't initialize the chat master."; return false; } @@ -1373,7 +1381,7 @@ bool KMess::initEmoticonManager() { if ( msnNotificationConnection_ == 0 ) { - kDebug() << "MsnNotificationConnection must be initialized before EmoticonManager"; + kmDebug() << "MsnNotificationConnection must be initialized before EmoticonManager"; return false; } @@ -1398,7 +1406,7 @@ bool KMess::initIdleTimer() idleTimer_ = new IdleTimer(); if ( idleTimer_ == 0 ) { - kDebug() << "Couldn't create the idle timer."; + kmDebug() << "Couldn't create the idle timer."; return false; } // Connect the timer to signal when the user is away. @@ -1424,7 +1432,7 @@ bool KMess::initMsnNotificationConnection() initialized = msnNotificationConnection_->initialize(); if ( !initialized ) { - kDebug() << "Couldn't initialize MsnNotificationConnection."; + kmDebug() << "Couldn't initialize MsnNotificationConnection."; return false; } @@ -1454,18 +1462,19 @@ bool KMess::initNotifications() KMESS_ASSERT( chatNotification_ == 0 ); KMESS_ASSERT( contactStatusNotification_ == 0 ); KMESS_ASSERT( newEmailNotification_ == 0 ); + KMESS_ASSERT( addressBookNotifications_ == 0 ); #endif const ContactList *contactList; if ( systemTrayWidget_ == 0 ) { - kDebug() << "The system tray widget must be initialized before the notifications!"; + kmDebug() << "The system tray widget must be initialized before the notifications!"; return false; } if ( msnNotificationConnection_ == 0 ) { - kDebug() << "The notification connection must be initialized before the notifications!"; + kmDebug() << "The notification connection must be initialized before the notifications!"; return false; } @@ -1486,7 +1495,7 @@ bool KMess::initNotifications() } // Always show warning at the console. - kWarning() << "Sounds and notifications will not be available, the file 'kmess/kmess.notifyrc' could not be found."; + kmWarning() << "Sounds and notifications will not be available, the file 'kmess/kmess.notifyrc' could not be found."; // Show the message in the GUI as well. // Allow to user to choose "don't show this message again", in case he/she doesn't know how to fix it. @@ -1512,8 +1521,9 @@ bool KMess::initNotifications() chatNotification_ = new ChatNotification ( notificationManager_ ); contactStatusNotification_ = new ContactStatusNotification( notificationManager_ ); newEmailNotification_ = new NewEmailNotification ( notificationManager_ ); + addressBookNotifications_ = new AddressBookNotifications ( notificationManager_ ); - // Connect the chat messages notification signals + // Connect the chat messages notification signals connect( chatMaster_, SIGNAL( newChatMessage(const ChatMessage&, Chat*) ), chatNotification_, SLOT ( notify(const ChatMessage&, Chat*) ) ); connect( chatNotification_, SIGNAL( raiseChat(Chat*,bool) ), @@ -1527,10 +1537,13 @@ bool KMess::initNotifications() connect( contactList, SIGNAL( contactChangedStatus(Contact*,bool) ), contactStatusNotification_, SLOT ( notify(Contact*,bool) ) ); - // Connect the "Email notification" signals + // Connect the "Email notification" signals. connect( msnNotificationConnection_, SIGNAL( newEmail(QString, QString, bool, QString, QString, QString) ), newEmailNotification_, SLOT ( notify(QString, QString, bool, QString, QString, QString) ) ); + connect( msnNotificationConnection_, SIGNAL( addressBookChanged( const QString&, AddressBookService::AddressBookUpdate ) ), + addressBookNotifications_, SLOT( notify( const QString&, AddressBookService::AddressBookUpdate ) ) ); + // Connect the "Chat request" signals connect( contactStatusNotification_, SIGNAL( startChat(QString) ), chatMaster_, SLOT ( requestChat(QString) ) ); @@ -1540,6 +1553,7 @@ bool KMess::initNotifications() KMESS_ASSERT( chatNotification_ != 0 ); KMESS_ASSERT( contactStatusNotification_ != 0 ); KMESS_ASSERT( newEmailNotification_ != 0 ); + KMESS_ASSERT( addressBookNotifications_ != 0 ); #endif return true; @@ -1552,7 +1566,7 @@ bool KMess::initNowListening() { if ( msnNotificationConnection_ == 0 ) { - kDebug() << "The notification connection must be initialized before the now listening support!"; + kmDebug() << "The notification connection must be initialized before the now listening support!"; return false; } @@ -1576,7 +1590,7 @@ bool KMess::initProxy() if( ! KProtocolManager::useProxy() ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "No proxy support is needed (kde's proxy is turned off)."; + kmDebug() << "No proxy support is needed (kde's proxy is turned off)."; #endif return true; } @@ -1587,13 +1601,13 @@ bool KMess::initProxy() if( proxyAddress.isEmpty() || proxyAddress == "DIRECT" ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "No proxy support is needed (no proxy is needed for HTTPS traffic)."; + kmDebug() << "No proxy support is needed (no proxy is needed for HTTPS traffic)."; #endif return true; } #ifdef KMESSDEBUG_KMESS - kDebug() << "Proxy URL:" << proxyAddress; + kmDebug() << "Proxy URL:" << proxyAddress; #endif KUrl proxyUrl( proxyAddress ); @@ -1638,7 +1652,7 @@ bool KMess::isConnected() void KMess::readGlobalProperties( KConfig *sessionConfig ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Loading current state..."; + kmDebug() << "Loading current state..."; #endif KConfigGroup settings( sessionConfig->group( "state" ) ); @@ -1660,7 +1674,7 @@ void KMess::readGlobalProperties( KConfig *sessionConfig ) void KMess::saveGlobalProperties( KConfig *sessionConfig ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Saving current state..."; + kmDebug() << "Saving current state..."; #endif KConfigGroup settings( sessionConfig->group( "state" ) ); @@ -1681,7 +1695,7 @@ void KMess::saveGlobalProperties( KConfig *sessionConfig ) void KMess::readProperties( const KConfigGroup &config ) { #ifdef KMESSDEBUG_KMESS - kDebug() << "Reading properties"; + kmDebug() << "Reading properties"; #endif KConfigGroup group; @@ -1720,7 +1734,7 @@ void KMess::saveProperties( KConfigGroup &config ) KMessInterface::saveProperties( group ); #ifdef KMESSDEBUG_KMESS - kDebug() << "saving properties"; + kmDebug() << "saving properties"; #endif // Have all the accounts save their properties @@ -1738,7 +1752,7 @@ void KMess::saveProperties( KConfigGroup &config ) { // Move the settings from the current account to the account #ifdef KMESSDEBUG_KMESS - kDebug() << "copying settings from CurrentAccount to the Account object."; + kmDebug() << "copying settings from CurrentAccount to the Account object."; #endif account->copyAccount( currentAccount_ ); } @@ -1838,7 +1852,7 @@ void KMess::startConnection( Account *account ) // Copy the account to the current account #ifdef KMESSDEBUG_KMESS - kDebug() << "copying data of account" << account->getHandle() << "to the CurrentAccount object."; + kmDebug() << "copying data of account" << account->getHandle() << "to the CurrentAccount object."; #endif currentAccount_->copyAccount( account ); @@ -2031,18 +2045,18 @@ void KMess::updateContextMenu( const QItemSelection &selection ) void KMess::userIsIdle() { #ifdef KMESSDEBUG_IDLETIMER - kDebug(); + kmDebug(); #endif if ( ( currentAccount_ != 0 ) && ( msnNotificationConnection_ != 0 ) ) { #ifdef KMESSDEBUG_IDLETIMER - kDebug() << "Current status is " << currentAccount_->getStatus() << "."; + kmDebug() << "Current status is " << currentAccount_->getStatus() << "."; #endif // Only change the state if the user is currently set as online if ( currentAccount_->getStatus() == STATUS_ONLINE ) { #ifdef KMESSDEBUG_IDLETIMER - kDebug() << "Change status to Idle."; + kmDebug() << "Change status to Idle."; #endif // Request a status change to Idle msnNotificationConnection_->changeStatus( STATUS_IDLE ); @@ -2057,25 +2071,25 @@ void KMess::userIsIdle() void KMess::userIsNotIdle() { #ifdef KMESSDEBUG_IDLETIMER - kDebug(); + kmDebug(); #endif if ( ( currentAccount_ != 0 ) && ( msnNotificationConnection_ != 0 ) ) { #ifdef KMESSDEBUG_IDLETIMER - kDebug() << "User is no longer idle, current status is " << currentAccount_->getStatus(); + kmDebug() << "User is no longer idle, current status is " << currentAccount_->getStatus(); #endif // Only change the state if the user is currently set as idle AND the idle status was not forced by the user if ( currentAccount_->getStatus() == STATUS_IDLE && ! isIdleForced_ ) { #ifdef KMESSDEBUG_IDLETIMER - kDebug() << "Change status to Online"; + kmDebug() << "Change status to Online"; #endif // Request a status change to Online msnNotificationConnection_->changeStatus( STATUS_ONLINE ); } } #ifdef KMESSDEBUG_IDLETIMER - kDebug() << "Done userIsNotIdle()."; + kmDebug() << "Done userIsNotIdle()."; #endif } diff --git a/src/kmess.h b/src/kmess.h index 41b13c4..45eef38 100644 --- a/src/kmess.h +++ b/src/kmess.h @@ -34,9 +34,11 @@ class ChatMaster; class Contact; class ContactList; class NotificationManager; +class ChatHistory; class ChatNotification; class ContactStatusNotification; class NewEmailNotification; +class AddressBookNotifications; class CurrentAccount; class IdleTimer; class InitialView; @@ -224,6 +226,8 @@ class KMess : public KMessInterface ContactStatusNotification *contactStatusNotification_; // The notification object for when a new email is received NewEmailNotification *newEmailNotification_; + // The notification object for when a new contact added + AddressBookNotifications *addressBookNotifications_; // A pointer to the instance of the current account CurrentAccount *currentAccount_; // The idle timer diff --git a/src/kmessapplication.cpp b/src/kmessapplication.cpp index 5358de0..09886d9 100644 --- a/src/kmessapplication.cpp +++ b/src/kmessapplication.cpp @@ -49,9 +49,9 @@ KMessApplication::KMessApplication() #endif #ifdef KMESSTEST - kDebug() << "Starting KMess " KMESS_VERSION " on" << QDateTime::currentDateTime().toString( Qt::ISODate ); - kDebug() << "Compiled with KDE" KDE_VERSION_STRING ", Qt" QT_VERSION_STR; - kDebug() << "Running on KDE" << KDE::versionString() << ", Qt" << qVersion(); + kmDebug() << "Starting KMess " KMESS_VERSION " on" << QDateTime::currentDateTime().toString( Qt::ISODate ); + kmDebug() << "Compiled with KDE" KDE_VERSION_STRING ", Qt" QT_VERSION_STR; + kmDebug() << "Running on KDE" << KDE::versionString() << ", Qt" << qVersion(); #endif // Install our crash handler. @@ -129,7 +129,7 @@ void KMessApplication::initializeMainWindow() while( KMainWindow::canBeRestored( ++n ) ) { #ifdef KMESSDEBUG_KMESSAPPLICATION - kDebug() << "Checking if window" << n << "named" << KMainWindow::classNameOfToplevel( n ) << "can be restored..."; + kmDebug() << "Checking if window" << n << "named" << KMainWindow::classNameOfToplevel( n ) << "can be restored..."; #endif if( KMainWindow::classNameOfToplevel( n ) != QLatin1String( "KMess" ) ) { @@ -137,7 +137,7 @@ void KMessApplication::initializeMainWindow() } #ifdef KMESSDEBUG_KMESSAPPLICATION - kDebug() << "Contact List window found!"; + kmDebug() << "Contact List window found!"; #endif restoredWindow = n; break; @@ -211,7 +211,7 @@ void KMessApplication::initializePaths() // Test whether the prefix is correct. if( KGlobal::dirs()->findResource( "appdata", "pics/kmesspic.png" ).isNull() ) { - kWarning() << "KMess could not find resources in the search paths: " + kmWarning() << "KMess could not find resources in the search paths: " << KGlobal::dirs()->findDirs( "appdata", QString::null ).join(", ") << endl; } } @@ -226,7 +226,7 @@ void KMessApplication::slotAboutToQuit() // No user-interaction is possible here anymore..! #ifdef KMESSDEBUG_KMESSAPPLICATION - kDebug() << "KMess is about to quit..."; + kmDebug() << "KMess is about to quit..."; #endif } @@ -246,7 +246,7 @@ void KMessApplication::slotLastWindowClosed() if( quitSelected_ || sessionSaving() ) { #ifdef KMESSDEBUG_KMESSAPPLICATION - kDebug() << "Last window closed, user really wants to quit now. Initiate quit() call."; + kmDebug() << "Last window closed, user really wants to quit now. Initiate quit() call."; #endif quit(); @@ -254,7 +254,7 @@ void KMessApplication::slotLastWindowClosed() else { #ifdef KMESSDEBUG_KMESSAPPLICATION - kDebug() << "User closed last window, but keep KMess running with all windows closed."; + kmDebug() << "User closed last window, but keep KMess running with all windows closed."; #endif } } diff --git a/src/kmessdebug.cpp b/src/kmessdebug.cpp index 6ddf1aa..009a414 100644 --- a/src/kmessdebug.cpp +++ b/src/kmessdebug.cpp @@ -24,6 +24,7 @@ #include + // kmessdebug.h adds a KMESS_NULL macro to detect // and display null pointer warnings. This is used // in a " if(KMESS_NULL(var)) return; " statement @@ -49,7 +50,7 @@ { if( isNull ) { - kWarning().nospace() << "'" << var << "' should not be null in " << funcinfo << ", " << file << " (" << line << ")!"; + kmWarning().nospace() << "'" << var << "' should not be null in " << funcinfo << ", " << file << " (" << line << ")!"; } return isNull; @@ -69,7 +70,7 @@ bool _kmessWarnNull(bool isNull, const char *var, const char *funcinfo) { if(isNull) - kWarning() << "'" << var << "' should not be null in " << funcinfo << "!"; + kmWarning() << "'" << var << "' should not be null in " << funcinfo << "!"; return isNull; } @@ -98,60 +99,6 @@ bool _kmessAssert( const char *assertion, const char *file, int line ) -#ifdef KMESS_NETWORK_WINDOW - - // The network window can optionally be compiled. - // The macro's from kmessdebug.h make it easy to handle this - // without optionally depending on networkwindow.h everywhere. - - #include "dialogs/networkwindow.h" - - /** - * @brief Inform the network window the connection was closed, used by KMESS_NET_CLOSE. - * @param connection Reference to the caller object, to distinguish between connections. - * @ingroup Debug - */ - void _kmessNetClose(QObject *connection) - { - NetworkWindow::instance()->connectionClosed(connection); - } - - /** - * @brief Inform the network window about a new connection, used by KMESS_NET_INIT. - * @param connection Reference to the caller object, to distinguish between connections. - * @param title The title for the connection in the network window. - * @ingroup Debug - */ - void _kmessNetInit(QObject *connection, const QString &title) - { - NetworkWindow::instance()->setConnectionTitle(connection, title); - } - - /** - * @brief Add the received data to the network window, used by KMESS_NET_RECEIVED. - * @param connection Reference to the caller object, to distinguish between connections. - * @param message The data received from the connection, should be a complete message. - * @ingroup Debug - */ - void _kmessNetReceived(QObject *connection, const QByteArray &message) - { - NetworkWindow::instance()->addIncomingMessage(connection, message); - } - - /** - * @brief Add the sent data to the network window, used by KMESS_NET_SENT. - * @param connection Reference to the caller object, to distinguish between connections. - * @param message The data sent to the connection, should be a complete message. - * @ingroup Debug - */ - void _kmessNetSent(QObject *connection, const QByteArray &message) - { - NetworkWindow::instance()->addOutgoingMessage(connection, message); - } - -#endif - - /** * @brief A Qt debug message handler. * diff --git a/src/kmessdebug.h b/src/kmessdebug.h index 12c417c..a0b7813 100644 --- a/src/kmessdebug.h +++ b/src/kmessdebug.h @@ -20,7 +20,9 @@ #include "config-kmess.h" -// Since all debugging code uses kDebug(), this is also a good +#include + +// Since all debugging code uses kmDebug(), this is also a good // reason to include this file by default so no one else has to. #include @@ -68,6 +70,8 @@ #define KMESSDEBUG_CHATMASTER #define KMESSDEBUG_CHAT + #define KMESSDEBUG_CHATHISTORYMANAGER + #define KMESSDEBUG_CHATHISTORYWRITER #define KMESSDEBUG_CHATWINDOW #define KMESSDEBUG_CHATVIEW #define KMESSDEBUG_CHATMESSAGEVIEW @@ -115,6 +119,7 @@ #define KMESSDEBUG_CONTACTSTATUSNOTIFICATION #define KMESSDEBUG_CHATNOTIFICATION #define KMESSDEBUG_NEWEMAILNOTIFICATION + #define KMESSDEBUG_ADDRESSBOOKNOTIFICATIONS #endif @@ -133,6 +138,33 @@ #endif + +// KDE custom debug logging functions + +/** + * @brief Register a KDE debug area. + * + * This function will be used by kmDebug(), kWarning() calls throughout KMess + * to enable debug output. + * + * @return Debug area number + */ +inline int debugArea() +{ +#if KDE_IS_VERSION( 4, 4, 0 ) + static int s_area = KDebug::registerArea( "kmess" ); + return s_area; +#else + return 5130; // This number was assigned to us in KDE 4.3 +#endif +} + +#define kmDebug() kDebug( debugArea() ) +#define kmWarning() kWarning( debugArea() ) +#define kmError() kError( debugArea() ) + + + // Debug macro to warn for null pointers #ifdef KMESSTEST // Warns that a pointer was null, full debug version @@ -167,16 +199,16 @@ class QObject; // Inform the network window the connection was closed - void _kmessNetClose(QObject *connection); + extern void _kmessNetClose(QObject *connection); // Inform the network window about a new connection - void _kmessNetInit(QObject *connection, const QString &title); + extern void _kmessNetInit(QObject *connection, const QString &title); // Add the received data to the network window - void _kmessNetReceived(QObject *connection, const QByteArray &message); + extern void _kmessNetReceived(QObject *connection, const QByteArray &message); // Add the sent data to the network window - void _kmessNetSent(QObject *connection, const QByteArray &message); + extern void _kmessNetSent(QObject *connection, const QByteArray &message); // Wrapper macro, call network window when it's compiled #define KMESS_NET_CLOSE(c) (_kmessNetClose(c)) diff --git a/src/kmessinterface.cpp b/src/kmessinterface.cpp index 0be8ddf..9c2c439 100644 --- a/src/kmessinterface.cpp +++ b/src/kmessinterface.cpp @@ -70,7 +70,7 @@ KMessInterface::~KMessInterface() delete statusLabel_; #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -79,7 +79,7 @@ KMessInterface::~KMessInterface() // "Add a new contact" was selected from the menu. void KMessInterface::addNewContact() { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } // Show the chat history dialog and, if requested, that of a specific contact @@ -87,20 +87,20 @@ void KMessInterface::showChatHistory( const QString &handle ) { Q_UNUSED( handle ); - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } // "Add a new group" was selected from the menu. void KMessInterface::addNewGroup() { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } // The application is closing, after queryExit() was approved void KMessInterface::applicationClosing() { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -108,7 +108,7 @@ void KMessInterface::applicationClosing() // A view pictures mode has been selected from the menu. void KMessInterface::changedListPictureSize( int /*mode*/ ) { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -118,7 +118,7 @@ void KMessInterface::changeStatus( QAction *action ) { Q_UNUSED( action ); - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -126,27 +126,27 @@ void KMessInterface::changeStatus( QAction *action ) // A view mode has been selected from the menu. void KMessInterface::changeViewMode(int /*mode*/) { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } void KMessInterface::showListExportDialog() { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } void KMessInterface::showNetworkWindow() { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } void KMessInterface::showTransferWindow() { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -303,7 +303,7 @@ void KMessInterface::createMenus() // "Add new account" has been selected from the menu. void KMessInterface::createNewAccount() { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -311,7 +311,7 @@ void KMessInterface::createNewAccount() // Disconnect was selected from the menu. void KMessInterface::disconnectClicked() { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -338,11 +338,11 @@ void KMessInterface::enableMenus(bool connected) bool KMessInterface::initialize() { #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "initializing"; + kmDebug() << "initializing"; #endif if ( initialized_ ) { - kDebug() << "already initialized."; + kmDebug() << "already initialized."; return false; } @@ -401,12 +401,12 @@ bool KMessInterface::initialize() if ( ! initSystemTrayWidget() ) { - kDebug() << "Couldn't initialize the system tray widget."; + kmDebug() << "Couldn't initialize the system tray widget."; return false; } #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "initialized"; + kmDebug() << "initialized"; #endif return true; } @@ -420,7 +420,7 @@ bool KMessInterface::initSystemTrayWidget() systemTrayWidget_ = new SystemTrayWidget( this ) ; if ( systemTrayWidget_ == 0 ) { - kDebug() << "Couldn't create system tray widget."; + kmDebug() << "Couldn't create system tray widget."; return false; } @@ -450,7 +450,7 @@ bool KMessInterface::initSystemTrayWidget() void KMessInterface::menuClose() { #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "'Close' was selected from the menu."; + kmDebug() << "'Close' was selected from the menu."; #endif // Hide the window @@ -469,7 +469,7 @@ void KMessInterface::menuClose() void KMessInterface::menuQuit() { #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "'Quit' was selected from the menu."; + kmDebug() << "'Quit' was selected from the menu."; #endif // Tell the application manager we want to quit @@ -493,7 +493,7 @@ bool KMessInterface::queryExit() kmessApp->sessionSaving() ) { #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Accepting exit request."; + kmDebug() << "Accepting exit request."; #endif return true; @@ -504,7 +504,7 @@ bool KMessInterface::queryExit() // Reject the request again. #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Rejecting exit request! Keep running with all windows hidden."; + kmDebug() << "Rejecting exit request! Keep running with all windows hidden."; #endif return false; @@ -525,7 +525,7 @@ bool KMessInterface::queryClose() kmessApp->sessionSaving() ) { #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Accepting quit request."; + kmDebug() << "Accepting quit request."; #endif // Make sure that substituent also return true @@ -543,7 +543,7 @@ bool KMessInterface::queryClose() systemTrayWidget_->displayCloseMessage(); #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Rejecting quit request, hiding window"; + kmDebug() << "Rejecting quit request, hiding window"; #endif // Only hide, disallow event @@ -558,7 +558,7 @@ bool KMessInterface::queryClose() void KMessInterface::readProperties( const KConfigGroup &config ) { #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Reading properties"; + kmDebug() << "Reading properties"; #endif KConfigGroup group; @@ -615,7 +615,7 @@ void KMessInterface::readProperties( const KConfigGroup &config ) void KMessInterface::saveProperties(KConfigGroup &config) { #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Saving properties"; + kmDebug() << "Saving properties"; #endif KConfigGroup group; @@ -642,7 +642,7 @@ void KMessInterface::saveProperties(KConfigGroup &config) group.writeEntry("Lock Toolbar", toolBar( "mainToolBar" )->toolBarsLocked());*/ #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Done saving properties"; + kmDebug() << "Done saving properties"; #endif } @@ -720,7 +720,7 @@ void KMessInterface::showStatusBar() // Show the user's MSN profile. void KMessInterface::showUserProfile() { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } // Change the status bar message. @@ -732,7 +732,7 @@ void KMessInterface::statusMessage( QString message, bool isError ) message_ = message; #ifdef KMESSDEBUG_KMESSINTERFACE - kDebug() << "Changed message to" << message; + kmDebug() << "Changed message to" << message; #endif } @@ -761,7 +761,7 @@ void KMessInterface::statusMessage( QString message, bool isError ) // The "show allowed contacts" menu item has been toggled. void KMessInterface::toggleShowAllowed(bool /*show*/) { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -769,7 +769,7 @@ void KMessInterface::toggleShowAllowed(bool /*show*/) // The "show empty groups" menu item has been toggled. void KMessInterface::toggleShowEmpty(bool /*show*/) { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -777,7 +777,7 @@ void KMessInterface::toggleShowEmpty(bool /*show*/) // The "show history box" menu item has been toggled. void KMessInterface::toggleShowHistoryBox(bool /*show*/) { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -785,7 +785,7 @@ void KMessInterface::toggleShowHistoryBox(bool /*show*/) // The "show search in contact list" menu item has been toggled. void KMessInterface::toggleShowSearchFrame(bool /*show*/) { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -793,7 +793,7 @@ void KMessInterface::toggleShowSearchFrame(bool /*show*/) // The "show offline contacts" menu item has been toggled. void KMessInterface::toggleShowOffline(bool /*show*/) { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } @@ -801,7 +801,7 @@ void KMessInterface::toggleShowOffline(bool /*show*/) // The "show removed contacts" menu item has been toggled. void KMessInterface::toggleShowRemoved(bool /*show*/) { - kDebug() << "not implemented"; + kmDebug() << "not implemented"; } diff --git a/src/kmesstest.cpp b/src/kmesstest.cpp index e629b07..fc030a7 100644 --- a/src/kmesstest.cpp +++ b/src/kmesstest.cpp @@ -18,6 +18,8 @@ #include "kmesstest.h" #include "chat/chat.h" +#include "chat/chathistorymanager.h" +#include "chat/chathistorywriter.h" #include "chat/chatmaster.h" #include "chat/chatview.h" #include "chat/chatwindow.h" @@ -79,7 +81,7 @@ KMessTest::KMessTest(KMess *kmess) // The destructor KMessTest::~KMessTest() { - kDebug() << "DESTROYED"; + kmDebug() << "DESTROYED"; } @@ -96,9 +98,9 @@ void KMessTest::runTest( const QString &testName ) // Add the tests, which can be run from debug builds using: // ./kmess --runtest - kDebug() << "Running test:" << testName; - kDebug() << "----------------------------------------"; - kDebug(); + kmDebug() << "Running test:" << testName; + kmDebug() << "----------------------------------------"; + kmDebug(); QStringList testcases; @@ -124,8 +126,8 @@ void KMessTest::runTest( const QString &testName ) TESTCASE( "systemtray", testSystemTray() ); TESTCASE( "offlinemessages", testOfflineMessages() ); qSort( testcases ); - kDebug() << "Test case not found, available cases:"; - kDebug() << testcases.join( ", " ); + kmDebug() << "Test case not found, available cases:"; + kmDebug() << testcases.join( ", " ); quitAfterTest_ = true; } @@ -135,14 +137,14 @@ void KMessTest::runTest( const QString &testName ) // Cleans up and schedules quitting kmess if necessary void KMessTest::endTest() { - kDebug(); - kDebug() << "----------------------------------------"; + kmDebug(); + kmDebug() << "----------------------------------------"; if( quitAfterTest_ ) { // We can't quit (and also clean up the memory) now, since // the event loop hasn't started yet. Delay it a bit. - kDebug() << "Test case ended, quitting KMess."; + kmDebug() << "Test case ended, quitting KMess."; kmessApp_->setQuitSelected( true ); QTimer::singleShot( 1000, kmess_, SLOT( menuQuit() ) ); @@ -154,12 +156,19 @@ void KMessTest::endTest() void KMessTest::testChatHistoryDialog() { testGroupsAndContacts(); - CurrentAccount::instance()->setLoginInformation("amroth@coldshock.net", "Testing Account", "test" ); + CurrentAccount::instance()->setLoginInformation( "thorless@hotmail.com", "Testing Account", "test" ); - ChatHistoryDialog *dialog = new ChatHistoryDialog( kmess_ ); +// ChatHistoryDialog *dialog = new ChatHistoryDialog( kmess_ ); +// dialog->setInitialContact( CurrentAccount::instance()->getHandle(), "test2@test.com" ); +// dialog->exec(); -// dialog->setContact( "test@test.com" ); - dialog->exec(); + ChatHistoryManager::setAccount( "thorless@hotmail.com" ); + +// ChatHistoryWriter* writer = ChatHistoryManager::getWriter( "starforcer@hotmail.com" ); +// writer-> + +// ChatHistoryManager::lastChatLog("contact@msn.com" ); +// kmDebug() << "Last chat history operation's result:" << ChatHistoryManager::result(); quitAfterTest_ = true; } @@ -173,13 +182,13 @@ void KMessTest::testTransferWindow() TransferWindow *instance = TransferWindow::getInstance(); id = instance->addEntry( "Filename1", 1234567890, true, QImage( loader->iconPath( "list-add", 48, false ) ) ); - kDebug() << "Added ID: " << id; + kmDebug() << "Added ID: " << id; id = instance->addEntry( "Filename2", 34567890, false, QImage( loader->iconPath( "list-remove", 48, false ) ) ); - kDebug() << "Added ID: " << id; + kmDebug() << "Added ID: " << id; id = instance->addEntry( "Filename3", 567890, true ); - kDebug() << "Added ID: " << id; + kmDebug() << "Added ID: " << id; // TransferWindow::destroy(); } @@ -219,7 +228,7 @@ void KMessTest::testChatWindow() } // Contact-started group chat - if( 1 ) + if( 0 ) { MsnSwitchboardConnection *sb3 = new MsnSwitchboardConnection(); ChatInformation chatInfo3( kmess_->msnNotificationConnection_, "contact2@kmess.org", "127.0.0.1", 1234, "5678.8765", "-1", ChatInformation::CONNECTION_OFFLINE ); @@ -344,7 +353,7 @@ void KMessTest::testAddContactDialog() QStringList groupsId; new AddContactDialog( handle, groupsId ); - kDebug() << "adding " << handle << "on groups: " << groupsId; + kmDebug() << "adding " << handle << "on groups: " << groupsId; } @@ -355,9 +364,9 @@ void KMessTest::testChallengeHandler() // Tested with // PRODUCT_KEY "ILTXC!4IXB5FB*PX" // PRODUCT_ID "PROD0119GSJUC$18" - kDebug() << handler.computeHash( "TEST"); // "299ef8849928ab29512748d378cb93b0" - kDebug() << handler.computeHash( "KMessTest"); // "6e7fbd3c1457c4192d18bc9d19ef4e3e" - kDebug() << handler.computeHash( "KMessKMessKmess"); // "736d5611bdd0f6f60b93343e169c6192" + kmDebug() << handler.computeHash( "TEST"); // "299ef8849928ab29512748d378cb93b0" + kmDebug() << handler.computeHash( "KMessTest"); // "6e7fbd3c1457c4192d18bc9d19ef4e3e" + kmDebug() << handler.computeHash( "KMessKMessKmess"); // "736d5611bdd0f6f60b93343e169c6192" } @@ -381,20 +390,20 @@ void KMessTest::testContactAddedUserDialogSlot( const QString &handle, const QSt switch( (ContactAddedUserDialog::ReturnCode) code ) { case ContactAddedUserDialog::ADD: - kDebug() << "result: Add contact" << handle; - kDebug() << "result: Adding in groups" << groupsId; + kmDebug() << "result: Add contact" << handle; + kmDebug() << "result: Adding in groups" << groupsId; break; case ContactAddedUserDialog::ALLOW: - kDebug() << "result: Allow contact" << handle; + kmDebug() << "result: Allow contact" << handle; break; case ContactAddedUserDialog::BLOCK: - kDebug() << "result: Block contact" << handle; + kmDebug() << "result: Block contact" << handle; break; default: - kDebug() << "result: undefined, contact:" << handle; + kmDebug() << "result: undefined, contact:" << handle; break; } } @@ -462,8 +471,9 @@ void KMessTest::testGroupsAndContacts() account->setFontInformation( QFont( "Monospace", 16 ), "#FF9900", QFont( "Serif", 12 ), "#99FF00" ); account->setShowSessionInfo( true ); account->setChatInformation( true, true, true, true, true, true, true, true, true, true, 0, "Fresh" ); - account->setChatLoggingInformation( true, false, Account::EXPORT_HTML, "/home/valerio/kmess/logs", Account::SINGLEDIRECTORY ); + account->setChatLoggingInformation( true, true, Account::EXPORT_HTML, "/home/valerio/KILLME/logs", Account::BYYEAR ); + ChatHistoryManager::setAccount( account->getHandle() ); Group *group; Contact *contact; @@ -544,7 +554,7 @@ void KMessTest::testContactList() // A generic method to use as throwaway slot for delayed code void KMessTest::testContactListSlot() { - kDebug() << "TEST - Switching contact status"; + kmDebug() << "TEST - Switching contact status"; ContactList *list = kmess_->msnNotificationConnection_->contactList_; static int i=0; @@ -639,7 +649,7 @@ void KMessTest::benchmarkParser() foreach( QString origstr, strings ) { timeTaken = 0; - kDebug() << timesToBenchmark << "times, string:" << origstr; + kmDebug() << timesToBenchmark << "times, string:" << origstr; startTime = QTime::currentTime(); for( i = 0; i < timesToBenchmark; ++i ) @@ -651,7 +661,7 @@ void KMessTest::benchmarkParser() oldtotal += (-timeTaken); olds = (-timeTaken) / 1000; oldms = (-timeTaken) % 1000; - kDebug() << "Old parser:" << olds << "s" << oldms << "msec"; + kmDebug() << "Old parser:" << olds << "s" << oldms << "msec"; startTime = QTime::currentTime(); for( i = 0; i < timesToBenchmark; ++i) @@ -663,21 +673,21 @@ void KMessTest::benchmarkParser() newtotal += (-timeTaken); news = (-timeTaken) / 1000; newms = (-timeTaken) % 1000; - kDebug() << "New parser:" << news << "s" << newms << "msec"; + kmDebug() << "New parser:" << news << "s" << newms << "msec"; if( str != str2 ) { - kWarning() << "Result mismatch!"; + kmWarning() << "Result mismatch!"; } } - kDebug() << "** Grand Totals: **"; + kmDebug() << "** Grand Totals: **"; olds = oldtotal / 1000; oldms = oldtotal % 1000; news = newtotal / 1000; newms = newtotal % 1000; - kDebug() << "Old parser:" << olds << "s" << oldms << "msec"; - kDebug() << "New parser:" << news << "s" << newms << "msec"; + kmDebug() << "Old parser:" << olds << "s" << oldms << "msec"; + kmDebug() << "New parser:" << news << "s" << newms << "msec"; } @@ -799,7 +809,7 @@ void KMessTest::testXslTransformation() bool open = file.open(QIODevice::ReadOnly); if( ! open) { - kWarning() << "Could not open file: " << file.fileName(); + kmWarning() << "Could not open file: " << file.fileName(); return; } @@ -809,8 +819,8 @@ void KMessTest::testXslTransformation() file.close(); // Transform XML - kDebug() << "XSL transformation result:"; - kDebug() << xsl->convertXmlString(xml); + kmDebug() << "XSL transformation result:"; + kmDebug() << xsl->convertXmlString(xml); delete xsl; } diff --git a/src/kmessview.cpp b/src/kmessview.cpp index 958de2b..09415fa 100644 --- a/src/kmessview.cpp +++ b/src/kmessview.cpp @@ -125,7 +125,7 @@ KMessView::~KMessView() viewModel_ = 0; #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -182,7 +182,7 @@ const ModelDataList KMessView::getItemData( const QModelIndex &index ) if( ! itemIndex.isValid() || itemIndex.model() != viewModel_ ) { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Skipping an invalid item at index:" << index; + kmDebug() << "Skipping an invalid item at index:" << index; #endif return ModelDataList(); } @@ -194,7 +194,7 @@ const ModelDataList KMessView::getItemData( const QModelIndex &index ) if( ! data.canConvert( QVariant::Map ) ) { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Skipping an item with invalid data at index:" << index; + kmDebug() << "Skipping an item with invalid data at index:" << index; #endif return ModelDataList(); } @@ -206,7 +206,7 @@ const ModelDataList KMessView::getItemData( const QModelIndex &index ) if( itemData.isEmpty() ) { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Skipping an empty item at index:" << index; + kmDebug() << "Skipping an empty item at index:" << index; #endif return ModelDataList(); } @@ -236,28 +236,28 @@ bool KMessView::initialize( QAbstractItemModel *viewModel ) if ( initialized_ ) { - kDebug() << "already initialized."; + kmDebug() << "already initialized."; return false; } success = initContactListView( viewModel ); if(! success) { - kDebug() << "Couldn't initialize contact list view."; + kmDebug() << "Couldn't initialize contact list view."; return false; } success = initContactPopup(); if(! success) { - kDebug() << "Couldn't initialize contact popup."; + kmDebug() << "Couldn't initialize contact popup."; return false; } success = initGroupPopup(); if(! success) { - kDebug() << "Couldn't initialize group popup."; + kmDebug() << "Couldn't initialize group popup."; return false; } @@ -462,7 +462,7 @@ bool KMessView::eventFilter(QObject *obj, QEvent *event) && obj != contactListView_->viewport() ) { #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kWarning() << "Received event '" << event->type() << "' from object '" << obj->objectName() << "'."; + kmWarning() << "Received event '" << event->type() << "' from object '" << obj->objectName() << "'."; #endif return false; } @@ -521,7 +521,7 @@ bool KMessView::eventFilter(QObject *obj, QEvent *event) if( mimeUrl.isEmpty() ) { - kWarning() << "Dropped empty MIME URL"; + kmWarning() << "Dropped empty MIME URL"; return true; } @@ -546,7 +546,7 @@ bool KMessView::eventFilter(QObject *obj, QEvent *event) if( ! pictureData.load( localFilePath ) ) { - kWarning() << "The file dropped is not an image or doesn't exist"; + kmWarning() << "The file dropped is not an image or doesn't exist"; return true; } @@ -588,7 +588,7 @@ bool KMessView::eventFilter(QObject *obj, QEvent *event) { if( ! pictureFolder.rename( tempPictureFile, pictureName ) ) { - kWarning() << "The display picture file could not be renamed from" << tempPictureFile << "to" << pictureName << "."; + kmWarning() << "The display picture file could not be renamed from" << tempPictureFile << "to" << pictureName << "."; return true; } } @@ -637,7 +637,7 @@ bool KMessView::eventFilter(QObject *obj, QEvent *event) bool KMessView::initContactListView( QAbstractItemModel *viewModel ) { #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Initializing the contact list view."; + kmDebug() << "Initializing the contact list view."; #endif // Create a proxy model to filter and sort the raw contact list view @@ -901,8 +901,8 @@ void KMessView::slotGroupChanged( const QModelIndex &index ) } #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Changed index:" << index; - kDebug() << "Current index at that row:" << viewModel_->index( index.row(), 0, QModelIndex() ); + kmDebug() << "Changed index:" << index; + kmDebug() << "Current index at that row:" << viewModel_->index( index.row(), 0, QModelIndex() ); #endif // Skip invalid items @@ -911,7 +911,7 @@ void KMessView::slotGroupChanged( const QModelIndex &index ) || ! index.data().canConvert( QVariant::Map ) ) { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Skipping an invalid index:" << index; + kmDebug() << "Skipping an invalid index:" << index; #endif return; } @@ -1128,7 +1128,7 @@ void KMessView::showContextMenu( const QPoint &point ) } else { - kWarning() << "Invalid type of list item" << itemData[ "type" ]; + kmWarning() << "Invalid type of list item" << itemData[ "type" ]; } } @@ -1401,7 +1401,7 @@ void KMessView::slotItemDoubleClicked( const QModelIndex &index ) if( KGlobalSettings::singleClick() ) { #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Accidental double click detected, skipping click event."; + kmDebug() << "Accidental double click detected, skipping click event."; #endif return; } @@ -1417,7 +1417,7 @@ void KMessView::slotItemSingleClicked( const QModelIndex &index ) if( ! KGlobalSettings::singleClick() ) { #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Accidental single click detected, skipping click event."; + kmDebug() << "Accidental single click detected, skipping click event."; #endif accidental = true; @@ -1437,7 +1437,7 @@ void KMessView::slotItemClicked( const QModelIndex &index, const bool accidental // The index was empty if( itemData.isEmpty() ) { - kWarning() << "Invalid list index given!"; + kmWarning() << "Invalid list index given!"; return; } @@ -1468,7 +1468,7 @@ void KMessView::slotItemClicked( const QModelIndex &index, const bool accidental default: #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kWarning() << "Nothing to do!"; + kmWarning() << "Nothing to do!"; #endif break; } @@ -1497,7 +1497,7 @@ void KMessView::slotMoveGroupDown() } #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Selected group:" << group->getId() << "to move down in place of group:" << nextGroup->getId(); + kmDebug() << "Selected group:" << group->getId() << "to move down in place of group:" << nextGroup->getId(); #endif // Get the group sorting position for both groups @@ -1536,7 +1536,7 @@ void KMessView::slotMoveGroupUp() } #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Selected group:" << group->getId() << "to move up in place of group:" << prevGroup->getId(); + kmDebug() << "Selected group:" << group->getId() << "to move up in place of group:" << prevGroup->getId(); #endif // Get the group sorting position for both groups @@ -1789,7 +1789,7 @@ void KMessView::updateFriendlyName( bool refreshOnly ) if( refreshOnly || ! isActiveWindow() || ! topLevelWidget()->isActiveWindow() ) { #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Refreshing name only: initial update or non-intentional focus lose."; + kmDebug() << "Refreshing name only: initial update or non-intentional focus lose."; #endif // Refresh the message @@ -1802,7 +1802,7 @@ void KMessView::updateFriendlyName( bool refreshOnly ) QString newName( friendlyNameInput_->text().trimmed() ); #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Updating friendly name to:" << newName; + kmDebug() << "Updating friendly name to:" << newName; #endif // Set a default name (the email address) if the field is left empty @@ -1849,7 +1849,7 @@ void KMessView::updatePersonalMessage( bool refreshOnly ) if( refreshOnly || ! isActiveWindow() || ! topLevelWidget()->isActiveWindow() ) { #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Refreshing message only: initial update or non-intentional focus lose."; + kmDebug() << "Refreshing message only: initial update or non-intentional focus lose."; #endif // Refresh the message @@ -1872,14 +1872,14 @@ void KMessView::updatePersonalMessage( bool refreshOnly ) const QString message( personalMessageInput_->text().trimmed() ); #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Updating personal message to:" << message; + kmDebug() << "Updating personal message to:" << message; #endif // Protect against weird situations where the label is seen as text. // The lost focus event is also sent when the while window looses focus if( message == defaultMessage ) { - kWarning() << "Personal message label was about to be used as personal message!"; + kmWarning() << "Personal message label was about to be used as personal message!"; return; } @@ -1910,7 +1910,7 @@ void KMessView::updatePersonalMessage( bool refreshOnly ) void KMessView::slotScheduleGroupUpdate() { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Scheduling another groups update"; + kmDebug() << "Scheduling another groups update"; #endif updateTimer_.start( 250 ); } @@ -1921,7 +1921,7 @@ void KMessView::slotScheduleGroupUpdate() void KMessView::slotSearchContact( const QString& searchFor ) { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Search expression changed to:" << searchFor; + kmDebug() << "Search expression changed to:" << searchFor; #endif QString searchExpression; @@ -1961,7 +1961,7 @@ void KMessView::slotSearchContact( const QString& searchFor ) if( ! index.isValid() ) { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Skipping invalid index" << index; + kmDebug() << "Skipping invalid index" << index; #endif continue; } @@ -1973,8 +1973,8 @@ void KMessView::slotSearchContact( const QString& searchFor ) if( itemData.isEmpty() || itemData[ "type" ].toInt() != ContactListModelItem::ItemGroup ) { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Skipping non-group index" << index; - kDebug() << "-- Index data:" << itemData; + kmDebug() << "Skipping non-group index" << index; + kmDebug() << "-- Index data:" << itemData; #endif continue; } @@ -2014,7 +2014,7 @@ void KMessView::slotShowChatHistory() // Show the selected contact. If no log exists // (no chats with that person yet), then don't show the History dialog - if( dialog->setContact( itemData[ "handle" ].toString() ) ) + if( dialog->setInitialContact( currentAccount_->getHandle(), itemData[ "handle" ].toString() ) ) { dialog->show(); } @@ -2126,13 +2126,13 @@ void KMessView::slotUpdateDisplayPicture() if( displayPicFrame_->property( "PictureFileName" ) == pictureFileName ) { #ifdef KMESSDEBUG_KMESSVIEW - kDebug() << "No need to change the display picture"; + kmDebug() << "No need to change the display picture"; #endif return; } #ifdef KMESSDEBUG_KMESSVIEW - kDebug() << "Changing display picture to path:" << pictureFileName; + kmDebug() << "Changing display picture to path:" << pictureFileName; #endif // Change the picture @@ -2175,7 +2175,7 @@ void KMessView::slotUpdateGroups() } #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Updating groups expanded status for" << viewModel_->rowCount() << "rows"; + kmDebug() << "Updating groups expanded status for" << viewModel_->rowCount() << "rows"; #endif for( int row = viewModel_->rowCount() - 1; row >= 0; row-- ) @@ -2183,9 +2183,9 @@ void KMessView::slotUpdateGroups() const QModelIndex index( viewModel_->index( row, 0, QModelIndex() ) ); #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Current row:" << row << "of" << viewModel_->rowCount(); - kDebug() << "Index:" << index; - kDebug() << "Model has it?" << viewModel_->hasIndex( row, 0, QModelIndex() ); + kmDebug() << "Current row:" << row << "of" << viewModel_->rowCount(); + kmDebug() << "Index:" << index; + kmDebug() << "Model has it?" << viewModel_->hasIndex( row, 0, QModelIndex() ); #endif // Skip invalid items @@ -2194,7 +2194,7 @@ void KMessView::slotUpdateGroups() || ! index.data().canConvert( QVariant::Map ) ) { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Skipping an invalid item at row" << row << ":" << index; + kmDebug() << "Skipping an invalid item at row" << row << ":" << index; #endif continue; } @@ -2206,8 +2206,8 @@ void KMessView::slotUpdateGroups() if( itemData.isEmpty() || itemData[ "type" ].toInt() != ContactListModelItem::ItemGroup ) { #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Skipping a non-group at row" << row << ":" << index; - kDebug() << "Skipped item's details:" << itemData; + kmDebug() << "Skipping a non-group at row" << row << ":" << index; + kmDebug() << "Skipped item's details:" << itemData; #endif continue; } @@ -2216,13 +2216,13 @@ void KMessView::slotUpdateGroups() contactListView_->setExpanded( index, itemData[ "isExpanded" ].toBool() ); #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Group" << itemData[ "name" ].toString() << "is" + kmDebug() << "Group" << itemData[ "name" ].toString() << "is" << ( itemData[ "isExpanded" ].toBool() ? "expanded" : "contracted" ); #endif } #ifdef KMESSDEBUG_KMESSVIEW_ITEM_VISIBILITY - kDebug() << "Update done."; + kmDebug() << "Update done."; #endif } @@ -2267,7 +2267,7 @@ void KMessView::slotUpdateUserStatus() const Status status( currentAccount_->getStatus() ); #ifdef KMESSDEBUG_KMESSVIEW_GENERAL - kDebug() << "Updating user status to:" << MsnStatus::getName( status ); + kmDebug() << "Updating user status to:" << MsnStatus::getName( status ); #endif // Update the widgets diff --git a/src/kmessviewdelegate.cpp b/src/kmessviewdelegate.cpp index a3e0bd0..0db5702 100644 --- a/src/kmessviewdelegate.cpp +++ b/src/kmessviewdelegate.cpp @@ -134,9 +134,9 @@ void KMessViewDelegate::paint( QPainter *painter, const QStyleOptionViewItem &op // Restore the painter to the previous state painter->restore(); - kWarning() << "Unknown type of item:" << itemData[ "type" ].toInt(); - kWarning() << "Index:" << index; - kWarning() << "Data:" << itemData; + kmWarning() << "Unknown type of item:" << itemData[ "type" ].toInt(); + kmWarning() << "Index:" << index; + kmWarning() << "Data:" << itemData; return; } diff --git a/src/main.cpp b/src/main.cpp index 48c5ac6..619d2f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -123,6 +123,8 @@ int main(int argc, char *argv[]) aboutData.addCredit( ki18n("Andrea Blankenstijn"), ki18n("More French translation"), "darkan9el" "@" "gmail" "." "com" ); // or "andrea" "@" "zenephiris" "." "ch" aboutData.addCredit( ki18n("Barthe Guillaume"), ki18n("More French translation"), "gu_barthe" "@" "yahoo" "." "fr" ); aboutData.addCredit( ki18n("Scias"), ki18n("More French translation"), "shining" "." "scias" "@" "gmail" "." "com" ); + aboutData.addCredit( ki18n("Grégory Bellier"), ki18n("More French translation"), "gregory" "." "bellier" "@" "gmail" "." "com" ); + aboutData.addCredit( ki18n("Anthony Rey"), ki18n("More French translation"), "gnuk" "@" "mailoo" "." "org"); aboutData.addCredit( ki18n("Páder Rezső"), ki18n("Hungarian translation"), "rezso" "@" "rezso" "." "net"); aboutData.addCredit( ki18n("Pauli Henrik"), ki18n("More Hungarian translation"), "henrik.pauli" "@" "drangolin" "." "net"); @@ -181,6 +183,7 @@ int main(int argc, char *argv[]) aboutData.addCredit( ki18n("Anastasios Bourazanis"), ki18n("Emoticon preview in settings page,clickable contact properties dialog text"), "a.brzns" "@" "gmail" "." "com"); aboutData.addCredit( ki18n("Marco Mentasti"), ki18n("Internationalization fixes, drag'n'drop of images into display pictures"), "marcomentasti" "@" "gmail" "." "com" ); aboutData.addCredit( ki18n("Francesco Nwokeka"), ki18n("Now Listening toggle button above the contact list."), "" ); + aboutData.addCredit( ki18n("Timo Tambet"), ki18n("Contact Changed and Group Changed notifications"), "ttambet" "@" "gmail" "." "com" ); // Other apps aboutData.addCredit( ki18n("KMerlin (kmerlin.olsd.de)"), ki18n("Inspiration and assorted code")); diff --git a/src/model/contactlist.cpp b/src/model/contactlist.cpp index 7b44e50..10167b8 100644 --- a/src/model/contactlist.cpp +++ b/src/model/contactlist.cpp @@ -53,14 +53,14 @@ ContactList::ContactList() ContactList::~ContactList() { #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "DESTROYING..."; + kmDebug() << "DESTROYING..."; #endif // Destroy the list's contents, without regenerating the special groups and the model reset( false ); #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -75,7 +75,7 @@ Contact * ContactList::addContact( const QString& handle, const QString& friendl if( KMESS_NULL(rootNode_) ) return 0; #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "Adding to list contact" << handle << " in groups" << groupIds; + kmDebug() << "Adding to list contact" << handle << " in groups" << groupIds; #endif #ifdef KMESSTEST @@ -91,7 +91,7 @@ Contact * ContactList::addContact( const QString& handle, const QString& friendl // TODO we could return the Contact* founded ?! if( getContactByHandle( handle ) != 0 ) { - kWarning() << "attempted to add contact " << handle << " twice."; + kmWarning() << "attempted to add contact " << handle << " twice."; return 0; } @@ -132,7 +132,7 @@ Contact * ContactList::addContact( const QString& handle, const QString& friendl ContactListModelItem *groupNode = rootNode_->childGroup( id ); if( ! groupNode ) { - kWarning() << "Contact's group" << id << "doesn't exist!"; + kmWarning() << "Contact's group" << id << "doesn't exist!"; continue; } @@ -141,7 +141,7 @@ Contact * ContactList::addContact( const QString& handle, const QString& friendl if ( !groupIdx.isValid() ) { - kWarning() << "Formed invalid index for group " << id << " for contact " << handle << ", not adding to group"; + kmWarning() << "Formed invalid index for group " << id << " for contact " << handle << ", not adding to group"; continue; } @@ -180,13 +180,13 @@ Group* ContactList::addGroup( const QString& groupId, const QString& groupName ) if( KMESS_NULL(rootNode_) ) return 0; #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << groupName << "(" << groupId << ")"; + kmDebug() << groupName << "(" << groupId << ")"; #endif // Check if the group already exists if ( groupExists( groupId ) ) { - kDebug() << "Group " << groupId << " already exists."; + kmDebug() << "Group " << groupId << " already exists."; return 0; } @@ -235,7 +235,7 @@ void ContactList::changeContactStatus( const QString& handle, Status status, con Contact *contact = getContactByHandle( handle ); if ( contact == 0 ) { - kWarning() << "changeContactStatus - Couldn't find contact " << handle << " in the contact list."; + kmWarning() << "changeContactStatus - Couldn't find contact " << handle << " in the contact list."; return; } @@ -274,14 +274,14 @@ void ContactList::changeContactStatus( const QString& handle, Status status, con if( oldStatus != status ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Changing contact" << handle << "'s status"; + kmDebug() << "Changing contact" << handle << "'s status"; #endif // Signal that the contact has changed status, but not switched between an online status and the offline one emit contactChangedStatus( contact, showBaloon ); } #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Status unchanged, skipping."; + kmDebug() << "Status unchanged, skipping."; #endif forwardDataChanged( rootNode_->childContacts( handle ) ); @@ -307,21 +307,21 @@ void ContactList::changeContactStatus( const QString& handle, Status status, con if( ! sourceGroup || ! destinationGroup ) { - kWarning() << "The Online or Offline groups are not available!"; + kmWarning() << "The Online or Offline groups are not available!"; return; } // Move the contact from the first group and put it in the other one #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Moving contact" << handle << "from" << sourceGroup << "to" << destinationGroup; + kmDebug() << "Moving contact" << handle << "from" << sourceGroup << "to" << destinationGroup; #endif ContactListModelItem *contactItem = sourceGroup->childContact( handle ); if( ! contactItem ) { - kWarning() << "Unable to find contact" << handle << "(now online?" << contact->isOnline(); - kWarning() << "The contact is in groups:" << rootNode_->childContacts( handle ); + kmWarning() << "Unable to find contact" << handle << "(now online?" << contact->isOnline(); + kmWarning() << "The contact is in groups:" << rootNode_->childContacts( handle ); return; } @@ -348,7 +348,7 @@ int ContactList::columnCount( const QModelIndex &/*parent*/ ) const if( rootNode_ == 0 ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kWarning() << "Called columnCount() without a root node!"; + kmWarning() << "Called columnCount() without a root node!"; #endif return 0; } @@ -396,7 +396,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( action == Qt::IgnoreAction ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Ignore action"; + kmDebug() << "Ignore action"; #endif return true; } @@ -405,7 +405,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( ! data->hasFormat( "application/kmess.list.item" ) ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Invalid format:" << data->formats(); + kmDebug() << "Invalid format:" << data->formats(); #endif return false; } @@ -413,13 +413,13 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if ( column > 0 ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Invalid column:" << column; + kmDebug() << "Invalid column:" << column; #endif return false; } #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Drop info - parent:" << parent << "Data:" << parent.data(); + kmDebug() << "Drop info - parent:" << parent << "Data:" << parent.data(); #endif QByteArray encodedData( data->data( "application/kmess.list.item" ) ); @@ -436,7 +436,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( sourceItem == 0 ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Invalid item extracted from mime data!"; + kmDebug() << "Invalid item extracted from mime data!"; #endif continue; } @@ -446,13 +446,13 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( targetItem == 0 ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Invalid target item!"; + kmDebug() << "Invalid target item!"; #endif continue; } #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Extracted item:" << sourceItem; + kmDebug() << "Extracted item:" << sourceItem; #endif // Take action, depending on the type of dropped item @@ -474,7 +474,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( sourceGroup->isSpecialGroup() ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a contact from within a special group."; + kmDebug() << "Cannot move a contact from within a special group."; #endif continue; } @@ -484,7 +484,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in // Contact dropped to root case ContactListModelItem::ItemRoot: #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a contact to root."; + kmDebug() << "Cannot move a contact to root."; #endif continue; @@ -494,7 +494,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( targetItem == sourceItem->parent() ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a contact to its own group."; + kmDebug() << "Cannot move a contact to its own group."; #endif continue; } @@ -505,7 +505,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( contact->getGroupIds().contains( targetGroup->getId() ) ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a contact where it already is."; + kmDebug() << "Cannot move a contact where it already is."; #endif continue; } @@ -514,13 +514,13 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( targetGroup->isSpecialGroup() ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a contact to a special group."; + kmDebug() << "Cannot move a contact to a special group."; #endif continue; } #ifdef KMESSDEBUG_CONTACTLIST - kDebug() << "Moving contact from group" << sourceGroup->getId() << "to" << targetGroup->getId(); + kmDebug() << "Moving contact from group" << sourceGroup->getId() << "to" << targetGroup->getId(); #endif emit dndMoveContactToGroup( contact->getHandle(), sourceGroup->getId(), targetGroup->getId() ); break; @@ -532,7 +532,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( targetItem == sourceItem ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a contact to itself."; + kmDebug() << "Cannot move a contact to itself."; #endif continue; } @@ -543,7 +543,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( contact->getGroupIds().contains( targetGroup->getId() ) ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a contact where it already is."; + kmDebug() << "Cannot move a contact where it already is."; #endif continue; } @@ -552,13 +552,13 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( targetGroup->isSpecialGroup() ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a contact to a special group."; + kmDebug() << "Cannot move a contact to a special group."; #endif continue; } #ifdef KMESSDEBUG_CONTACTLIST - kDebug() << "Moving contact from group" << sourceGroup->getId() << "to" << targetGroup->getId(); + kmDebug() << "Moving contact from group" << sourceGroup->getId() << "to" << targetGroup->getId(); #endif emit dndMoveContactToGroup( contact->getHandle(), sourceGroup->getId(), targetGroup->getId() ); break; @@ -584,7 +584,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( sourceGroup->isSpecialGroup() ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a special group."; + kmDebug() << "Cannot move a special group."; #endif continue; } @@ -594,7 +594,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in // Group dropped to the root case ContactListModelItem::ItemRoot: #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a group to root."; + kmDebug() << "Cannot move a group to root."; #endif continue; @@ -604,7 +604,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( targetItem == sourceItem ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a group to itself."; + kmDebug() << "Cannot move a group to itself."; #endif continue; } @@ -615,13 +615,13 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( targetGroup->isSpecialGroup() ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move to a special group."; + kmDebug() << "Cannot move to a special group."; #endif continue; } #ifdef KMESSDEBUG_CONTACTLIST - kDebug() << "Swapping groups" << sourceGroup->getName() << "and" << targetGroup->getName(); + kmDebug() << "Swapping groups" << sourceGroup->getName() << "and" << targetGroup->getName(); #endif // Get the group sorting position for both groups int oldGroupPos = targetGroup->getSortPosition(); @@ -649,7 +649,7 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( targetItem->parent() == sourceItem ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move a group to itself."; + kmDebug() << "Cannot move a group to itself."; #endif continue; } @@ -657,13 +657,13 @@ bool ContactList::dropMimeData( const QMimeData *data, Qt::DropAction action, in if( targetGroup->isSpecialGroup() ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Cannot move to a special group."; + kmDebug() << "Cannot move to a special group."; #endif continue; } #ifdef KMESSDEBUG_CONTACTLIST - kDebug() << "Swapping groups" << sourceGroup->getName() << "and" << targetGroup->getName(); + kmDebug() << "Swapping groups" << sourceGroup->getName() << "and" << targetGroup->getName(); #endif // Get the group sorting position for both groups @@ -718,7 +718,7 @@ void ContactList::dump( ContactListModelItem *start, int depth ) const #ifdef KMESSDEBUG_CONTACTLISTMODEL if( ! rootNode_ ) { - kDebug() << "Contact List model is empty!"; + kmDebug() << "Contact List model is empty!"; return; } @@ -726,16 +726,16 @@ void ContactList::dump( ContactListModelItem *start, int depth ) const if( ! start ) { start = rootNode_; - kDebug() << "Contact List model stats"; - kDebug() << "--------------------------------------"; - kDebug() << "Columns:" << columnCount(); - kDebug() << "Rows:" << rowCount(); - kDebug() << "Root group Columns:" << rootNode_->columnCount(); - kDebug() << "Root group Rows:" << rootNode_->childCount(); - kDebug(); - kDebug() << "Contact List model dump"; - kDebug() << "--------------------------------------"; - kDebug() << "Root @" << (void*)rootNode_; + kmDebug() << "Contact List model stats"; + kmDebug() << "--------------------------------------"; + kmDebug() << "Columns:" << columnCount(); + kmDebug() << "Rows:" << rowCount(); + kmDebug() << "Root group Columns:" << rootNode_->columnCount(); + kmDebug() << "Root group Rows:" << rootNode_->childCount(); + kmDebug(); + kmDebug() << "Contact List model dump"; + kmDebug() << "--------------------------------------"; + kmDebug() << "Root @" << (void*)rootNode_; started = true; } @@ -751,14 +751,14 @@ void ContactList::dump( ContactListModelItem *start, int depth ) const switch( type ) { case ContactListModelItem::ItemContact: - kDebug() << spacer << (i+1) << ") Contact:" + kmDebug() << spacer << (i+1) << ") Contact:" << item->data( 0 ).toMap()["handle"].toString() << "(" << item->data( sortRole ).toInt() << ") " "@" << (void*)item; break; case ContactListModelItem::ItemGroup: - kDebug() << spacer << (i+1) << ") Group:" + kmDebug() << spacer << (i+1) << ") Group:" << item->data( 0 ).toMap()["id"].toString() << "(" << item->data( sortRole ).toInt() << ") " "@" << (void*)item; @@ -766,14 +766,14 @@ void ContactList::dump( ContactListModelItem *start, int depth ) const break; default: - kDebug() << spacer << "Unknown type of item: " + type << "@" << (void*)item; + kmDebug() << spacer << "Unknown type of item: " + type << "@" << (void*)item; break; } } if( started ) { - kDebug() << "--------------------------------------"; + kmDebug() << "--------------------------------------"; } #else Q_UNUSED( start ); @@ -793,7 +793,7 @@ void ContactList::ensureGroupListValid() int fillOffset = 0; #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "Checking the group list against duplicates and gaps..."; + kmDebug() << "Checking the group list against duplicates and gaps..."; int gaps = 0, duplicates = 0; #endif @@ -805,7 +805,7 @@ void ContactList::ensureGroupListValid() if( group->getSortPosition() < 5 && ! group->isSpecialGroup() ) { #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kWarning() << "Found a non-special group with sortPosition < 5, resetting to " << group->getSortPosition() + 5; + kmWarning() << "Found a non-special group with sortPosition < 5, resetting to " << group->getSortPosition() + 5; #endif // the part below will automatically fix any duplicates caused by this: group->setSortPosition( group->getSortPosition() + 5, false ); @@ -864,7 +864,7 @@ void ContactList::ensureGroupListValid() else if( matches.count() == 0 ) { #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "Gap found in group list for position " << pos << ", fixing."; + kmDebug() << "Gap found in group list for position " << pos << ", fixing."; gaps++; #endif // there's a gap, lower all other indices in the group list @@ -873,7 +873,7 @@ void ContactList::ensureGroupListValid() else { #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "Duplicate found in group list for position " << pos << ", fixing."; + kmDebug() << "Duplicate found in group list for position " << pos << ", fixing."; duplicates++; #endif @@ -893,7 +893,7 @@ void ContactList::ensureGroupListValid() } #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "Done checking the contact list. " << duplicates << " duplicates, " << gaps << " gaps fixed."; + kmDebug() << "Done checking the contact list. " << duplicates << " duplicates, " << gaps << " gaps fixed."; #endif groups_.clear(); @@ -970,7 +970,7 @@ bool ContactList::isGroupEmpty( const QString &groupId ) const ContactListModelItem *item = rootNode_->childGroup( groupId ); if( item == 0 ) { - kWarning() << "Cannot find group" << groupId; + kmWarning() << "Cannot find group" << groupId; return false; } @@ -997,7 +997,7 @@ Qt::ItemFlags ContactList::flags( const QModelIndex &index ) const if( item == 0 ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Invalid target item!"; + kmDebug() << "Invalid target item!"; #endif return 0; } @@ -1081,7 +1081,7 @@ void ContactList::forwardDataChanged( ModelItemList itemList ) if( itemList.isEmpty() ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Called with an empty list!"; + kmDebug() << "Called with an empty list!"; #endif return; } @@ -1102,17 +1102,17 @@ void ContactList::forwardDataChanged( ModelItemList itemList ) /* // Useful debugging statements, but way too verbose #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "--------------------------------------------------"; - kDebug() << "Item :" << item; - kDebug() << "Root item :" << rootNode_; - kDebug() << "Parent item :" << item->parent(); - kDebug() << "Index :" << changedIndex; - kDebug() << "Parent index :" << changedIndex.parent(); + kmDebug() << "--------------------------------------------------"; + kmDebug() << "Item :" << item; + kmDebug() << "Root item :" << rootNode_; + kmDebug() << "Parent item :" << item->parent(); + kmDebug() << "Index :" << changedIndex; + kmDebug() << "Parent index :" << changedIndex.parent(); if( changedIndex.parent().isValid() ) - kDebug() << "Parent index refers to:" << static_cast( changedIndex.parent().internalPointer() ); + kmDebug() << "Parent index refers to:" << static_cast( changedIndex.parent().internalPointer() ); else - kDebug() << "Parent index refers to: Root, or a broken item"; - kDebug() << "Parent index's parent :" << changedIndex.parent().parent(); + kmDebug() << "Parent index refers to: Root, or a broken item"; + kmDebug() << "Parent index's parent :" << changedIndex.parent().parent(); #endif */ @@ -1144,7 +1144,7 @@ QMimeData *ContactList::mimeData( const QModelIndexList &indexes ) const if( item == 0 ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Invalid item!"; + kmDebug() << "Invalid item!"; #endif continue; } @@ -1155,13 +1155,13 @@ QMimeData *ContactList::mimeData( const QModelIndexList &indexes ) const && itemType != ContactListModelItem::ItemGroup ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Non draggable item!"; + kmDebug() << "Non draggable item!"; #endif continue; } #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Preparing drag data for item" << item; + kmDebug() << "Preparing drag data for item" << item; #endif // Save the pointer as a 64-bit unsigned integer @@ -1491,7 +1491,7 @@ void ContactList::slotGroupMoved( Group *group, int oldPosition, int newPosition if( oldPosition == newPosition ) { #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "A group moved to the same location, skipping handling."; + kmDebug() << "A group moved to the same location, skipping handling."; #endif return; } @@ -1529,12 +1529,12 @@ void ContactList::slotGroupMoved( Group *group, int oldPosition, int newPosition if( KMESS_NULL( oldGroup ) ) { // This happens when newPosition > groups_.count(), i.e., invalid moving code - kWarning() << "Couldn't find a group with index " << newPosition << "!"; + kmWarning() << "Couldn't find a group with index " << newPosition << "!"; return; } #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "Moving group" << group->getName() << "(position" << oldPosition << ")" + kmDebug() << "Moving group" << group->getName() << "(position" << oldPosition << ")" << "to position" << newPosition << "(currently group" << oldGroup->getName() << ")"; #endif @@ -1578,7 +1578,7 @@ void ContactList::slotForwardContactOffline(Contact *contact, bool showBaloon) #ifdef KMESSDEBUG_CONTACTLIST_GENERAL if ( contact != 0 ) { - kDebug() << "Forwarding that " << contact->getHandle() << " went offline."; + kmDebug() << "Forwarding that " << contact->getHandle() << " went offline."; } #endif @@ -1597,7 +1597,7 @@ void ContactList::slotForwardContactOnline(Contact *contact, bool showBaloon) #ifdef KMESSDEBUG_CONTACTLIST_GENERAL if ( contact != 0 ) { - kDebug() << "Forwarding that " << contact->getHandle() << " went online."; + kmDebug() << "Forwarding that " << contact->getHandle() << " went online."; } #endif @@ -1613,7 +1613,7 @@ void ContactList::removeContact( QString contactId ) if( contact == 0 ) { - kWarning() << "Contact" << contactId << "doesn't exist in the contact list."; + kmWarning() << "Contact" << contactId << "doesn't exist in the contact list."; return; } @@ -1640,14 +1640,14 @@ void ContactList::removeContactFromGroup ( const QString& handle, ContactListMod { if ( ! groupItem ) { - kWarning() << "Invalid group"; + kmWarning() << "Invalid group"; return; } const QModelIndex groupIndex( index(groupItem->row(), 0, QModelIndex() ) ); if ( !groupIndex.isValid() ) { - kWarning() << "Group does not exist in the contact list"; + kmWarning() << "Group does not exist in the contact list"; return; } @@ -1656,7 +1656,7 @@ void ContactList::removeContactFromGroup ( const QString& handle, ContactListMod if ( !contactItem ) { - kWarning() << "Contact/group mismatch"; + kmWarning() << "Contact/group mismatch"; return; } @@ -1678,20 +1678,20 @@ void ContactList::removeGroup( const QString& groupId ) if ( group == 0 || nodeToRemove == 0 ) { - kWarning() << "Group" << groupId << "doesn't exist in the contact list."; + kmWarning() << "Group" << groupId << "doesn't exist in the contact list."; return; } if( nodeToRemove->childCount() ) { - kWarning() << "Group" << groupId << "was not empty!"; + kmWarning() << "Group" << groupId << "was not empty!"; return; } ContactListModelItem *gropNode = rootNode_->childGroup( groupId ); if ( ! gropNode ) { - kWarning() << "Group " << groupId << " does not exist in the model!"; + kmWarning() << "Group " << groupId << " does not exist in the model!"; return; } @@ -1723,7 +1723,7 @@ void ContactList::renameContact( QString handle, QString newName ) contact = getContactByHandle( handle ); if ( contact == 0 ) { - kDebug() << "Couldn't find contact " << handle << " in the contact list."; + kmDebug() << "Couldn't find contact " << handle << " in the contact list."; return; } @@ -1741,7 +1741,7 @@ void ContactList::renameGroup( const QString& groupId, const QString& groupName Group *group = getGroupById( groupId ); if( group == 0 ) { - kWarning() << "Group" << groupId << "not found in the contact list."; + kmWarning() << "Group" << groupId << "not found in the contact list."; return; } @@ -1767,7 +1767,7 @@ void ContactList::reset( bool restore ) if( rootNode_ ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Resetting model tree..."; + kmDebug() << "Resetting model tree..."; #endif // Delete everything from the model tree @@ -1797,7 +1797,7 @@ void ContactList::reset( bool restore ) if( contacts_.count() || groups_.count() ) { #ifdef KMESSDEBUG_CONTACTLIST_DISCONNECTION - kDebug() << "Resetting" << contacts_.count() << "contacts..."; + kmDebug() << "Resetting" << contacts_.count() << "contacts..."; #endif // Delete all contacts @@ -1805,7 +1805,7 @@ void ContactList::reset( bool restore ) contacts_.clear(); #ifdef KMESSDEBUG_CONTACTLIST_DISCONNECTION - kDebug() << "Resetting" << groups_.count() << "groups..."; + kmDebug() << "Resetting" << groups_.count() << "groups..."; #endif // Delete all groups @@ -1841,7 +1841,7 @@ void ContactList::reset( bool restore ) void ContactList::readProperties() { #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "Loading properties for the contact list"; + kmDebug() << "Loading properties for the contact list"; #endif const QString& handle = CurrentAccount::instance()->getHandle(); @@ -1909,13 +1909,13 @@ int ContactList::rowCount( const QModelIndex &parent ) const void ContactList::saveProperties() { #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "Saving properties for the contact list"; + kmDebug() << "Saving properties for the contact list"; #endif // Do not save account properties when it's a temporary account if( CurrentAccount::instance()->isGuestAccount() ) { - kWarning() << "Requested to save properties, but this is a guest account!"; + kmWarning() << "Requested to save properties, but this is a guest account!"; return; } @@ -1957,7 +1957,7 @@ void ContactList::saveProperties() foreach( const QString &unusedContact, pendingRemoval ) { #ifdef KMESSDEBUG_CONTACTLIST_GENERAL - kDebug() << "Deleting unused contact info for " << unusedContact; + kmDebug() << "Deleting unused contact info for " << unusedContact; #endif // Remove the custom picture associated with this contact, if there is any @@ -1976,7 +1976,7 @@ void ContactList::saveProperties() #ifdef KMESSDEBUG_CONTACTLIST_GENERAL else { - kDebug() << "No contacts to save"; + kmDebug() << "No contacts to save"; } #endif } diff --git a/src/model/contactlistmodelfilter.cpp b/src/model/contactlistmodelfilter.cpp index 1cb0611..feafa87 100644 --- a/src/model/contactlistmodelfilter.cpp +++ b/src/model/contactlistmodelfilter.cpp @@ -66,14 +66,14 @@ void ContactListModelFilter::dump( QModelIndex start, int depth ) const if( ! start.isValid() ) { start = QModelIndex(); - kDebug() << "Contact List Filter model stats"; - kDebug() << "--------------------------------------"; - kDebug() << "Columns:" << columnCount(); - kDebug() << "Rows:" << rowCount(); - kDebug(); - kDebug() << "Contact List Filter model dump"; - kDebug() << "--------------------------------------"; - kDebug() << "Root @" << start; + kmDebug() << "Contact List Filter model stats"; + kmDebug() << "--------------------------------------"; + kmDebug() << "Columns:" << columnCount(); + kmDebug() << "Rows:" << rowCount(); + kmDebug(); + kmDebug() << "Contact List Filter model dump"; + kmDebug() << "--------------------------------------"; + kmDebug() << "Root @" << start; started = true; } @@ -88,29 +88,29 @@ void ContactListModelFilter::dump( QModelIndex start, int depth ) const switch( itemData["type"].toInt() ) { case ContactListModelItem::ItemContact: - kDebug() << spacer << (i+1) << ") Contact:" + kmDebug() << spacer << (i+1) << ") Contact:" << itemData["handle"].toString() << "@" << itemIndex; break; case ContactListModelItem::ItemGroup: - kDebug() << spacer << (i+1) << ") Group:" + kmDebug() << spacer << (i+1) << ") Group:" << itemData["id"].toString() << "@" << itemIndex; dump( itemIndex, depth + 1 ); break; default: - kDebug() << spacer << "Unknown type of item: " + itemData["type"].toInt() << "@" << itemIndex; + kmDebug() << spacer << "Unknown type of item: " + itemData["type"].toInt() << "@" << itemIndex; break; } } if( started ) { - kDebug() << "--------------------------------------"; - kDebug() << "Persistent indices:" << endl << persistentIndexList(); - kDebug() << "--------------------------------------"; + kmDebug() << "--------------------------------------"; + kmDebug() << "Persistent indices:" << endl << persistentIndexList(); + kmDebug() << "--------------------------------------"; } #else Q_UNUSED( start ); @@ -146,7 +146,7 @@ bool ContactListModelFilter::filterAcceptsRow( int sourceRow, const QModelIndex& if( itemData.isEmpty() ) { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Item" << index << "does not contain any data!"; + kmDebug() << "Item" << index << "does not contain any data!"; #endif return false; } @@ -346,8 +346,8 @@ bool ContactListModelFilter::filterAcceptsRow( int sourceRow, const QModelIndex& // Invalid items default: - kWarning() << "Unknown contents for index:" << index; - kWarning() << "-- Item data:" << itemData; + kmWarning() << "Unknown contents for index:" << index; + kmWarning() << "-- Item data:" << itemData; break; } @@ -356,11 +356,11 @@ bool ContactListModelFilter::filterAcceptsRow( int sourceRow, const QModelIndex& switch( itemData[ "type" ].toInt() ) { case ContactListModelItem::ItemContact: - kDebug() << "Visibility check: contact" << itemData[ "handle" ].toString() << "is" + kmDebug() << "Visibility check: contact" << itemData[ "handle" ].toString() << "is" << ( isVisible ? "visible" : "hidden" ); break; case ContactListModelItem::ItemGroup: - kDebug() << "Visibility check: group" << itemData[ "name" ].toString() << "is" + kmDebug() << "Visibility check: group" << itemData[ "name" ].toString() << "is" << ( isVisible ? "visible" : "hidden" ); break; default: @@ -399,7 +399,7 @@ void ContactListModelFilter::setSourceModel( QAbstractItemModel *sourceModel ) void ContactListModelFilter::updateOptions() { #ifdef KMESSDEBUG_CONTACTLISTMODEL - kDebug() << "Updating account options from" << sender() << "( this:" << this << ", source model:" << sourceModel() << ")"; + kmDebug() << "Updating account options from" << sender() << "( this:" << this << ", source model:" << sourceModel() << ")"; #endif // Connect the account signals that we need diff --git a/src/model/contactlistmodelitem.cpp b/src/model/contactlistmodelitem.cpp index f79d8c1..462d555 100644 --- a/src/model/contactlistmodelitem.cpp +++ b/src/model/contactlistmodelitem.cpp @@ -106,14 +106,14 @@ void ContactListModelItem::appendChild( ContactListModelItem *item ) || ( itemType_ == ItemGroup && item->getType() != ItemContact ) || itemType_ == ItemContact ) { - kWarning() << "Cannot insert this item:" << item << "into this one:" << this; + kmWarning() << "Cannot insert this item:" << item << "into this one:" << this; return; } // Also, don't add items which are already present if( childItems_.contains( item ) ) { - kWarning() << "Tried to add twice item:" << item; + kmWarning() << "Tried to add twice item:" << item; return; } @@ -153,7 +153,7 @@ ContactListModelItem *ContactListModelItem::childContact( const QString &handle // Prevent incorrect usage if( itemType_ != ItemGroup ) { - kWarning() << "Called childContact() on a non-group item:" << this; + kmWarning() << "Called childContact() on a non-group item:" << this; return 0; } @@ -199,7 +199,7 @@ ModelItemList ContactListModelItem::childContacts( const QString &handle ) { if( item->getType() != ItemContact ) { - kWarning() << "Invalid item in group" << this << ":" << item; + kmWarning() << "Invalid item in group" << this << ":" << item; return ModelItemList(); } @@ -212,7 +212,7 @@ ModelItemList ContactListModelItem::childContacts( const QString &handle ) } else { - kWarning() << "Called childContacts() from a Contact item:" << this; + kmWarning() << "Called childContacts() from a Contact item:" << this; return ModelItemList(); } @@ -234,7 +234,7 @@ ContactListModelItem *ContactListModelItem::childGroup( const QString &id ) // Prevent incorrect usage if( itemType_ != ItemRoot ) { - kWarning() << "Called childGroup() on a non-root item:" << this; + kmWarning() << "Called childGroup() on a non-root item:" << this; return 0; } @@ -242,7 +242,7 @@ ContactListModelItem *ContactListModelItem::childGroup( const QString &id ) { if( item->getType() != ItemGroup ) { - kWarning() << "Invalid item in root" << this << ":" << item; + kmWarning() << "Invalid item in root" << this << ":" << item; return 0; } @@ -405,8 +405,8 @@ const QVariant ContactListModelItem::data( int role ) const else { // Avoid crashing without hints - kWarning() << "Called data( SortRole ) on an invalid item: (see below)"; - kWarning() << this; + kmWarning() << "Called data( SortRole ) on an invalid item: (see below)"; + kmWarning() << this; return QVariant( 0 ); } @@ -452,8 +452,8 @@ const QVariant ContactListModelItem::data( int role ) const else { // Avoid crashing without hints - kWarning() << "Called data( SearchRole ) on an invalid item: (see below)"; - kWarning() << this; + kmWarning() << "Called data( SearchRole ) on an invalid item: (see below)"; + kmWarning() << this; return QVariant( QString() ); } } @@ -554,8 +554,8 @@ const QVariant ContactListModelItem::data( int role ) const else { // Avoid crashing without hints - kWarning() << "Called data( DisplayRole ) on an invalid item: (see below)"; - kWarning() << this; + kmWarning() << "Called data( DisplayRole ) on an invalid item: (see below)"; + kmWarning() << this; return QVariant( ModelDataList() ); } @@ -594,19 +594,19 @@ void ContactListModelItem::moveTo( ContactListModelItem *newParent ) { if( itemType_ == ItemRoot ) { - kWarning() << "Called moveTo() on a root item! Item:" << this; + kmWarning() << "Called moveTo() on a root item! Item:" << this; return; } if( newParent == 0 ) { - kWarning() << "Called moveTo() with an empty new parent! Item:" << this; + kmWarning() << "Called moveTo() with an empty new parent! Item:" << this; return; } if( parentNode_ == 0 ) { - kWarning() << "Called moveTo() on a parentless item! Item:" << this; + kmWarning() << "Called moveTo() on a parentless item! Item:" << this; return; } @@ -673,7 +673,7 @@ int ContactListModelItem::row() const { if( itemType_ == ItemRoot || ! parentNode_ || parentNode_->childItems_.isEmpty() ) { - kWarning() << "Called row() on a root item or an item with invalid parent! Item:" << this; + kmWarning() << "Called row() on a root item or an item with invalid parent! Item:" << this; return 0; } diff --git a/src/network/applications/application.cpp b/src/network/applications/application.cpp index ffc5808..a70a06d 100644 --- a/src/network/applications/application.cpp +++ b/src/network/applications/application.cpp @@ -56,7 +56,7 @@ Application::~Application() { closing_ = true; // for consistency #ifdef KMESSDEBUG_APPLICATION - kDebug() << "DESTROYED. [handle=" << contactHandle_ << "]"; + kmDebug() << "DESTROYED. [handle=" << contactHandle_ << "]"; #endif } @@ -74,11 +74,11 @@ Application::~Application() void Application::contactAborted(const QString &message) { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif if( closing_ ) { - kWarning() << "Attempted to close application twice (contact=" << contactHandle_ << ")"; + kmWarning() << "Attempted to close application twice (contact=" << contactHandle_ << ")"; } // Remove the accept links @@ -110,11 +110,11 @@ void Application::contactAborted(const QString &message) void Application::contactRejected(const QString &message) { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif if( closing_ ) { - kWarning() << "Attempted to close application twice (contact=" << contactHandle_ << ")"; + kmWarning() << "Attempted to close application twice (contact=" << contactHandle_ << ")"; } // Remove the accept links @@ -148,12 +148,12 @@ void Application::contactRejected(const QString &message) void Application::contactStarted1_ContactInvitesUser(const MimeMessage& /*message*/) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "(rejects invitation)"; + kmDebug() << "(rejects invitation)"; #endif // We can assume the switchboard already displayed a better error message #ifdef KMESTEST - kWarning() << "The Application subclass didn't implement contactStarted1_ContactInvitesUser!"; + kmWarning() << "The Application subclass didn't implement contactStarted1_ContactInvitesUser!"; #endif // Cancel the invitation @@ -174,7 +174,7 @@ void Application::contactStarted1_ContactInvitesUser(const MimeMessage& /*messag void Application::contactStarted2_UserAccepts() { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif } @@ -189,7 +189,7 @@ void Application::contactStarted2_UserAccepts() void Application::contactStarted3_ContactConfirmsAccept(const MimeMessage& /*message*/) { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif } @@ -220,13 +220,13 @@ void Application::endApplication() // which could cause a delete signal to get through. In effect, KMess will crash because once // the KFileDialog returns the code runs in that deleted part. #ifdef KMESSDEBUG_APPLICATION - kDebug() << "delayDeletion is in effect, waiting for the derived class to call endApplication() again."; + kmDebug() << "delayDeletion is in effect, waiting for the derived class to call endApplication() again."; #endif } else { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Requesting removal"; + kmDebug() << "Requesting removal"; #endif emit deleteMe(this); @@ -404,7 +404,7 @@ QString Application::getUserRejectMessage() const void Application::gotCommand(QString command) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Got command " << command; + kmDebug() << "Got command " << command; #endif waitingForUser_ = false; @@ -412,7 +412,7 @@ void Application::gotCommand(QString command) if( userAnswered_ ) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "User has already answered this application before, ignoring."; + kmDebug() << "User has already answered this application before, ignoring."; #endif return; } @@ -433,7 +433,7 @@ void Application::gotCommand(QString command) } else { - kWarning() << "Received unhandled command " << command << "."; + kmWarning() << "Received unhandled command " << command << "."; } } @@ -504,7 +504,7 @@ bool Application::isWaitingForUser() const void Application::modifyOfferMessage( const QString& newMessage ) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Changing offer links in chat"; + kmDebug() << "Changing offer links in chat"; #endif emit updateApplicationMessage( getCookie(), newMessage ); @@ -524,7 +524,7 @@ void Application::modifyOfferMessage( const QString& newMessage ) void Application::offerAcceptOrReject(const QString& appHtml) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Displaying accept/reject message in chat"; + kmDebug() << "Displaying accept/reject message in chat"; #endif QString html; @@ -548,7 +548,7 @@ void Application::offerAcceptOrReject(const QString& appHtml) showEventMessage( html, ChatMessage::CONTENT_APP_INVITE, true ); #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Waiting for user to accept.."; + kmDebug() << "Waiting for user to accept.."; #endif } @@ -566,7 +566,7 @@ void Application::offerAcceptOrReject(const QString& appHtml) void Application::offerCancel(const QString& appHtml) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Displaying cancel link in chat"; + kmDebug() << "Displaying cancel link in chat"; #endif QString html; @@ -712,7 +712,7 @@ void Application::showSystemMessage( const QString &message, const ChatMessage:: void Application::showTransferComplete() { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Transfer is complete."; + kmDebug() << "Transfer is complete."; #endif } @@ -750,7 +750,7 @@ void Application::showTransferMessage(const QString &message) void Application::showTransferProgress( const ulong bytesTransferred ) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Transferred " << bytesTransferred << " bytes."; + kmDebug() << "Transferred " << bytesTransferred << " bytes."; #else Q_UNUSED( bytesTransferred ); // Avoid compiler warning #endif @@ -801,11 +801,11 @@ void Application::startByInvite(const QString &invitationCookie) void Application::userAborted() { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif if( closing_ ) { - kWarning() << "Attempted to close application twice (contact=" << contactHandle_ << ")"; + kmWarning() << "Attempted to close application twice (contact=" << contactHandle_ << ")"; // The application could already have been deleted, just end it before something leads to a crash. endApplication(); @@ -835,11 +835,11 @@ void Application::userAborted() void Application::userRejected() { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif if( closing_ ) { - kWarning() << "Attempted to close application twice (contact=" << contactHandle_ << ")"; + kmWarning() << "Attempted to close application twice (contact=" << contactHandle_ << ")"; // The application could already have been deleted, just end it before something leads to a crash. endApplication(); @@ -861,7 +861,7 @@ void Application::userRejected() void Application::userStarted1_UserInvitesContact() { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif } @@ -877,7 +877,7 @@ void Application::userStarted1_UserInvitesContact() void Application::userStarted2_ContactAccepts(const MimeMessage& /*message*/) { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif } @@ -891,7 +891,7 @@ void Application::userStarted2_ContactAccepts(const MimeMessage& /*message*/) void Application::userStarted3_UserPrepares() { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif } diff --git a/src/network/applications/applicationlist.cpp b/src/network/applications/applicationlist.cpp index 12a1258..0fb8893 100644 --- a/src/network/applications/applicationlist.cpp +++ b/src/network/applications/applicationlist.cpp @@ -81,13 +81,13 @@ ApplicationList::ApplicationList(const QString &contactHandle) ApplicationList::~ApplicationList() { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Starting removal. [handle=" << contactHandle_ << "]"; + kmDebug() << "Starting removal. [handle=" << contactHandle_ << "]"; #endif // See if there are remaining MIME applications if( ! mimeApplications_.isEmpty() ) { - kWarning() << "still have " << mimeApplications_.count() << + kmWarning() << "still have " << mimeApplications_.count() << " active MimeApplication objects for " << contactHandle_ << "!"; // Remove all mime applications @@ -98,7 +98,7 @@ ApplicationList::~ApplicationList() // See if there are remaining P2P applications if( ! p2pApplications_.isEmpty() ) { - kWarning() << "still have " << p2pApplications_.count() << + kmWarning() << "still have " << p2pApplications_.count() << " active P2PApplication objects for " << contactHandle_ << "!"; // Remove all p2p applications @@ -112,7 +112,7 @@ ApplicationList::~ApplicationList() directConnectionPool_ = 0; #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "DESTROYED. [handle=" << contactHandle_ << "]"; + kmDebug() << "DESTROYED. [handle=" << contactHandle_ << "]"; #endif } @@ -138,7 +138,7 @@ bool ApplicationList::abortApplications(const MsnSwitchboardConnection *aborting if( mimeApplications_.isEmpty() && p2pApplications_.isEmpty() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "No applications active."; + kmDebug() << "No applications active."; #endif return false; } @@ -160,7 +160,7 @@ bool ApplicationList::abortApplications(const MsnSwitchboardConnection *aborting if( connection->isExclusiveChatWithContact( contactHandle_ ) ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Contact is still in another private chat, not terminating applications."; + kmDebug() << "Contact is still in another private chat, not terminating applications."; #endif return (! abortingApplications_.isEmpty()); // in case the function was called before } @@ -177,11 +177,11 @@ bool ApplicationList::abortApplications(const MsnSwitchboardConnection *aborting #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL if( ! hasMultiChats ) { - kDebug() << "Contact left all chats, aborting applications."; + kmDebug() << "Contact left all chats, aborting applications."; } else { - kDebug() << "Contact left all private chats, aborting applications that don't support multi-chats."; + kmDebug() << "Contact left all private chats, aborting applications that don't support multi-chats."; } #endif @@ -235,7 +235,7 @@ bool ApplicationList::abortApplications(const MsnSwitchboardConnection *aborting // The application may abort really quick and update the abortingApplications_ list directly from a signal. // In this case, the list is already emty, theirby also returning 'false'. #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Got " << abortingApplications_.count() << " applications left to abort."; + kmDebug() << "Got " << abortingApplications_.count() << " applications left to abort."; #endif return (! abortingApplications_.isEmpty()); } @@ -255,7 +255,7 @@ bool ApplicationList::abortApplications(const MsnSwitchboardConnection *aborting void ApplicationList::addApplication(MimeApplication *application) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "connecting mime application signals."; + kmDebug() << "connecting mime application signals."; #endif mimeApplications_.append( application ); @@ -285,7 +285,7 @@ void ApplicationList::addApplication(MimeApplication *application) void ApplicationList::addApplication(P2PApplication *application) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "connecting p2p application signals."; + kmDebug() << "connecting p2p application signals."; #endif p2pApplications_.append( application ); @@ -329,20 +329,20 @@ bool ApplicationList::addConnection(const QString &ipAddress, const quint16 port else { // Already connected, don't allow second connection. - kWarning() << "Refusing connection attempt, a connection has already been made " + kmWarning() << "Refusing connection attempt, a connection has already been made " "(contact=" << contactHandle_ << " action=return)."; return 0; } } #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "adding new connection attempt."; + kmDebug() << "adding new connection attempt."; #endif // Avoid overwriting the current directConnection_ variable. if( directConnection_ != 0 ) { - kWarning() << "Refusing connection attempt, a connection has already been made " + kmWarning() << "Refusing connection attempt, a connection has already been made " "(contact=" << contactHandle_ << " action=return)."; return 0; } @@ -390,14 +390,14 @@ int ApplicationList::addServerConnection() else { // Already connected, don't allow second connection. - kWarning() << "Refusing server connection attempt, a connection has already been made " + kmWarning() << "Refusing server connection attempt, a connection has already been made " "(contact=" << contactHandle_ << " action=return)."; return 0; } } #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "adding new server socket."; + kmDebug() << "adding new server socket."; #endif // Init direct connection pool @@ -483,7 +483,7 @@ MimeApplication * ApplicationList::createApplication(const MimeMessage &message) if( appGuid.isEmpty() ) { // Notify the user: - kWarning() << "MIME message can't be handled, " + kmWarning() << "MIME message can't be handled, " << "Application-GUID not found. (message dump follows)\n" << message.getFields(); return 0; } @@ -501,7 +501,7 @@ MimeApplication * ApplicationList::createApplication(const MimeMessage &message) // Connect up the application #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Connecting MimeApplication signals"; + kmDebug() << "Connecting MimeApplication signals"; #endif // Auto-add application @@ -530,7 +530,7 @@ P2PApplication * ApplicationList::createApplication(const P2PMessage &message) #endif #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Creating new P2PApplication instance to parse the P2P message."; + kmDebug() << "Creating new P2PApplication instance to parse the P2P message."; #endif P2PApplication *app = 0; @@ -544,7 +544,7 @@ P2PApplication * ApplicationList::createApplication(const P2PMessage &message) // this belongs to another session, but gotMessage() couldn't find it. // Likely a P2PApplication object terminated prematurely. QString preamble( slpMessage.left( qMin(slpMessage.indexOf(":"), 20) ) ); - kWarning() << "P2P message can't be handled, detected SLP message but no INVITE. " + kmWarning() << "P2P message can't be handled, detected SLP message but no INVITE. " "P2PApplication already terminated? " "(slp-preamble=" << preamble << " contact=" << contactHandle_ << @@ -563,7 +563,7 @@ P2PApplication * ApplicationList::createApplication(const P2PMessage &message) if( guidPos == -1 ) { // Notify the user: - kWarning() << "P2P message can't be handled, " + kmWarning() << "P2P message can't be handled, " << "EUF-GUID not found. (message dump follows)\n" << slpMessage; return 0; } @@ -582,7 +582,7 @@ P2PApplication * ApplicationList::createApplication(const P2PMessage &message) // Connect up the application #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Connecting P2PApplication signals"; + kmDebug() << "Connecting P2PApplication signals"; #endif // Auto-add application @@ -600,7 +600,7 @@ P2PApplication * ApplicationList::createApplication(const P2PMessage &message) MimeApplication * ApplicationList::createApplicationByGuid(const QString &appGuid) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Creating MimeApplication for GUID" << appGuid; + kmDebug() << "Creating MimeApplication for GUID" << appGuid; #endif if( appGuid == FileTransfer::getAppId() ) @@ -610,7 +610,7 @@ MimeApplication * ApplicationList::createApplicationByGuid(const QString &appGui else { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "No MimeApplication exists for this GUID!"; + kmDebug() << "No MimeApplication exists for this GUID!"; #endif return 0; } @@ -626,7 +626,7 @@ MimeApplication * ApplicationList::createApplicationByGuid(const QString &appGui P2PApplication * ApplicationList::createApplicationByEufGuid(const QString &eufGuid) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Creating P2PApplication for GUID" << eufGuid; + kmDebug() << "Creating P2PApplication for GUID" << eufGuid; #endif if( eufGuid == MsnObjectTransferP2P::getAppId() ) @@ -649,7 +649,7 @@ P2PApplication * ApplicationList::createApplicationByEufGuid(const QString &eufG else { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "No P2PApplication exists for this GUID!"; + kmDebug() << "No P2PApplication exists for this GUID!"; #endif return 0; } @@ -675,7 +675,7 @@ P2PApplication * ApplicationList::getApplicationByAckData(const P2PMessage &ackM if( ackUniqueID == 0 ) { // HACK: added for GAIM 1.5 (does not return UniqueID) - kWarning() << "Got P2P message with matching ackSessionID and no ackUniqueID set " + kmWarning() << "Got P2P message with matching ackSessionID and no ackUniqueID set " << "(delivering anyway, contact=" << contactHandle_ << ")!"; } @@ -698,7 +698,7 @@ P2PApplication * ApplicationList::getApplicationByCallId(const QString &callID) foreach( P2PApplication *app, p2pApplications_ ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Demultiplexing P2P message" + kmDebug() << "Demultiplexing P2P message" << " (CallID " << app->getCallID() << " == " << callID << " ?)"; #endif @@ -761,7 +761,7 @@ P2PApplication * ApplicationList::getApplicationByLastMessage(unsigned long mess { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL unsigned long debugMsgId = app->getLastContactMessageID(); - kDebug() << "Demultiplexing P2P message" + kmDebug() << "Demultiplexing P2P message" << " (fragment MessageID " << debugMsgId << " == " << messageID << " ?)"; #endif @@ -789,7 +789,7 @@ P2PApplication * ApplicationList::getApplicationByNonce(const QString &nonce) co foreach( P2PApplication *app, p2pApplications_ ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Demultiplexing P2P message" + kmDebug() << "Demultiplexing P2P message" << " (Nonce " << app->getNonce() << " == " << nonce << " ?)"; #endif @@ -815,7 +815,7 @@ P2PApplication * ApplicationList::getApplicationBySessionId(unsigned long sessio foreach( P2PApplication *app, p2pApplications_ ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Demultiplexing P2P message" + kmDebug() << "Demultiplexing P2P message" << " (SessionID " << app->getSessionID() << " == " << sessionID << " ?)"; #endif if( app->getSessionID() == sessionID ) @@ -865,7 +865,7 @@ MsnDirectConnection * ApplicationList::getDirectConnection() const void ApplicationList::gotMessage(const MimeMessage &message) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Parsing Mime appliation message."; + kmDebug() << "Parsing Mime appliation message."; message.print(); #endif Application *app = 0; @@ -888,7 +888,7 @@ void ApplicationList::gotMessage(const MimeMessage &message) app = getApplicationByCookie( message.getValue("Invitation-Cookie") ); if( app == 0 ) { - kWarning() << "Unable to handle MIME message, " + kmWarning() << "Unable to handle MIME message, " << "Invitation-Cookie not found (contact=" << contactHandle_ << ")."; return; } @@ -897,7 +897,7 @@ void ApplicationList::gotMessage(const MimeMessage &message) // Last check before casting the object. if( ! app->inherits("MimeApplication") ) { - kWarning() << "found application is not a mime application!"; + kmWarning() << "found application is not a mime application!"; return; } @@ -922,7 +922,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) { // Parse the message #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Parsing received P2P message:" + kmDebug() << "Parsing received P2P message:" << " sid=" << message.getSessionID() << " mid=" << message.getMessageID() << " ackSid=" << message.getAckSessionID() @@ -953,7 +953,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) { case InkTransferP2P::SESSION_ID: #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Found reserved session ID for Ink transfers, creating InkTransferP2P instance."; + kmDebug() << "Found reserved session ID for Ink transfers, creating InkTransferP2P instance."; #endif // Ink messages have a fixed session ID. p2pApplication = new InkTransferP2P( this ); @@ -964,7 +964,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) default: // Normal P2P session -> notify the user if the message was invalid. (send error-response later) - kWarning() << "Unable to handle P2P message, Session-ID " << sessionID << " not found."; + kmWarning() << "Unable to handle P2P message, Session-ID " << sessionID << " not found."; } } } @@ -976,7 +976,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) // That occurs when the connection was closed before that packet could be sent. if( message.isConnectionHandshake() ) { - kWarning() << "Received a direct connection handshake message at the switchboard " + kmWarning() << "Received a direct connection handshake message at the switchboard " "(contact=" << contactHandle_ << " action=return)."; return; } @@ -990,7 +990,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) if(p2pApplication == 0) { // NOTE: if flags==64 (0x40), it it's possible this is actually a bug from MSN7.0. - kWarning() << "P2P message can't be handled," + kmWarning() << "P2P message can't be handled," " no match for ackSessionID " << message.getAckSessionID() << " or ackUniqueID " << message.getAckUniqueID() << " found."; } @@ -998,7 +998,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) else if( message.getFlags() == 0 && message.getDataSize() == 0 && message.getAckUniqueID() == 0 ) { // HACK: added for bot Bot2k3 4.1 (sends first ack without UniqueID, flags or any other context) - kWarning() << "SwitchBoard P2P message has no ACK fields set at all, assuming base identifier message!"; + kmWarning() << "SwitchBoard P2P message has no ACK fields set at all, assuming base identifier message!"; } else if( message.isSlpData() ) { @@ -1023,7 +1023,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) if( callPos == -1 ) { - kWarning() << "Unable to handle P2P message, CallID field not found."; + kmWarning() << "Unable to handle P2P message, CallID field not found."; } else { @@ -1034,7 +1034,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) if( callID == "{00000000-0000-0000-0000-000000000000}" ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Found null Call-ID, using Session-ID to deliver the message."; + kmDebug() << "Found null Call-ID, using Session-ID to deliver the message."; #endif // HACK use the SessionID from the SLP body to route the message. @@ -1044,7 +1044,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) long sessionPos = sessionRE.indexIn( slpMessage ); if( sessionPos == -1 ) { - kWarning() << "Unable to handle P2P message, found null-guid CallID but no SessionID instead."; + kmWarning() << "Unable to handle P2P message, found null-guid CallID but no SessionID instead."; } else { @@ -1057,7 +1057,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) { // Also observed in some cases. #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Also found zero Session-ID, will create an empty application instance to handle the message."; + kmDebug() << "Also found zero Session-ID, will create an empty application instance to handle the message."; #endif // Create it here so there won't be any message dumps. @@ -1079,7 +1079,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) if( p2pApplication == 0 ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "No existing P2P session found for the MSNSLP message, " + kmDebug() << "No existing P2P session found for the MSNSLP message, " << "must be a new session invitation."; #endif @@ -1092,7 +1092,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) else { // Didn't reconize the flag type. - kWarning() << "P2P message can't be handled, unknown flag type found."; + kmWarning() << "P2P message can't be handled, unknown flag type found."; if( message.getFlags() == 0 ) { // HACK: added for broken clients who sent an empty message with a zero flag (Bot2K3 v4.1) @@ -1110,7 +1110,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) { // Force logging all unknown messages, to help improving the protocol knowledge // This is not hidden, because this information is essential for debugging user problems. - kWarning() << "A message could not be delivered to an existing P2P application " + kmWarning() << "A message could not be delivered to an existing P2P application " "(see previous warnings for details," " sid=" << message.getSessionID() << " flags=0x" << QString::number(message.getFlags(), 16) << @@ -1120,7 +1120,7 @@ void ApplicationList::gotMessage(const P2PMessage &message) // Also dump the SLP message if it's there. if( ! slpMessage.isEmpty() && message.getSessionID() == 0 && message.getDataSize() > 0 ) { - kDebug() << "Dumping SLP message payload:\n" << slpMessage << "\n"; + kmDebug() << "Dumping SLP message payload:\n" << slpMessage << "\n"; } // If we didn't find the application, the message had bad fields @@ -1130,12 +1130,12 @@ void ApplicationList::gotMessage(const P2PMessage &message) && message.getDataSize() == 0 ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Not sending a P2P Error response for error message."; + kmDebug() << "Not sending a P2P Error response for error message."; #endif } else { - kDebug() << "Creating temporary P2PApplication instance to send error response."; + kmDebug() << "Creating temporary P2PApplication instance to send error response."; // Create a default application to send the correct error response (also for unknown invitation types) // Application auto-deletes itself. @@ -1247,7 +1247,7 @@ bool ApplicationList::hasPendingConnections() const void ApplicationList::initializeDirectConnectionPool() { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Initializing direct connection pool."; + kmDebug() << "Initializing direct connection pool."; #endif #ifdef KMESSTEST KMESS_ASSERT( directConnectionPool_ == 0 ); @@ -1309,7 +1309,7 @@ void ApplicationList::pauseApplications() void ApplicationList::registerDataSendingApplication( P2PApplicationBase *application ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "adding application to the list of active outgoing transfers."; + kmDebug() << "adding application to the list of active outgoing transfers."; #endif // See if it's the first app. @@ -1327,7 +1327,7 @@ void ApplicationList::registerDataSendingApplication( P2PApplicationBase *applic if( ! sbReadyWriteTester_.isActive() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "no direct connection available, starting switchboard write handler instead."; + kmDebug() << "no direct connection available, starting switchboard write handler instead."; #endif // Start the write handler for the switchboard. @@ -1336,7 +1336,7 @@ void ApplicationList::registerDataSendingApplication( P2PApplicationBase *applic else { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "no direct connection available, but switchboard write handler is already active."; + kmDebug() << "no direct connection available, but switchboard write handler is already active."; #endif } } @@ -1350,13 +1350,13 @@ void ApplicationList::registerDataSendingApplication( P2PApplicationBase *applic if( isFirstApp ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "first application added, " + kmDebug() << "first application added, " << "starting connection write handler."; #endif } else { - kWarning() << "there are already applications, but no write handler connected yet."; + kmWarning() << "there are already applications, but no write handler connected yet."; } // Connect the write handler. @@ -1376,7 +1376,7 @@ void ApplicationList::registerDataSendingApplication( P2PApplicationBase *applic void ApplicationList::resumeApplications(bool /*isPrivateChat*/) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "resuming applications."; + kmDebug() << "resuming applications."; #endif #ifdef KMESSTEST KMESS_ASSERT( pauseApplications_ ); @@ -1389,7 +1389,7 @@ void ApplicationList::resumeApplications(bool /*isPrivateChat*/) if( dataSendingApplications_.isEmpty() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "no action taken because no appliations need to transfer data."; + kmDebug() << "no action taken because no appliations need to transfer data."; #endif return; } @@ -1400,14 +1400,14 @@ void ApplicationList::resumeApplications(bool /*isPrivateChat*/) if( sbReadyWriteTester_.isActive() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "switchboard write handler is already active, " + kmDebug() << "switchboard write handler is already active, " << "no special action needed."; #endif } else { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "restarting switchboard write handler."; + kmDebug() << "restarting switchboard write handler."; #endif // No direct connection (as expected), restart switchboard write handler. @@ -1421,14 +1421,14 @@ void ApplicationList::resumeApplications(bool /*isPrivateChat*/) if( directConnection_->isWriteHandlerConnected() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "direct connection is available with write handler, " + kmDebug() << "direct connection is available with write handler, " << "no special action needed."; #endif } else { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "direct connection is available, " + kmDebug() << "direct connection is available, " << "reconnecting write handler.."; #endif @@ -1492,7 +1492,7 @@ bool ApplicationList::sendMessage(const P2PApplicationBase *source, const QByteA if( directConnection_ != 0 ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "there is a direct connection object, " + kmDebug() << "there is a direct connection object, " "test if the socket is still connected and not timed out."; #endif @@ -1521,7 +1521,7 @@ bool ApplicationList::sendMessage(const P2PApplicationBase *source, const QByteA } else if( directConnection_->hasTemporaryWriteError() ) { - kWarning() << "message could not be fully sent, " + kmWarning() << "message could not be fully sent, " "but the remaining part is in the send buffer."; return true; } @@ -1531,7 +1531,7 @@ bool ApplicationList::sendMessage(const P2PApplicationBase *source, const QByteA KMESS_ASSERT( directConnection_->hasLastWriteFailed() ); #endif - kWarning() << "P2P message could not be sent over the direct connection, " + kmWarning() << "P2P message could not be sent over the direct connection, " "using switchboard instead (contact=" << contactHandle_ << ")."; // NOTE: The direct connection will still appear as connected. @@ -1628,7 +1628,7 @@ void ApplicationList::setPendingConnectionInvitation(bool state) if( failed ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Pending connection invitation was aborted by P2PApplication, " + kmDebug() << "Pending connection invitation was aborted by P2PApplication, " << "informing application no direct connection is possible."; #endif @@ -1646,7 +1646,7 @@ void ApplicationList::setPendingConnectionInvitation(bool state) void ApplicationList::slotActiveConnectionAuthorized() { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Direct connection with '" << contactHandle_ << "' authorized."; + kmDebug() << "Direct connection with '" << contactHandle_ << "' authorized."; #endif #ifdef KMESSTEST KMESS_ASSERT( directConnection_ != 0 ); @@ -1667,7 +1667,7 @@ void ApplicationList::slotActiveConnectionAuthorized() void ApplicationList::slotActiveConnectionClosed() { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "The direct connection with '" << contactHandle_ << "' was closed."; + kmDebug() << "The direct connection with '" << contactHandle_ << "' was closed."; #endif // Reset state variable. @@ -1693,7 +1693,7 @@ void ApplicationList::slotActiveConnectionClosed() // Active connection closed, but no pointer known. // It must be reset in slotGotDirectConnectionMessage() when the nonce was invalid. #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "The current connection was closed prematurely, " + kmDebug() << "The current connection was closed prematurely, " << "signaling instead that the connection failed."; #endif @@ -1721,14 +1721,14 @@ void ApplicationList::slotActiveConnectionClosed() } // Give users some insight why transfer becomes slow. - kWarning() << "The direct connection closed " + kmWarning() << "The direct connection closed " "while there are active file transfers over the connection. " "Switching sessions to slow indirect transfer " "(sessions=" << activeSessions << " contact=" << contactHandle_ << ")."; #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "direct connection closed, " + kmDebug() << "direct connection closed, " << "starting switchboard write handler to continue transfers."; #endif @@ -1748,7 +1748,7 @@ void ApplicationList::slotActiveConnectionClosed() void ApplicationList::slotAllConnectionsFailed() { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "The direct connection with '" << contactHandle_ << "' could not be made."; + kmDebug() << "The direct connection with '" << contactHandle_ << "' could not be made."; #endif #ifdef KMESSTEST KMESS_ASSERT( directConnectionPool_ != 0 ); @@ -1762,7 +1762,7 @@ void ApplicationList::slotAllConnectionsFailed() if( directConnection_ == 0 && addingConnections_ ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "No connections left, but still adding connections. Ignoring event."; + kmDebug() << "No connections left, but still adding connections. Ignoring event."; #endif return; } @@ -1770,11 +1770,11 @@ void ApplicationList::slotAllConnectionsFailed() #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL if( directConnection_ == 0 ) { - kDebug() << "No remaining direct connections left"; + kmDebug() << "No remaining direct connections left"; } else { - kDebug() << "The current connection was closed prematurely"; + kmDebug() << "The current connection was closed prematurely"; } #endif @@ -1805,7 +1805,7 @@ void ApplicationList::slotAllConnectionsFailed() void ApplicationList::slotConnectionEstablished() { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Direct connection with '" << contactHandle_ << "' established."; + kmDebug() << "Direct connection with '" << contactHandle_ << "' established."; #endif #ifdef KMESSTEST KMESS_ASSERT( directConnection_ == 0 ); @@ -1836,7 +1836,7 @@ void ApplicationList::slotConnectionReadyWrite() if( KMESS_NULL(directConnection_) ) return; #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "The direct connection is ready to send more data, " + kmDebug() << "The direct connection is ready to send more data, " << "notifying applications."; #endif @@ -1844,7 +1844,7 @@ void ApplicationList::slotConnectionReadyWrite() if( dataSendingApplications_.isEmpty() || p2pApplications_.isEmpty() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "no active outgoing transfers left, " + kmDebug() << "no active outgoing transfers left, " << "disconnecting write handler."; #endif @@ -1892,7 +1892,7 @@ void ApplicationList::slotGotDirectConnectionMessage(const QByteArray &messageDa // Last check to know this is really a P2P message. if(messageData.size() < 48) { - kWarning() << "Received an unknown message from the " + kmWarning() << "Received an unknown message from the " << " direct-connection-link (message dump follows).\n" << messageData.data(); return; } @@ -1900,7 +1900,7 @@ void ApplicationList::slotGotDirectConnectionMessage(const QByteArray &messageDa // Parse the message P2PMessage message(messageData); #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Received data message from the direct connection link" + kmDebug() << "Received data message from the direct connection link" << " (flags=0x" << QString::number(message.getFlags(), 16) << ")."; #endif @@ -1913,10 +1913,10 @@ void ApplicationList::slotGotDirectConnectionMessage(const QByteArray &messageDa if( app == 0 ) { // Invalid nonce! Drop connection - kWarning() << "Contact sent invalid nonce or session was already terminated, " + kmWarning() << "Contact sent invalid nonce or session was already terminated, " << "closing direct connection."; #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Closing connection, moving transfer to switchboard."; + kmDebug() << "Closing connection, moving transfer to switchboard."; #endif #ifdef KMESSTEST KMESS_ASSERT( sender() != 0 ); @@ -1958,7 +1958,7 @@ void ApplicationList::slotSwitchboardTestReadyWrite() if( pauseApplications_ ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "switchboard requested pause, " + kmDebug() << "switchboard requested pause, " << "postponing action."; #endif return; @@ -1968,14 +1968,14 @@ void ApplicationList::slotSwitchboardTestReadyWrite() if( dataSendingApplications_.isEmpty() || p2pApplications_.isEmpty() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "no active outgoing transfers left, " + kmDebug() << "no active outgoing transfers left, " << "disconnecting write handler."; #endif return; } #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "a switchboard is ready to send more data, " + kmDebug() << "a switchboard is ready to send more data, " << "notifying applications."; #endif @@ -1997,7 +1997,7 @@ void ApplicationList::slotSwitchboardTestReadyWrite() if( dataSendingApplications_.isEmpty() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "all applications are done."; + kmDebug() << "all applications are done."; #endif return; } @@ -2018,7 +2018,7 @@ void ApplicationList::slotSwitchboardTestReadyWrite() { if( directConnection_->hasLastWriteFailed() ) { - kDebug() << "A direct connection became available, " + kmDebug() << "A direct connection became available, " "but had a error while writing. Will continue to use the switchboard."; } } @@ -2034,7 +2034,7 @@ void ApplicationList::slotSwitchboardTestReadyWrite() if( ! pauseApplications_ ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "scheduling next call."; + kmDebug() << "scheduling next call."; #endif // Instead of receiving a signal from the switchboard, @@ -2044,7 +2044,7 @@ void ApplicationList::slotSwitchboardTestReadyWrite() else { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "switchboard requested to pause the transfer, " + kmDebug() << "switchboard requested to pause the transfer, " << "postponing next action."; #endif } @@ -2052,7 +2052,7 @@ void ApplicationList::slotSwitchboardTestReadyWrite() else { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "switching to direct connection transfer."; + kmDebug() << "switching to direct connection transfer."; #endif // There appears to be a direct connection! @@ -2061,7 +2061,7 @@ void ApplicationList::slotSwitchboardTestReadyWrite() if( ! directConnection_->isWriteHandlerConnected() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "no write handler connected yet, " + kmDebug() << "no write handler connected yet, " << "connecting write handler to direct connection."; #endif directConnection_->connectWriteHandler( this, SLOT(slotConnectionReadyWrite()) ); @@ -2086,7 +2086,7 @@ void ApplicationList::slotTerminateApplication(Application *application) // It's a mime application if( mimeApplications_.removeAll( mimeApp ) == 0 ) { - kWarning() << "Could not remove MimeApplication" + kmWarning() << "Could not remove MimeApplication" << " (type=" << mimeApp->metaObject()->className() << " contact=" << contactHandle_ << ")!"; } } @@ -2097,7 +2097,7 @@ void ApplicationList::slotTerminateApplication(Application *application) if( dataSendingApplications_.contains( p2pApp ) ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "application is terminating while sending data, unregistering as data sending application first."; + kmDebug() << "application is terminating while sending data, unregistering as data sending application first."; #endif unregisterDataSendingApplication( p2pApp ); @@ -2106,20 +2106,20 @@ void ApplicationList::slotTerminateApplication(Application *application) // Remove from collection if( p2pApplications_.removeAll( static_cast( p2pApp ) ) == 0 ) { - kWarning() << "Could not remove P2PApplication" + kmWarning() << "Could not remove P2PApplication" " (type=" << p2pApp->metaObject()->className() << " contact=" << contactHandle_ << ")!"; } } else { // Warn when there is a problem deleting the object. - kWarning() << "Can't determine type of application " + kmWarning() << "Can't determine type of application " " (type=" << application->metaObject()->className() << " contact=" << contactHandle_ << ")!"; } #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Removing application."; + kmDebug() << "Removing application."; #endif // Remove the application @@ -2136,13 +2136,13 @@ void ApplicationList::slotTerminateApplication(Application *application) if( ! abortingApplications_.isEmpty() ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Still " << abortingApplications_.count() << " other applications left to abort..."; + kmDebug() << "Still " << abortingApplications_.count() << " other applications left to abort..."; #endif } else { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Signalling that applications of '" << contactHandle_ << "' have been aborted."; + kmDebug() << "Signalling that applications of '" << contactHandle_ << "' have been aborted."; #endif // This may cause listeners to delete this object.. @@ -2152,7 +2152,7 @@ void ApplicationList::slotTerminateApplication(Application *application) else { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "Application was not part of the scheduelled applications to abort."; + kmDebug() << "Application was not part of the scheduelled applications to abort."; #endif } } @@ -2165,20 +2165,20 @@ void ApplicationList::slotTerminateApplication(Application *application) void ApplicationList::unregisterDataSendingApplication( P2PApplicationBase *application ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "removing application from the list of active outgoing transfers."; + kmDebug() << "removing application from the list of active outgoing transfers."; #endif bool found = dataSendingApplications_.removeAll( application ) > 0; if( ! found ) { - kWarning() << "application not found in list."; + kmWarning() << "application not found in list."; } // Stop write handler is all applications stopped sending a file. if( dataSendingApplications_.isEmpty() && directConnection_ != 0 ) { #ifdef KMESSDEBUG_APPLICATIONLIST_GENERAL - kDebug() << "no applications remaining, disabling connection write handler."; + kmDebug() << "no applications remaining, disabling connection write handler."; #endif directConnection_->disconnectWriteHandler( this, SLOT(slotConnectionReadyWrite()) ); @@ -2189,11 +2189,11 @@ void ApplicationList::unregisterDataSendingApplication( P2PApplicationBase *appl // Debug why the write handler was not disabled yet. if( directConnection_ != 0 ) { - kDebug() << "connection write handler not disabled, there are still " << dataSendingApplications_.count() << " applications sending file data."; + kmDebug() << "connection write handler not disabled, there are still " << dataSendingApplications_.count() << " applications sending file data."; } else { - kDebug() << "connection write handler not disabled, no direct connection active already."; + kmDebug() << "connection write handler not disabled, no direct connection active already."; } } #endif diff --git a/src/network/applications/filetransfer.cpp b/src/network/applications/filetransfer.cpp index d98ca42..92ba412 100644 --- a/src/network/applications/filetransfer.cpp +++ b/src/network/applications/filetransfer.cpp @@ -73,7 +73,7 @@ FileTransfer::FileTransfer(const QString &contactHandle, const QString &filename FileTransfer::~FileTransfer() { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif // Displays the cancel state in the transfer window @@ -119,7 +119,7 @@ void FileTransfer::connectMsnFtpConnection() void FileTransfer::contactAborted(const QString &message) { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif Q_UNUSED( message ); @@ -145,7 +145,7 @@ void FileTransfer::contactAborted(const QString &message) void FileTransfer::contactStarted1_ContactInvitesUser(const MimeMessage& message) { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif // Get the file name and size from the message @@ -175,7 +175,7 @@ void FileTransfer::contactStarted1_ContactInvitesUser(const MimeMessage& message void FileTransfer::contactStarted2_UserAccepts() { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug() << "Starting."; + kmDebug() << "Starting."; #endif #ifdef KMESSTEST KMESS_ASSERT( file_ == 0 ); @@ -238,7 +238,7 @@ void FileTransfer::contactStarted2_UserAccepts() if( filePath_.isNull() ) { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "User cancelled in file save dialog"; + kmDebug() << "User cancelled in file save dialog"; #endif // Dialog cancelled, cancel afterall @@ -275,11 +275,11 @@ void FileTransfer::contactStarted2_UserAccepts() if( ! success ) { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Cancelling session"; + kmDebug() << "Cancelling session"; #endif // Notify the user, even if debug mode is not enabled. - kWarning() << "Unable to open file: " << filePath_ << "!"; + kmWarning() << "Unable to open file: " << filePath_ << "!"; // Close the file (also causes gotData() to fail) delete file_; @@ -302,7 +302,7 @@ void FileTransfer::contactStarted2_UserAccepts() #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Sending accept message"; + kmDebug() << "Sending accept message"; #endif // All passed. Send the accept message @@ -325,7 +325,7 @@ void FileTransfer::contactStarted2_UserAccepts() void FileTransfer::contactStarted3_ContactConfirmsAccept(const MimeMessage& message) { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif #ifdef KMESSTEST KMESS_ASSERT( ! fileName_.isEmpty() ); @@ -387,7 +387,7 @@ void FileTransfer::contactStarted3_ContactConfirmsAccept(const MimeMessage& mess #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug() << "IP: " << ip << " Port: " << port << " AuthCookie: " << authCookie; + kmDebug() << "IP: " << ip << " Port: " << port << " AuthCookie: " << authCookie; #endif // Initialize the MSNFTP connection @@ -474,7 +474,7 @@ void FileTransfer::slotCancelTransfer( int transferID ) } #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif // Call userAborted() which cleans up this object correctly @@ -524,7 +524,7 @@ void FileTransfer::slotMsnFtpStatusMessage( KLocalizedString message, int status void FileTransfer::slotMsnFtpStatusMessage(QString message, int statusType) { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug() << "Status message (type=" << statusType + kmDebug() << "Status message (type=" << statusType << " message=" << message << ")."; #endif @@ -563,7 +563,7 @@ void FileTransfer::slotMsnFtpStatusMessage(QString message, int statusType) void FileTransfer::slotMsnFtpTransferComplete() { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug() << "Transfer successful."; + kmDebug() << "Transfer successful."; #endif // Displays the success in the transfer window @@ -593,7 +593,7 @@ void FileTransfer::slotMsnFtpTransferComplete() void FileTransfer::slotMsnFtpTransferFailed() { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug() << "Transfer failed."; + kmDebug() << "Transfer failed."; #endif // If MsnFtpConnection did not emit a statusMessage(.. STATUS_DIALOG_FAILED) signal @@ -651,7 +651,7 @@ QString FileTransfer::toReadableBytes( ulong bytes ) void FileTransfer::userAborted() { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif // Display the cancel state in the transfer window @@ -711,7 +711,7 @@ void FileTransfer::userAborted() void FileTransfer::userStarted1_UserInvitesContact() { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif #ifdef KMESSTEST KMESS_ASSERT( ! filePath_.isEmpty() ); @@ -726,11 +726,11 @@ void FileTransfer::userStarted1_UserInvitesContact() if( ! success ) { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Cancelling session"; + kmDebug() << "Cancelling session"; #endif // Notify the user, even if debug mode is not enabled. - kWarning() << "Unable to open file: " << filePath_ << "!"; + kmWarning() << "Unable to open file: " << filePath_ << "!"; // Close the file delete file_; @@ -782,7 +782,7 @@ void FileTransfer::userStarted1_UserInvitesContact() void FileTransfer::userStarted2_ContactAccepts(const MimeMessage& /*message*/) { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif #ifdef KMESSTEST KMESS_ASSERT( msnFtpConnection_ == 0 ); @@ -850,7 +850,7 @@ void FileTransfer::userStarted3_UserPrepares() else { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug() << "Pointer file_ is null!"; + kmDebug() << "Pointer file_ is null!"; #endif slotMsnFtpTransferFailed(); } diff --git a/src/network/applications/filetransferp2p.cpp b/src/network/applications/filetransferp2p.cpp index cf91e5c..4f18659 100644 --- a/src/network/applications/filetransferp2p.cpp +++ b/src/network/applications/filetransferp2p.cpp @@ -112,7 +112,7 @@ void FileTransferP2P::contactAborted(const QString &message) void FileTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &message) { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug(); + kmDebug(); #endif // First stage of the file transfer: initiate the session @@ -123,7 +123,7 @@ void FileTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &mess if(appID != 2) { - kWarning() << "Received unexpected AppID: " << appID << "."; + kmWarning() << "Received unexpected AppID: " << appID << "."; // Wouldn't know what to do if the AppID is not 2, so send an 500 Internal Error back. showEventMessage( i18n("The file transfer invitation was cancelled. Bad data was received."), ChatMessage::CONTENT_APP_CANCELED, true ); @@ -138,7 +138,7 @@ void FileTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &mess // Just to be on the safe side, check the buffer size before we start copying. if( context.length() <= 24 ) { - kWarning() << "File transfer context field has bad formatting, " + kmWarning() << "File transfer context field has bad formatting, " "ignoring invite (context=" << context << ", contact=" << getContactHandle() << ")."; showEventMessage( i18n("The file transfer invitation was cancelled. Bad data was received."), ChatMessage::CONTENT_APP_CANCELED, true ); sendCancelMessage( CANCEL_ABORT ); @@ -155,7 +155,7 @@ void FileTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &mess // Again, I don't want KMess to crash or being exploited. if( fieldsLength > (uint) decodedContext.size() || fieldsLength < 24 ) { - kWarning() << "File transfer context field has bad formatting, rejecting invite" + kmWarning() << "File transfer context field has bad formatting, rejecting invite" " (length=" << fieldsLength << ", contact=" << getContactHandle() << ")"; showEventMessage( i18n("The file transfer invitation was cancelled. Bad data was received."), ChatMessage::CONTENT_APP_CANCELED, true ); sendCancelMessage( CANCEL_ABORT ); @@ -171,7 +171,7 @@ void FileTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &mess unsigned int splitter = P2PMessage::extractBytes( decodedContext, splitterPos ); if( splitter != 0xFFFFFFFF ) { - kWarning() << "File transfer context field has bad formatting " + kmWarning() << "File transfer context field has bad formatting " "(splitter not found at byte " << splitterPos << "," " found 0x" << QString::number( splitter, 16 ) << " contact=" << getContactHandle() << ")."; @@ -208,7 +208,7 @@ void FileTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &mess previewData = rawPreviewData.toBase64(); #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Using icon '" << iconTitle << "' as preview."; + kmDebug() << "Using icon '" << iconTitle << "' as preview."; #endif } else @@ -223,7 +223,7 @@ void FileTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &mess preview_ = QImage::fromData( rawPreviewData ); #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Encoded data size: " << previewData.length(); + kmDebug() << "Encoded data size: " << previewData.length(); #endif } @@ -247,7 +247,7 @@ void FileTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &mess // Display the accept message. #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "File to transfer is " << suggestedFileName_ << ", " + kmDebug() << "File to transfer is " << suggestedFileName_ << ", " << "waiting for user to accept."; #endif @@ -262,7 +262,7 @@ void FileTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &mess void FileTransferP2P::contactStarted2_UserAccepts() { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Starting."; + kmDebug() << "Starting."; #endif #ifdef KMESSTEST @@ -324,7 +324,7 @@ void FileTransferP2P::contactStarted2_UserAccepts() if( filePath_.isNull() ) { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "User cancelled in file save dialog"; + kmDebug() << "User cancelled in file save dialog"; #endif // Dialog cancelled, cancel afterall @@ -361,11 +361,11 @@ void FileTransferP2P::contactStarted2_UserAccepts() if( ! success ) { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Cancelling session"; + kmDebug() << "Cancelling session"; #endif // Notify the user, even if debug mode is not enabled. - kWarning() << "Unable to open file: " << filePath_ << "!"; + kmWarning() << "Unable to open file: " << filePath_ << "!"; // Close the file (also causes gotData() to fail) delete file_; @@ -385,7 +385,7 @@ void FileTransferP2P::contactStarted2_UserAccepts() #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Sending accept message"; + kmDebug() << "Sending accept message"; #endif // Initialize the progress dialog @@ -416,7 +416,7 @@ void FileTransferP2P::contactStarted2_UserAccepts() void FileTransferP2P::contactStarted3_ContactConfirmsAccept(const MimeMessage &/*message*/) { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug(); + kmDebug(); #endif // When the 200 OK message is accepted, the contact sends @@ -436,7 +436,7 @@ void FileTransferP2P::contactStarted3_ContactConfirmsAccept(const MimeMessage &/ void FileTransferP2P::contactStarted4_ContactConfirmsPreparation() { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug(); + kmDebug(); #endif // NOTE: with WLM at slow computers, the contact actually started @@ -466,7 +466,7 @@ QString FileTransferP2P::createContextField( const QFile *fileData, bool usePrev } #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Creating context field " + kmDebug() << "Creating context field " << ( usePreview ? "with thumbnail." : "without thumbnail." ); #endif @@ -501,7 +501,7 @@ QString FileTransferP2P::createContextField( const QFile *fileData, bool usePrev QString base64Context( QString::fromUtf8( encodedContext.data(), encodedContext.size() ) ); #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Context size=" << context.size() << " base64 size=" << base64Context.length() << "."; + kmDebug() << "Context size=" << context.size() << " base64 size=" << base64Context.length() << "."; #endif // Return it. @@ -518,7 +518,7 @@ void FileTransferP2P::endApplication() QString html; #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug(); + kmDebug(); #endif // Mark the transfer as failed and terminate. @@ -582,7 +582,7 @@ void FileTransferP2P::gotData(const P2PMessage &message) { if(file_ == 0) { - kWarning() << "Unable to handle file data: no file open or already closed " + kmWarning() << "Unable to handle file data: no file open or already closed " << "(offset=" << message.getDataOffset() << " totalsize=" << message.getDataSize() << " contact=" << getContactHandle() << ")!"; @@ -596,7 +596,7 @@ void FileTransferP2P::gotData(const P2PMessage &message) #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Data part received, saving data to file."; + kmDebug() << "Data part received, saving data to file."; #endif // Write the data in the file @@ -647,7 +647,7 @@ void FileTransferP2P::initializeProgressDialog(bool incoming, uint filesize) void FileTransferP2P::showTransferComplete() { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug() << "Transfer is complete."; + kmDebug() << "Transfer is complete."; #endif if(file_ != 0) @@ -718,7 +718,7 @@ void FileTransferP2P::slotCancelTransfer( int transferID ) } #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif // Use the same route as closing the chat window. @@ -759,7 +759,7 @@ QString FileTransferP2P::toReadableBytes(uint bytes) void FileTransferP2P::userAborted() { #ifdef KMESSDEBUG_FILETRANSFER_GENERAL - kDebug(); + kmDebug(); #endif // Display the cancel state in the transfer window @@ -777,7 +777,7 @@ void FileTransferP2P::userAborted() void FileTransferP2P::userStarted1_UserInvitesContact() { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "starting file transfer"; + kmDebug() << "starting file transfer"; #endif #ifdef KMESSTEST KMESS_ASSERT( file_ == 0 ); @@ -795,11 +795,11 @@ void FileTransferP2P::userStarted1_UserInvitesContact() if( ! success ) { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug() << "Cancelling session"; + kmDebug() << "Cancelling session"; #endif // Notify the user, even if debug mode is not enabled. - kWarning() << "Unable to open file: " << filePath_ << "!"; + kmWarning() << "Unable to open file: " << filePath_ << "!"; // Close the file delete file_; @@ -880,7 +880,7 @@ void FileTransferP2P::userStarted1_gotThumbnailResult() void FileTransferP2P::userStarted2_ContactAccepts(const MimeMessage & /*message*/) { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug(); + kmDebug(); #endif // Update the GUI @@ -902,7 +902,7 @@ void FileTransferP2P::userStarted2_ContactAccepts(const MimeMessage & /*message* void FileTransferP2P::userStarted3_UserPrepares() { #ifdef KMESSDEBUG_FILETRANSFER_P2P - kDebug(); + kmDebug(); #endif #ifdef KMESSTEST KMESS_ASSERT( file_ != 0 ); diff --git a/src/network/applications/inktransferp2p.cpp b/src/network/applications/inktransferp2p.cpp index e7d2ca4..e7c14c5 100644 --- a/src/network/applications/inktransferp2p.cpp +++ b/src/network/applications/inktransferp2p.cpp @@ -61,7 +61,7 @@ InkTransferP2P::~InkTransferP2P() */ void InkTransferP2P::gotData(const P2PMessage &message) { - kDebug() << "Received data..."; + kmDebug() << "Received data..."; // Write the data in the buffer. bool success = writeP2PDataToFile( message, &inkBuffer_ ); if( ! success ) @@ -86,7 +86,7 @@ void InkTransferP2P::showEventMessage(const QString &message, const ChatMessage: { Q_UNUSED( isIncoming ); - kWarning() << "suppressed message:" << message << "(contact=" << getContactHandle() << ", contentsClass=" << contents << ")"; + kmWarning() << "suppressed message:" << message << "(contact=" << getContactHandle() << ", contentsClass=" << contents << ")"; } @@ -126,7 +126,7 @@ void InkTransferP2P::showSystemMessage( const QString &message, const ChatMessag void InkTransferP2P::showTransferComplete() { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "Last data part received, emitting signals"; + kmDebug() << "Last data part received, emitting signals"; #endif // Read the complete string. It's transmitted in multi byte format. @@ -138,7 +138,7 @@ void InkTransferP2P::showTransferComplete() int endMime = bufferData.indexOf("\r\n\r\n"); if( endMime == -1 ) { - kWarning() << "Failed to find end of MIME header:" << bufferData; + kmWarning() << "Failed to find end of MIME header:" << bufferData; return; } @@ -157,7 +157,7 @@ void InkTransferP2P::showTransferComplete() } else { - kWarning() << "Unable to parse incoming ink from" << getContactHandle() + kmWarning() << "Unable to parse incoming ink from" << getContactHandle() << "with mime-type:" << mimeHeader.getValue( "Content-Type" ); mimeHeader.print(); return; diff --git a/src/network/applications/mimeapplication.cpp b/src/network/applications/mimeapplication.cpp index e15d6aa..a75a484 100644 --- a/src/network/applications/mimeapplication.cpp +++ b/src/network/applications/mimeapplication.cpp @@ -48,14 +48,14 @@ MimeApplication::~MimeApplication() void MimeApplication::contactAborted(const QString &message) { #ifdef KMESSDEBUG_APPLICATION - kDebug(); + kmDebug(); #endif // Make sure a second message is not displayed here. // The contact could be sending multiple error messages. if( isClosing() ) { - kWarning() << "Attempted to close application twice " + kmWarning() << "Attempted to close application twice " "(contact=" << getContactHandle() << " action=endapplication)"; @@ -89,7 +89,7 @@ QString MimeApplication::generateSessionId() const QString sessionId( "{6672F94C-45BF-11D7-B4AE-00010A1008DF}" ); #ifdef KMESSDEBUG_MIMEAPPLICATION - kDebug() << "Generated session ID " << sessionId << "."; + kmDebug() << "Generated session ID " << sessionId << "."; #endif return sessionId; @@ -113,7 +113,7 @@ const QString& MimeApplication::getSessionId() void MimeApplication::gotMessage(const MimeMessage& message) { #ifdef KMESSDEBUG_MIMEAPPLICATION - kDebug() << "An application message was received"; + kmDebug() << "An application message was received"; #endif QString invitationCommand( message.getValue("Invitation-Command") ); @@ -182,13 +182,13 @@ void MimeApplication::gotMessage(const MimeMessage& message) else { // Fallback - kDebug() << "got unhandled Cancel-Code " << cancelCode << "."; + kmDebug() << "got unhandled Cancel-Code " << cancelCode << "."; contactAborted( i18n("The invitation was aborted.") ); } } else { - kDebug() << "got unhandled Invitation-Command " << invitationCommand << "."; + kmDebug() << "got unhandled Invitation-Command " << invitationCommand << "."; } } @@ -231,7 +231,7 @@ void MimeApplication::sendCancelMessage(const ApplicationCancelReason cancelReas else { #ifdef KMESSDEBUG_MIMEAPPLICATION - kWarning() << "Unknown cancelReason used."; + kmWarning() << "Unknown cancelReason used."; #endif cancelCode = "CANCEL"; } @@ -259,13 +259,13 @@ void MimeApplication::sendCancelMessage(const ApplicationCancelReason cancelReas void MimeApplication::userAborted() { #ifdef KMESSDEBUG_MIMEAPPLICATION - kDebug() << "user requests to abort the session."; + kmDebug() << "user requests to abort the session."; #endif // Make sure a second message is not displayed here. if( isClosing() ) { - kWarning() << "Attempted to close application twice " + kmWarning() << "Attempted to close application twice " " contact=" << getContactHandle() << " class=" << metaObject()->className() << " action=endapplication)"; @@ -298,7 +298,7 @@ void MimeApplication::userRejected() if( isClosing() ) { #ifdef KMESSDEBUG_MIMEAPPLICATION - kWarning() << "Attempted to close application twice " + kmWarning() << "Attempted to close application twice " " contact=" << getContactHandle() << " class=" << metaObject()->className() << " action=endapplication)"; @@ -309,7 +309,7 @@ void MimeApplication::userRejected() } #ifdef KMESSDEBUG_MIMEAPPLICATION - kDebug() << "user requests to reject the invitation."; + kmDebug() << "user requests to reject the invitation."; #endif // Send abort messages diff --git a/src/network/applications/msnobjecttransferp2p.cpp b/src/network/applications/msnobjecttransferp2p.cpp index 8782de9..efbe7e2 100644 --- a/src/network/applications/msnobjecttransferp2p.cpp +++ b/src/network/applications/msnobjecttransferp2p.cpp @@ -85,7 +85,7 @@ MsnObjectTransferP2P::~MsnObjectTransferP2P() void MsnObjectTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage &message) { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug(); + kmDebug(); #endif // Extract the fields from the message @@ -97,7 +97,7 @@ void MsnObjectTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage // Just to be on the safe side, check the buffer size before we start decoding if( context.length() <= 24 ) { - kWarning() << "MSNObject transfer context field has bad formatting, " + kmWarning() << "MSNObject transfer context field has bad formatting, " "ignoring invite (context=" << context << ", contact=" << getContactHandle() << ")."; sendCancelMessage( CANCEL_FAILED ); return; @@ -110,7 +110,7 @@ void MsnObjectTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage msnObject_ = MsnObject( contextString ); #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "Got context \"" << contextString << "\"."; + kmDebug() << "Got context \"" << contextString << "\"."; // Got context #endif @@ -122,7 +122,7 @@ void MsnObjectTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage // Test protocol compatibility. if( appID != 1 && appID != 12 ) // Display pictures - AppID 12 is used as of MSN Messenger 7.5 { - kDebug() << "Received a request for a display picture, but unexpected appID was set " + kmDebug() << "Received a request for a display picture, but unexpected appID was set " "(appid=" << appID << " type=" << msnObject_.getType() << " contact=" << getContactHandle() << " action=continue)."; @@ -138,7 +138,7 @@ void MsnObjectTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage if( appID != 1 // HACK: added for compatibility with Messenger for the Mac 6.0.3 and aMsn 0.97rc1 && appID != 11 ) // Custom emoticons { - kDebug() << "Received a request for an emoticon, but unexpected appID was set " + kmDebug() << "Received a request for an emoticon, but unexpected appID was set " "(appid=" << appID << " type=" << msnObject_.getType() << " contact=" << getContactHandle() << " action=continue)."; @@ -162,7 +162,7 @@ void MsnObjectTransferP2P::contactStarted1_ContactInvitesUser(const MimeMessage } // Unknown application type - kWarning() << "Received an invitation for an unexpected object type " + kmWarning() << "Received an invitation for an unexpected object type " "(appid=" << appID << " type=" << msnObject_.getType() << " contact=" << getContactHandle() << ")."; @@ -181,7 +181,7 @@ void MsnObjectTransferP2P::contactStarted1_gotDisplayPictureRequest() // Send our display picture: check if the MSNObject the contact wants is the picture we've got. if( msnObject_.hasChanged( CurrentAccount::instance()->getMsnObjectString() ) ) { - kWarning() << "Contact " << getContactHandle() << " wants a display picture we don't have!\n" + kmWarning() << "Contact " << getContactHandle() << " wants a display picture we don't have!\n" "Requested object: " << msnObject_.objectString() << "\n" "Current object: " << CurrentAccount::instance()->getMsnObjectString() << "\n" "Aborting invite."; @@ -195,7 +195,7 @@ void MsnObjectTransferP2P::contactStarted1_gotDisplayPictureRequest() // Reject because there is no file to send if( fileName_.isEmpty() ) { - kWarning() << "Got an invitation, but we don't have a picture to send."; + kmWarning() << "Got an invitation, but we don't have a picture to send."; sendCancelMessage( CANCEL_FAILED ); return; } @@ -218,7 +218,7 @@ void MsnObjectTransferP2P::contactStarted1_gotEmoticonRequest() if( ! pictureFile.open( QIODevice::ReadOnly ) ) { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "Couldn't open file: " << pictureFile.fileName(); + kmDebug() << "Couldn't open file: " << pictureFile.fileName(); #endif sendCancelMessage( CANCEL_FAILED ); return; @@ -231,14 +231,14 @@ void MsnObjectTransferP2P::contactStarted1_gotEmoticonRequest() MsnObject testObject( CurrentAccount::instance()->getHandle(), msnObject_.getLocation(), QString::null, MsnObject::EMOTICON, data ); #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "msnObject_: " << msnObject_.objectString(); - kDebug() << "testObject: " << testObject.objectString(); + kmDebug() << "msnObject_: " << msnObject_.objectString(); + kmDebug() << "testObject: " << testObject.objectString(); #endif // Test if they're the same picture if( msnObject_.hasChanged( testObject.objectString() ) ) { - kWarning() << "Contact " << getContactHandle() + kmWarning() << "Contact " << getContactHandle() << " wants a custom emoticon we don't have!" << "Requested object: " << msnObject_.objectString() << "Aborting invite."; @@ -247,7 +247,7 @@ void MsnObjectTransferP2P::contactStarted1_gotEmoticonRequest() } #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "Picture found, accepting."; + kmDebug() << "Picture found, accepting."; #endif // Everything seems OK, accept this message @@ -263,7 +263,7 @@ void MsnObjectTransferP2P::contactStarted1_gotWinkRequest() fileName_ = KMessConfig::instance()->getMsnObjectFileName( msnObject_ ); #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "Requested wink, sending: " + fileName_; + kmDebug() << "Requested wink, sending: " + fileName_; #endif if( QFile::exists( fileName_ ) ) @@ -284,7 +284,7 @@ void MsnObjectTransferP2P::contactStarted1_gotWinkRequest() void MsnObjectTransferP2P::contactStarted2_UserAccepts() { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug(); + kmDebug(); #endif #ifdef KMESSTEST @@ -299,14 +299,14 @@ void MsnObjectTransferP2P::contactStarted2_UserAccepts() if( ! success ) { // Notify the user, even if debug mode is not enabled. - kWarning() << "Unable to open file: " << fileName_ << "!"; + kmWarning() << "Unable to open file: " << fileName_ << "!"; // Close the file (also causes gotData() to fail) delete file_; file_ = 0; #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "Cancelling session"; + kmDebug() << "Cancelling session"; #endif // Send 500 Internal Error back if we failed @@ -317,7 +317,7 @@ void MsnObjectTransferP2P::contactStarted2_UserAccepts() #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "Sending accept message"; + kmDebug() << "Sending accept message"; #endif // Create the message @@ -338,7 +338,7 @@ void MsnObjectTransferP2P::contactStarted2_UserAccepts() void MsnObjectTransferP2P::contactStarted3_ContactConfirmsAccept(const MimeMessage &/*message*/) { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug(); + kmDebug(); #endif // Send the data preparation message back. @@ -354,7 +354,7 @@ void MsnObjectTransferP2P::contactStarted3_ContactConfirmsAccept(const MimeMessa void MsnObjectTransferP2P::contactStarted4_ContactConfirmsPreparation() { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug(); + kmDebug(); #endif // Send the file, the base class handles everything else here @@ -393,7 +393,7 @@ void MsnObjectTransferP2P::gotData(const P2PMessage &message) { if(file_ == 0) { - kWarning() << "Unable to handle file data: no file open or already closed " + kmWarning() << "Unable to handle file data: no file open or already closed " << "(offset=" << message.getDataOffset() << " totalsize=" << message.getTotalSize() << " contact=" << getContactHandle() << ")!"; @@ -454,7 +454,7 @@ void MsnObjectTransferP2P::showEventMessage(const QString &message, const ChatMe { Q_UNUSED( isIncoming ); - kWarning() << "suppressed message:" << message << "(contact=" << getContactHandle() << ", contentsClass=" << contents << ")"; + kmWarning() << "suppressed message:" << message << "(contact=" << getContactHandle() << ", contentsClass=" << contents << ")"; } @@ -468,7 +468,7 @@ void MsnObjectTransferP2P::showSystemMessage( const QString &message, const Chat { Q_UNUSED( isIncoming ); - kWarning() << "suppressed message:" << message << "(contact=" << getContactHandle() << ", contentsClass=" << contents << ")"; + kmWarning() << "suppressed message:" << message << "(contact=" << getContactHandle() << ", contentsClass=" << contents << ")"; } @@ -480,7 +480,7 @@ void MsnObjectTransferP2P::showSystemMessage( const QString &message, const Chat void MsnObjectTransferP2P::showTransferComplete() { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "Last data part received, closing file"; + kmDebug() << "Last data part received, closing file"; #endif if( KMESS_NULL(file_) ) return; @@ -533,7 +533,7 @@ void MsnObjectTransferP2P::showTransferComplete() // For pictures, see if it's broken. if( QImageReader::imageFormat( pictureFileName ).isEmpty() || ! success ) { - kWarning() << "Received image was broken (contact=" << getContactHandle() << ")."; + kmWarning() << "Received image was broken (contact=" << getContactHandle() << ")."; QFile::remove( pictureFileName ); return; } @@ -599,7 +599,7 @@ void MsnObjectTransferP2P::showTransferComplete() void MsnObjectTransferP2P::showTransferMessage( const QString &message ) { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "suppressed message: " << message; + kmDebug() << "suppressed message: " << message; #else Q_UNUSED( message ); // Avoid compiler warnings #endif @@ -616,7 +616,7 @@ void MsnObjectTransferP2P::showTransferMessage( const QString &message ) void MsnObjectTransferP2P::userStarted1_UserInvitesContact() { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug() << "requesting display picture"; + kmDebug() << "requesting display picture"; #endif // Set the filename @@ -667,7 +667,7 @@ void MsnObjectTransferP2P::userStarted1_UserInvitesContact() void MsnObjectTransferP2P::userStarted2_ContactAccepts(const MimeMessage & /*message*/) { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug(); + kmDebug(); #endif // We don't need to do anything else here. @@ -684,7 +684,7 @@ void MsnObjectTransferP2P::userStarted2_ContactAccepts(const MimeMessage & /*mes void MsnObjectTransferP2P::userStarted3_UserPrepares() { #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kDebug(); + kmDebug(); #endif #ifdef KMESSTEST @@ -697,7 +697,7 @@ void MsnObjectTransferP2P::userStarted3_UserPrepares() // TODO: Quick fix for WML8, this method is called twice because WLM8 // initializes a Direct connection while it sent the data preparation #ifdef KMESSDEBUG_MSNOBJECTTRANSFER_P2P - kWarning() << "this method was already called before."; + kmWarning() << "this method was already called before."; #endif return; } @@ -709,7 +709,7 @@ void MsnObjectTransferP2P::userStarted3_UserPrepares() if( ! success ) { // Notify the user, even if debug mode is not enabled. - kWarning() << "Unable to open file: " << fileName_ << "!"; + kmWarning() << "Unable to open file: " << fileName_ << "!"; // Close the file (also causes gotData() to fail) delete file_; diff --git a/src/network/applications/p2papplication.cpp b/src/network/applications/p2papplication.cpp index 9a2fa6c..79e3f18 100644 --- a/src/network/applications/p2papplication.cpp +++ b/src/network/applications/p2papplication.cpp @@ -81,7 +81,7 @@ P2PApplication::P2PApplication(ApplicationList *applicationList) P2PApplication::~P2PApplication() { #ifdef KMESSDEBUG_APPLICATION - kDebug() << " session=" << getSessionID(); + kmDebug() << " session=" << getSessionID(); #endif applicationList_ = 0; @@ -102,7 +102,7 @@ P2PApplication::~P2PApplication() void P2PApplication::contactAborted(const QString &message) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "state=" << (int) getWaitingState(); + kmDebug() << "state=" << (int) getWaitingState(); #endif // Make sure a second message is not displayed here. @@ -110,7 +110,7 @@ void P2PApplication::contactAborted(const QString &message) if( isWaitingState( P2P_WAIT_END_APPLICATION ) ) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Abort the application again, " + kmDebug() << "Abort the application again, " "application was already awaiting termination."; #endif @@ -120,7 +120,7 @@ void P2PApplication::contactAborted(const QString &message) } else if( isClosing() ) { - kWarning() << "Attempted to close application twice " + kmWarning() << "Attempted to close application twice " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -149,7 +149,7 @@ void P2PApplication::contactAborted(const QString &message) // - The P2P session is still active in WLM, // and has a bridge now, so WLM sends the SLP BYE. // - kmess will ack it with a temporary p2p session. - kWarning() << "not displaying message because data transfer is complete. " + kmWarning() << "not displaying message because data transfer is complete. " "The switchboard was likely closed after receiving all data. " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << @@ -196,17 +196,17 @@ void P2PApplication::contactAborted(const QString &message) void P2PApplication::contactStarted1_ContactInvitesUser(const MimeMessage &message) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "(rejects invitation)"; + kmDebug() << "(rejects invitation)"; #endif // We can assume the switchboard already displayed a better error message #ifdef KMESTEST - kWarning() << "The Application subclass didn't implement contactStarted1_ContactInvitesUser!"; + kmWarning() << "The Application subclass didn't implement contactStarted1_ContactInvitesUser!"; #endif // Send some debug info to the console MimeMessage slpMimeBody(message.getBody()); - kWarning() << "The contact sent an MSNSLP invitation type KMess can't handle yet " + kmWarning() << "The contact sent an MSNSLP invitation type KMess can't handle yet " "(euf-guid=" << slpMimeBody.getValue("EUF-GUID") << " appid=" << slpMimeBody.getValue("AppID") << " action=send500)."; @@ -233,7 +233,7 @@ void P2PApplication::contactStarted1_ContactInvitesUser(const MimeMessage &messa void P2PApplication::contactStarted4_ContactConfirmsPreparation() { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug(); + kmDebug(); #endif } @@ -349,7 +349,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke // Are we waiting for the contact to accept our invitation (e.g. send "200 OK")? case P2P_MSG_SESSION_INVITATION: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message (INVITE ACK)."; + kmDebug() << "Got an ACK message (INVITE ACK)."; #endif gotAck_slpSessionInvitation(); @@ -360,7 +360,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke case P2P_MSG_SESSION_OK: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message (200 OK ACK)."; + kmDebug() << "Got an ACK message (200 OK ACK)."; #endif gotAck_slpSessionOk(); @@ -370,7 +370,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke // Are we waiting for the contact to accept our transfer invitation (e.g. send "200 OK")? case P2P_MSG_TRANSFER_INVITATION: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message (INVITE transfer ACK)."; + kmDebug() << "Got an ACK message (INVITE transfer ACK)."; #endif gotAck_slpTransferInvitation(); @@ -381,7 +381,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke case P2P_MSG_TRANSFER_OK: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message (200 transfer OK ACK)."; + kmDebug() << "Got an ACK message (200 transfer OK ACK)."; #endif gotAck_slpTransferOk(); @@ -392,7 +392,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke case P2P_MSG_DATA_PREPARATION: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message (data-preparation ACK)."; + kmDebug() << "Got an ACK message (data-preparation ACK)."; #endif #ifdef KMESSTEST KMESS_ASSERT( message.getAckDataSize() == 4 ); @@ -405,7 +405,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke // Are we waiting for the ACK to confirm that all data was received? case P2P_MSG_DATA: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message (all-received ACK)."; + kmDebug() << "Got an ACK message (all-received ACK)."; #endif gotAck_dataReceived(); @@ -415,7 +415,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke // Are we waiting for the BYE ACK to quit the session/application? case P2P_MSG_SESSION_BYE: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message (BYE ACK, terminating)."; + kmDebug() << "Got an ACK message (BYE ACK, terminating)."; #endif gotAck_slpBye(); @@ -425,7 +425,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke // Are we expecting a ACK for our decline of the transfer? case P2P_MSG_TRANSFER_DECLINE: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message (transfer decline ACK)."; + kmDebug() << "Got an ACK message (transfer decline ACK)."; #endif gotAck_slpTransferDecline(); @@ -435,7 +435,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke // Are we waiting for the SLP Error message to be ACK-ed? case P2P_MSG_SLP_ERROR: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message (Confirmed SLP Error)."; + kmDebug() << "Got an ACK message (Confirmed SLP Error)."; #endif gotAck_slpError(); @@ -446,7 +446,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke default: #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an ACK message. " + kmDebug() << "Got an ACK message. " "waitingState=" << (int) getWaitingState() << " ackedMessageType=" << ackedMessageType << "."; #endif @@ -454,7 +454,7 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke if( gotUnhandledAck( message, ackedMessageType ) ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Message is handled by gotUnhandledAck(), no further action needed."; + kmDebug() << "Message is handled by gotUnhandledAck(), no further action needed."; #endif return; } @@ -463,14 +463,14 @@ void P2PApplication::gotAck(const P2PMessage &message, const P2PMessageType acke if( isWaitingState( P2P_WAIT_FOR_CONNECTION ) ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "No special action taken (waiting for a connection)."; + kmDebug() << "No special action taken (waiting for a connection)."; #endif } else if( ackedMessageType != P2P_MSG_UNKNOWN || ! isWaitingState( P2P_WAIT_DEFAULT ) ) { // Unexpected, this should be a normal ACK message. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kWarning() << "Unhandled state for ACK message:" + kmWarning() << "Unhandled state for ACK message:" " waitingState=" << (int) getWaitingState() << " ackedMessageType=" << ackedMessageType << "!"; #endif // If we were waiting: the timer is stopped and @@ -507,7 +507,7 @@ void P2PApplication::gotAck_dataPreparation() if(isUserStartedApp()) { // We received a data preparation ACK but didn't expect it. - kWarning() << "P2P message can't be handled, " + kmWarning() << "P2P message can't be handled, " "this ack is not expected for applications started by the user " "(contact=" << getContactHandle() << " session=" << sessionID_ << @@ -527,7 +527,7 @@ void P2PApplication::gotAck_dataPreparation() if( hasUnAckedMessage( P2P_MSG_TRANSFER_OK ) ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Application is waiting for a 200 transfer OK ACK, " + kmDebug() << "Application is waiting for a 200 transfer OK ACK, " "not initiating transfer yet."; #endif @@ -556,7 +556,7 @@ void P2PApplication::gotAck_dataReceived() if(isUserStartedApp()) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "All data sent and confirmed, " + kmDebug() << "All data sent and confirmed, " "sending BYE message..."; #endif @@ -572,7 +572,7 @@ void P2PApplication::gotAck_dataReceived() else { #ifdef gotAck_dataReceived - kDebug() << "All data sent and confirmed, " + kmDebug() << "All data sent and confirmed, " "waiting for BYE message..."; #endif @@ -597,7 +597,7 @@ void P2PApplication::gotAck_slpBye() { if( ! isWaitingState( P2P_WAIT_FOR_SLP_BYE_ACK ) ) { - kWarning() << "Unexpected SLP BYE received!"; + kmWarning() << "Unexpected SLP BYE received!"; } // Test whether the data transfer to the contact was aborted. @@ -624,7 +624,7 @@ void P2PApplication::gotAck_slpError() if(! isUserStartedApp()) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "The contact started this application, waiting for BYE."; + kmDebug() << "The contact started this application, waiting for BYE."; #endif // We wait for the BYE @@ -633,7 +633,7 @@ void P2PApplication::gotAck_slpError() else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "The user started this application, terminating."; + kmDebug() << "The user started this application, terminating."; #endif // TODO: send BYE after the client confirmed our SLP error? @@ -651,7 +651,7 @@ void P2PApplication::gotAck_slpError() void P2PApplication::gotAck_slpSessionInvitation() { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for 200 OK message..."; + kmDebug() << "Waiting for 200 OK message..."; #endif // Continue to wait for the contact to send the accept message (SLP OK). @@ -676,7 +676,7 @@ void P2PApplication::gotAck_slpSessionOk() { // We received an 200 OK ACK but didn't expect it. // This is very unlikely, but still prevent worse situations when contactStarted3_.. is invoked(). - kWarning() << "P2P message can't be handled, " + kmWarning() << "P2P message can't be handled, " "this ack is not expected for applications started by the user " "(contact=" << getContactHandle() << " session=" << sessionID_ << @@ -708,7 +708,7 @@ void P2PApplication::gotAck_slpSessionOk() if( isWaitingState( P2P_WAIT_DEFAULT ) ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting state not changed, " + kmDebug() << "Waiting state not changed, " "waiting for file data..."; #endif @@ -735,13 +735,13 @@ void P2PApplication::gotAck_slpTransferDecline() if( isTransferActive() || isWaitingState( P2P_WAIT_FOR_FILE_DATA ) ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got ack while data transfer is already active."; + kmDebug() << "Got ack while data transfer is already active."; #endif } else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for file data..."; + kmDebug() << "Waiting for file data..."; #endif // Continue to wait for the contact to send the file data @@ -759,7 +759,7 @@ void P2PApplication::gotAck_slpTransferDecline() void P2PApplication::gotAck_slpTransferInvitation() { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for 200 OK message..."; + kmDebug() << "Waiting for 200 OK message..."; #endif #ifdef KMESSTEST KMESS_ASSERT( isWaitingState( P2P_WAIT_FOR_INVITE_TR_ACK ) ); @@ -786,7 +786,7 @@ void P2PApplication::gotAck_slpTransferOk() // Detect this, otherwise the chat window is filled with "File transfer complete.. Contact aborted" messages. if( isTransferComplete() || isWaitingState( P2P_WAIT_FOR_SLP_BYE ) ) { - kWarning() << "Received ACK for 'transrespbody' message " + kmWarning() << "Received ACK for 'transrespbody' message " "while closing the session " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << @@ -809,7 +809,7 @@ void P2PApplication::gotAck_slpTransferOk() && ! applicationList_->hasPendingConnections() ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "No connection attempts were made, " + kmDebug() << "No connection attempts were made, " "so starting transfer immediately."; #endif // TODO: the contact may actually send an INVITE back to become the server. @@ -818,7 +818,7 @@ void P2PApplication::gotAck_slpTransferOk() else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "200 transfer OK ACK received, " + kmDebug() << "200 transfer OK ACK received, " "but waiting for connection attempts to succeed or fail..."; #endif } @@ -827,7 +827,7 @@ void P2PApplication::gotAck_slpTransferOk() if( isWaitingState( P2P_WAIT_DEFAULT ) ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting state not changed, " + kmDebug() << "Waiting state not changed, " "waiting for file data..."; #endif @@ -835,7 +835,7 @@ void P2PApplication::gotAck_slpTransferOk() // the data transfer before waiting for a connection. if( isTransferActive() ) { - kWarning() << "already received " << getTransferredBytes() << " bytes before receiving the 200 transfer OK ACK " + kmWarning() << "already received " << getTransferredBytes() << " bytes before receiving the 200 transfer OK ACK " "(state=" << (int) getWaitingState() << " dc=" << applicationList_->hasDirectConnection() << " dcauth=" << applicationList_->hasAuthorizedDirectConnection() << @@ -868,7 +868,7 @@ void P2PApplication::gotAck_slpTransferOk() void P2PApplication::gotData(const P2PMessage &/*message*/) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kWarning() << "Data not handeled by derived class."; + kmWarning() << "Data not handeled by derived class."; #endif } @@ -891,7 +891,7 @@ void P2PApplication::gotDataComplete( const P2PMessage &lastMessage ) if(isUserStartedApp()) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Application was started by the user, also send SLP BYE."; + kmDebug() << "Application was started by the user, also send SLP BYE."; #endif // Current state could be P2P_WAIT_FOR_FILE_DATA, but reset it here. @@ -905,7 +905,7 @@ void P2PApplication::gotDataComplete( const P2PMessage &lastMessage ) else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Application was started by the contact, waiting for SLP BYE..."; + kmDebug() << "Application was started by the contact, waiting for SLP BYE..."; #endif // Otherwise we wait for the BYE @@ -926,7 +926,7 @@ void P2PApplication::gotDataComplete( const P2PMessage &lastMessage ) void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got a direct connection handshake message."; + kmDebug() << "Got a direct connection handshake message."; #endif // If the contact was sending a handshake when we dropped the connection, @@ -934,7 +934,7 @@ void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) if( ! applicationList_->hasDirectConnection() ) { // Ignore the packet - kWarning() << "Received direct connection handshake at the switchboard " + kmWarning() << "Received direct connection handshake at the switchboard " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -954,7 +954,7 @@ void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) if( nonce != nonce_ ) { // Invalid nonce! Drop connection - kWarning() << "Contact sent invalid nonce " + kmWarning() << "Contact sent invalid nonce " "(received=" << nonce << " expected=" << nonce_ << " contact=" << getContactHandle() << @@ -963,7 +963,7 @@ void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) " action=closeconnection)."; #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Closing connection, moving transfer to switchboard."; + kmDebug() << "Closing connection, moving transfer to switchboard."; #endif // Like the official client, close the connection without any notice. @@ -974,7 +974,7 @@ void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) { // If we're the server, we still need to send a handshake back #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Contact sent correct nonce, " + kmDebug() << "Contact sent correct nonce, " "sending direct connection handshake ACK."; #endif #ifdef KMESSTEST @@ -988,7 +988,7 @@ void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) { // KMess is the client, it should verify the handshake response only. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Contact sent correct nonce, " + kmDebug() << "Contact sent correct nonce, " "marking connection as authorized."; #endif @@ -1000,7 +1000,7 @@ void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) // This happened once with WLM8 after the data transfer because KMess didn't send the handshake. if( isWaitingState( P2P_WAIT_FOR_HANDSHAKE ) ) { - kWarning() << "received nonce from contact first, " + kmWarning() << "received nonce from contact first, " "but it's running the server" "(contact=" << getContactHandle() << " session=" << sessionID_ << @@ -1015,7 +1015,7 @@ void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) // See if the transfer was already started. if( isTransferComplete() ) { - kWarning() << "connection is authorized " + kmWarning() << "connection is authorized " "but data transfer is already complete" "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << @@ -1026,7 +1026,7 @@ void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "marking connection as authorized, transfer should start."; + kmDebug() << "marking connection as authorized, transfer should start."; #endif // Note this could be a reverse invitation. @@ -1053,7 +1053,7 @@ void P2PApplication::gotDirectConnectionHandshake(const P2PMessage &message) void P2PApplication::gotDataPreparation(const P2PMessage &/*message*/) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got the data preparation message"; + kmDebug() << "Got the data preparation message"; #endif #ifdef KMESSTEST KMESS_ASSERT( ! isP2PAckSent() ); @@ -1075,7 +1075,7 @@ void P2PApplication::gotDataPreparation(const P2PMessage &/*message*/) // if sendDataPreparation() was not called, determine now what to send: if( userShouldAcknowledge_ ) { - kDebug() << "Handling of data preparation failed " + kmDebug() << "Handling of data preparation failed " "(contact=" << getContactHandle() << " action=send0x08)"; // Derived class still didn't acknowledge or cancel at all @@ -1105,7 +1105,7 @@ void P2PApplication::gotDataPreparation(const P2PMessage &/*message*/) // User did acknowledge, we can send the *actual* preparation ACK now. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Data preparation successful, sending ACK"; + kmDebug() << "Data preparation successful, sending ACK"; #endif sendP2PAck(); @@ -1113,7 +1113,7 @@ void P2PApplication::gotDataPreparation(const P2PMessage &/*message*/) // Now wait for the data to arrive #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for file data to arrive..."; + kmDebug() << "Waiting for file data to arrive..."; #endif setWaitingState( P2P_WAIT_FOR_FILE_DATA, P2PAPPLICATION_TIMEOUT_DATA ); @@ -1181,7 +1181,7 @@ void P2PApplication::gotNegotiationMessage(const MimeMessage &slpMessage, const { // In the future, the string might be replaced with // something to support MSN to AOL chats, etc.. - kWarning() << "P2P message can't be handled, " + kmWarning() << "P2P message can't be handled, " "addressed to someone else " "(to=" << msgTo << " contact=" << getContactHandle() << @@ -1198,7 +1198,7 @@ void P2PApplication::gotNegotiationMessage(const MimeMessage &slpMessage, const } #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an SLP message, preamble=" << preamble << "."; + kmDebug() << "Got an SLP message, preamble=" << preamble << "."; #endif @@ -1227,7 +1227,7 @@ void P2PApplication::gotNegotiationMessage(const MimeMessage &slpMessage, const else { // Unknown SLP message - kWarning() << "P2P message can't be handled, " + kmWarning() << "P2P message can't be handled, " "unsuppored SLP negotiation message " "(preamble=" << preamble << " contact=" << getContactHandle() << @@ -1299,7 +1299,7 @@ Capabilities-Flags: 1 void P2PApplication::gotSlpAck(const MimeMessage &slpMessage ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got SLP ACK message, usage is unknown. Message dump follows.\n" + kmDebug() << "Got SLP ACK message, usage is unknown. Message dump follows.\n" << slpMessage.getFields() << "\n" << slpMessage.getBody(); #else @@ -1316,7 +1316,7 @@ void P2PApplication::gotSlpAck(const MimeMessage &slpMessage ) if( emptySession ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Directly terminating temporary P2PApplication instance for SLP ACK message."; + kmDebug() << "Directly terminating temporary P2PApplication instance for SLP ACK message."; #endif endApplication(); } @@ -1373,7 +1373,7 @@ void P2PApplication::gotSlpBye( const MimeMessage &slpMessage ) bool isComplete = isTransferComplete(); // TODO: this only works for incoming data. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got SLP BYE message, closing application " + kmDebug() << "Got SLP BYE message, closing application " "(state=" << (int) getWaitingState() << ")."; #endif @@ -1396,7 +1396,7 @@ void P2PApplication::gotSlpBye( const MimeMessage &slpMessage ) // - WLM sends BYE if( isComplete ) { - kWarning() << "Transfer seems complete but state suggests otherwise " + kmWarning() << "Transfer seems complete but state suggests otherwise " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -1408,7 +1408,7 @@ void P2PApplication::gotSlpBye( const MimeMessage &slpMessage ) { // When WLM aborts at a very late stage, it actually processes our final data messages, // ack's those, handle our BYE, and send it's "aborting BYE" afterwards. - kWarning() << "Received BYE to abort when all data is already transferred " + kmWarning() << "Received BYE to abort when all data is already transferred " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -1420,7 +1420,7 @@ void P2PApplication::gotSlpBye( const MimeMessage &slpMessage ) } #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "BYE message was unexpected; contact aborted " + kmDebug() << "BYE message was unexpected; contact aborted " << "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << ")"; #endif @@ -1455,7 +1455,7 @@ void P2PApplication::gotSlpBye( const MimeMessage &slpMessage ) void P2PApplication::gotSlpInvite(const MimeMessage &slpMessage) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got SLP INVITE message"; + kmDebug() << "Got SLP INVITE message"; #endif #ifdef KMESSTEST KMESS_ASSERT( isWaitingState( P2P_WAIT_DEFAULT ) // First invitation @@ -1537,7 +1537,7 @@ void P2PApplication::gotSlpInvite(const MimeMessage &slpMessage) sendP2PAck(); // Client sent an unknown invitation type - kWarning() << "Received unexpected Content-Type " + kmWarning() << "Received unexpected Content-Type " "(type=" << invitationContentType_ << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -1627,7 +1627,7 @@ void P2PApplication::gotSlpOk(const MimeMessage &slpMessage) sendP2PAck(); // Unsupported response type. - kWarning() << "Received unexpected 200/OK message " + kmWarning() << "Received unexpected 200/OK message " "(type=" << contentType << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -1649,7 +1649,7 @@ void P2PApplication::gotSlpOk(const MimeMessage &slpMessage) { // Waiting for prepare message #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for contact to send some prepare message..."; + kmDebug() << "Waiting for contact to send some prepare message..."; #endif setWaitingState( P2P_WAIT_FOR_PREPARE, P2PAPPLICATION_TIMEOUT_ACK ); @@ -1690,7 +1690,7 @@ void P2PApplication::gotSlpSessionInvitation( const MimeMessage &slpMimeBody ) // Don't accept invites if we sent one. if( ! isFirstMessageSent() && isUserStartedApp() ) { - kWarning() << "Got an INVITE response for " + kmWarning() << "Got an INVITE response for " "user-started application, rejecting " "(contact=" << getContactHandle() << " session=" << sessionID_ << @@ -1734,7 +1734,7 @@ void P2PApplication::gotSlpStatus(const MimeMessage &slpMessage, const QString & { // An Error message, or "MSNSLP/1.0 200 OK" message #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got SLP status message (" << preamble << ")"; + kmDebug() << "Got SLP status message (" << preamble << ")"; #endif // See if this object was initialized to handle a Bad packet. @@ -1749,7 +1749,7 @@ void P2PApplication::gotSlpStatus(const MimeMessage &slpMessage, const QString & // Should only be received if we started it. if(! isUserStartedApp()) { - kWarning() << "P2P message can't be handled, " + kmWarning() << "P2P message can't be handled, " "unexpected SLP response containing status code " "(preamble=" << preamble << " contact=" << getContactHandle() << @@ -1802,7 +1802,7 @@ void P2PApplication::gotSlpStatus(const MimeMessage &slpMessage, const QString & sendP2PAck(); // Inform the user KMess has an error - kWarning() << "KMess sent a bad address in the 'to:' header " + kmWarning() << "KMess sent a bad address in the 'to:' header " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -1820,7 +1820,7 @@ void P2PApplication::gotSlpStatus(const MimeMessage &slpMessage, const QString & // Content-Type of this message is "application/x-msnmsgr-session-failure-respbody" // Inform the user KMess has an error - kWarning() << "KMess sent an invalid Call-ID " + kmWarning() << "KMess sent an invalid Call-ID " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -1839,7 +1839,7 @@ void P2PApplication::gotSlpStatus(const MimeMessage &slpMessage, const QString & if( slpMessage.getValue("Content-Type") == "null" ) { // The Content-Type was not supported - kWarning() << "Content-Type of our invitation was not understood " + kmWarning() << "Content-Type of our invitation was not understood " "(type=" << invitationContentType_ << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -1849,7 +1849,7 @@ void P2PApplication::gotSlpStatus(const MimeMessage &slpMessage, const QString & else { // Bad header sent in SLP fields, or invitation type was not supported - kWarning() << "Our invitation was not supported " + kmWarning() << "Our invitation was not supported " "or the contact client had an internal error " "(contact=" << getContactHandle() << " session=" << sessionID_ << @@ -1872,7 +1872,7 @@ void P2PApplication::gotSlpStatus(const MimeMessage &slpMessage, const QString & // Last option: tell the contact it sent an unknown message default: - kWarning() << "P2P message can't be handled, " + kmWarning() << "P2P message can't be handled, " "unsupported SLP response " "(preamble=" << preamble << " contact=" << getContactHandle() << @@ -1949,7 +1949,7 @@ Capabilities-Flags: 1 void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Invite message is a request to transfer the session."; + kmDebug() << "Invite message is a request to transfer the session."; #endif // For some reason it's also possible to receive SLP transfer invitations from WLM8 @@ -1957,7 +1957,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) // Perhaps some packet is stalled in the outgoing message channel? if( sessionID_ == 0 || getMode() == APP_MODE_ERROR_HANDLER ) { - kWarning() << "Received an invitation for a direct connection," + kmWarning() << "Received an invitation for a direct connection," " but no session is set up " "(maybe an old session, " " contact=" << getContactHandle() << @@ -1975,7 +1975,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) // the the contact, even for the same session ID. if( applicationList_->hasPendingConnections() ) { - kWarning() << "Received an invitation for a direct connection," + kmWarning() << "Received an invitation for a direct connection," " while a connection attempt is already in progress " "(contact=" << getContactHandle() << " session=" << sessionID_ << @@ -1990,7 +1990,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) // See if the connection already exists if( applicationList_->hasDirectConnection() ) { - kWarning() << "Received an invitation " + kmWarning() << "Received an invitation " "to start a direct connection, but a direct connection is already available " "(authorized=" << applicationList_->hasAuthorizedDirectConnection() << " contact=" << getContactHandle() << @@ -2014,7 +2014,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) // Not sure it can always be reproduced this way though. if( isWaitingState( P2P_WAIT_FOR_SLP_BYE ) ) { - kWarning() << "Received an invitation for " + kmWarning() << "Received an invitation for " "a direct connection, but expecting BYE instead " "(file transfer just completed, " " contact=" << getContactHandle() << @@ -2036,7 +2036,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) // - the ability to detect if a SLP error was sent for the transfer INVITE only. // - fixes for new issues with the state tracking. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Received a reverse invitation to for a direct connection, we started the session."; + kmDebug() << "Received a reverse invitation to for a direct connection, we started the session."; #endif } @@ -2080,7 +2080,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) nonce_ = KMessShared::generateGUID(); // used for authentication #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Generating Nonce value " + kmDebug() << "Generating Nonce value " << nonce_ << " for incoming connections."; #endif @@ -2113,7 +2113,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) else if( isReverseInvite ) { // Could not listen at a local port, send reject instead. - kWarning() << "Could not listen at local port, " + kmWarning() << "Could not listen at local port, " "redirecting transfer to the switchboard " "(contact=" << getContactHandle() << " session=" << sessionID_ << @@ -2128,7 +2128,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) else { // Could not listen at a local port, use switchboard instead. - kWarning() << "Could not listen at local port, " + kmWarning() << "Could not listen at local port, " "redirecting transfer to the switchboard " "(contact=" << getContactHandle() << " session=" << sessionID_ << @@ -2148,7 +2148,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) } #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Sending 200 transfer OK message, " + kmDebug() << "Sending 200 transfer OK message, " "listening=" << (listeningPort != 0) << "."; #endif @@ -2159,7 +2159,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) if( startListening ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for a connection to succeed or fail..."; + kmDebug() << "Waiting for a connection to succeed or fail..."; #endif setWaitingState( P2P_WAIT_FOR_CONNECTION, P2PAPPLICATION_TIMEOUT_DATA ); @@ -2169,7 +2169,7 @@ void P2PApplication::gotSlpTransferInvitation(const MimeMessage &slpMimeBody) // Expecting file data now we've rejected the invite. // TODO: it's also possible another invite is sent, hoping for a second chance. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for contact to send file data..."; + kmDebug() << "Waiting for contact to send file data..."; #endif setWaitingState( P2P_WAIT_FOR_FILE_DATA, P2PAPPLICATION_TIMEOUT_DATA ); @@ -2247,11 +2247,11 @@ void P2PApplication::gotSlpTransferResponse(const MimeMessage &slpMimeBody, bool #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL if( ! secondInvite ) { - kDebug() << "Parsing 200 OK message."; + kmDebug() << "Parsing 200 OK message."; } else { - kDebug() << "Parsing 2nd transfer INVITE message, " + kmDebug() << "Parsing 2nd transfer INVITE message, " << "contact offers to become the direct connection server."; } #endif @@ -2265,7 +2265,7 @@ void P2PApplication::gotSlpTransferResponse(const MimeMessage &slpMimeBody, bool if( applicationList_->hasAuthorizedDirectConnection() ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Connection already authorized " + kmDebug() << "Connection already authorized " << "before invitation response was received, starting transfer."; #endif initiateTransfer(); @@ -2273,7 +2273,7 @@ void P2PApplication::gotSlpTransferResponse(const MimeMessage &slpMimeBody, bool else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Connection already established " + kmDebug() << "Connection already established " << "before invitation response was received, waiting for connection to authorize..."; #endif // Slots already connected at this point. @@ -2310,7 +2310,7 @@ void P2PApplication::gotSlpTransferResponse(const MimeMessage &slpMimeBody, bool nonce_ = slpMimeBody.getValue("Nonce"); #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "P2PApplication:gotSlpTransferResponse() - Storing contact nonce value " + kmDebug() << "P2PApplication:gotSlpTransferResponse() - Storing contact nonce value " << nonce_ << " to authenticate later."; #endif @@ -2327,7 +2327,7 @@ void P2PApplication::gotSlpTransferResponse(const MimeMessage &slpMimeBody, bool if( listening && (listenExternal || listenInternal) ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Contact is listening, " + kmDebug() << "Contact is listening, " << "attempting to connect to the given IP-address."; #endif @@ -2413,7 +2413,7 @@ void P2PApplication::gotSlpTransferResponse(const MimeMessage &slpMimeBody, bool if( applicationList_->hasPendingConnections() ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for connection attempt to succeed..."; + kmDebug() << "Waiting for connection attempt to succeed..."; #endif // Wait for connection to establish @@ -2423,7 +2423,7 @@ void P2PApplication::gotSlpTransferResponse(const MimeMessage &slpMimeBody, bool { // Nothing is pending, nothing is connected. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "No connection possible, " + kmDebug() << "No connection possible, " << "informing ApplicationList."; #endif @@ -2449,7 +2449,7 @@ bool P2PApplication::gotUnhandledAck( const P2PMessage &message, P2PMessageType Q_UNUSED( ackedMessageType ); #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Not handling the unknown ack"; + kmDebug() << "Not handling the unknown ack"; #endif // Derived class can implement some handling. @@ -2467,7 +2467,7 @@ bool P2PApplication::gotUnhandledAck( const P2PMessage &message, P2PMessageType void P2PApplication::initiateTransfer() { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Signalling implementation class " + kmDebug() << "Signalling implementation class " << "to start the file transfer."; #endif @@ -2483,7 +2483,7 @@ void P2PApplication::initiateTransfer() // Avoid this by disabling it now, before we kill our own transfer. if( stopWaitingTimer() ) { - kWarning() << "timeout detection timer was still running, stopped " + kmWarning() << "timeout detection timer was still running, stopped " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -2553,7 +2553,7 @@ void P2PApplication::initiateTransfer() void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReason) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "request to abort " + kmDebug() << "request to abort " << "(reason=" << cancelReason << ", state=" << (int) getWaitingState() << ")."; #endif @@ -2570,7 +2570,7 @@ void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReaso userShouldAcknowledge_ = false; // TODO: send bye here to? wait for bye? just terminate? - kWarning() << "data-preparation stage failed " + kmWarning() << "data-preparation stage failed " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -2598,7 +2598,7 @@ void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReaso // ...or timeout waiting for contact to accept. case CANCEL_TIMEOUT: // Timeout handling occurs via slotCleanup(), not here. - kWarning() << "CANCEL_TIMEOUT is not supported here " + kmWarning() << "CANCEL_TIMEOUT is not supported here " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -2620,7 +2620,7 @@ void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReaso } else { - kWarning() << "CANCEL_NOT_INSTALLED is not supported here " + kmWarning() << "CANCEL_NOT_INSTALLED is not supported here " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -2643,7 +2643,7 @@ void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReaso if( isWaitingState( P2P_WAIT_USER_ACCEPT ) && cancelReason == CANCEL_ABORT ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Cancelling after receiving an SLP INVITE, " + kmDebug() << "Cancelling after receiving an SLP INVITE, " << "sending BYE back."; #endif #ifdef KMESSTEST @@ -2655,7 +2655,7 @@ void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReaso else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Aborting after receiving an SLP message, " + kmDebug() << "Aborting after receiving an SLP message, " << "sending 500 Internal Error back."; #endif // Cancelled while in SLP negotiate mode. @@ -2668,7 +2668,7 @@ void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReaso { // B: User started application #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "P2PApplication::sendCancelMessage() Cancelling an application " + kmDebug() << "P2PApplication::sendCancelMessage() Cancelling an application " << "we've started ourselves, sending BYE early."; #endif // Mark the logs if there is something weird going on. @@ -2677,7 +2677,7 @@ void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReaso // This happens sometimes when KMess sent a file before which was aborted by WLM. if( hasUnAckedMessage( P2P_MSG_SESSION_INVITATION ) ) { - kWarning() << "aborting while INVITE ack was not received " + kmWarning() << "aborting while INVITE ack was not received " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -2692,7 +2692,7 @@ void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReaso { // C: Contact started application #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "P2PApplication::sendCancelMessage() Cancelling an application " + kmDebug() << "P2PApplication::sendCancelMessage() Cancelling an application " << "started by the other contact, sending BYE early."; #endif // Send bye early, contact should detect this. @@ -2717,7 +2717,7 @@ void P2PApplication::sendCancelMessage(const ApplicationCancelReason cancelReaso // Last option, unknown cancel message default: - kWarning() << "unknown cancelReason used " + kmWarning() << "unknown cancelReason used " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -2749,7 +2749,7 @@ void P2PApplication::sendDataPreparationAck() } else { - kWarning() << "Call not expected here! " + kmWarning() << "Call not expected here! " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -2774,7 +2774,7 @@ void P2PApplication::sendDataPreparationAck() void P2PApplication::sendSlpBye() { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Sending SLP BYE message."; + kmDebug() << "Sending SLP BYE message."; #endif #ifdef KMESSTEST KMESS_ASSERT( sessionID_ != 0 ); @@ -2810,7 +2810,7 @@ void P2PApplication::sendSlpBye() setClosing(true); #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for BYE ACK..."; + kmDebug() << "Waiting for BYE ACK..."; #endif // Don't run endApplication() yet, there is one ACK we wait for... @@ -2837,7 +2837,7 @@ void P2PApplication::sendSlpError( const QString &statusLine, const ulong sessionID, const QString &messageContentType, P2PMessageType messageType ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Sending SLP error response: " << statusLine; + kmDebug() << "Sending SLP error response: " << statusLine; #endif #ifdef KMESSTEST @@ -2857,7 +2857,7 @@ void P2PApplication::sendSlpError( const QString &statusLine, if( callID_.isEmpty() || branch_.isEmpty() ) { - kWarning() << "attempting to send SLP error back, " + kmWarning() << "attempting to send SLP error back, " "but Call-ID or Branch is unknown! " "(contact=" << getContactHandle() << " session=" << sessionID_ << @@ -2915,7 +2915,7 @@ void P2PApplication::sendSlpError( const QString &statusLine, setClosing(true); #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for SLP ACK..."; + kmDebug() << "Waiting for SLP ACK..."; #endif // Wait for the message to be ACK-ed. @@ -2946,7 +2946,7 @@ void P2PApplication::sendSlpInvitation(const MimeMessage &message, const QString #endif #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Sending INVITE message"; + kmDebug() << "Sending INVITE message"; #endif // Mime message conversion @@ -2989,7 +2989,7 @@ void P2PApplication::sendSlpInvitation(const MimeMessage &message, const QString invitationContentType_ = contentType; #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for contact to send INVITE ACK, and accept later..."; + kmDebug() << "Waiting for contact to send INVITE ACK, and accept later..."; #endif // Wait for the contact to accept @@ -3017,7 +3017,7 @@ void P2PApplication::sendSlpInvitation(const MimeMessage &message, const QString void P2PApplication::sendSlpOkMessage(const MimeMessage &message) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Sending MSNSLP/1.0 200 OK message."; + kmDebug() << "Sending MSNSLP/1.0 200 OK message."; #endif #ifdef KMESSTEST KMESS_ASSERT(! branch_.isEmpty() ); @@ -3067,7 +3067,7 @@ void P2PApplication::sendSlpOkMessage(const MimeMessage &message) if(gotTransferInvitation) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for contact to ACK the 200 transfer OK message..."; + kmDebug() << "Waiting for contact to ACK the 200 transfer OK message..."; #endif // Wait until our transfer OK message is ACK-ed @@ -3076,7 +3076,7 @@ void P2PApplication::sendSlpOkMessage(const MimeMessage &message) else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for contact to ACK the 200 OK message..."; + kmDebug() << "Waiting for contact to ACK the 200 OK message..."; #endif // Wait until our normal OK message is ACK-ed @@ -3144,7 +3144,7 @@ void P2PApplication::sendSlpTransferInvitation() if( applicationList_->hasAuthorizedDirectConnection() ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Connection is already setup, " + kmDebug() << "Connection is already setup, " << "re-using the current connection."; #endif initiateTransfer(); @@ -3161,7 +3161,7 @@ void P2PApplication::sendSlpTransferInvitation() if( applicationList_->hasPendingConnections() || applicationList_->hasPendingConnectionInvitation() ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Another application is already inviting " + kmDebug() << "Another application is already inviting " << "for a direct connection, waiting for that attempt to succeed or fail..."; #endif @@ -3252,7 +3252,7 @@ void P2PApplication::slotConnectionAuthorized() if( wasReverseInvite ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Direct connection authorized, " + kmDebug() << "Direct connection authorized, " "reverse invitation complete (state=" << (int) getWaitingState() << ")."; #endif @@ -3263,7 +3263,7 @@ void P2PApplication::slotConnectionAuthorized() { // Waiting for prepare message #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for contact to send some prepare message..."; + kmDebug() << "Waiting for contact to send some prepare message..."; #endif setWaitingState( P2P_WAIT_FOR_PREPARE, P2PAPPLICATION_TIMEOUT_ACK ); @@ -3275,14 +3275,14 @@ void P2PApplication::slotConnectionAuthorized() else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Direct connection authorized, " + kmDebug() << "Direct connection authorized, " "starting transfer (state=" << (int) getWaitingState() << ")."; #endif // Protect against situations which could break our internal state. if( isTransferActive() ) { - kWarning() << "Direct connection authorized, " + kmWarning() << "Direct connection authorized, " "but data transfer was already started before. Won't notify derived classes " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << @@ -3310,7 +3310,7 @@ void P2PApplication::slotConnectionAuthorized() void P2PApplication::slotConnectionEstablished() { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Direct connection established."; + kmDebug() << "Direct connection established."; #endif // Disconnect irrelevant signals. @@ -3329,7 +3329,7 @@ void P2PApplication::slotConnectionEstablished() sendDirectConnectionHandshake( nonce_ ); #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for direct connection handshake response..."; + kmDebug() << "Waiting for direct connection handshake response..."; #endif // Start the timeout timer again. @@ -3338,7 +3338,7 @@ void P2PApplication::slotConnectionEstablished() else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for contact to send connection handshake..."; + kmDebug() << "Waiting for contact to send connection handshake..."; #endif // Wait for the handshake @@ -3356,7 +3356,7 @@ void P2PApplication::slotConnectionEstablished() void P2PApplication::slotConnectionFailed() { // Make this a warning, so users can figure out stuff when running kmess from the console. - kWarning() << "A direct connection could not be made, " + kmWarning() << "A direct connection could not be made, " "switching file transfer to slow indirect transfer " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << @@ -3404,7 +3404,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) { case P2P_WAIT_FOR_INVITE_ACK: { - kWarning() << "Timeout waiting SLP INVITE ack message " + kmWarning() << "Timeout waiting SLP INVITE ack message " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3415,7 +3415,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_CONTACT_ACCEPT: { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Contact didn't accept the invitation, terminating manually."; + kmDebug() << "Contact didn't accept the invitation, terminating manually."; #endif // NOTE: WLM8 has no timeout abort P2P (file transfer) invitations. @@ -3437,7 +3437,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_CONNECTION2: { // Still keep waiting, DirectConnectionBase should trigger a timeout. - kWarning() << "Time-out waiting to connect to the remote system " + kmWarning() << "Time-out waiting to connect to the remote system " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3447,7 +3447,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_SLP_OK_ACK: { - kWarning() << "Timeout waiting for SLP OK ACK " + kmWarning() << "Timeout waiting for SLP OK ACK " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3457,7 +3457,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_PREPARE: { - kWarning() << "Timeout waiting for data-preparation message " + kmWarning() << "Timeout waiting for data-preparation message " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3467,7 +3467,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_PREPARE_ACK: { - kWarning() << "Timeout waiting for data-preparation ACK " + kmWarning() << "Timeout waiting for data-preparation ACK " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3477,7 +3477,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_TRANSFER_ACK: { - kWarning() << "Timeout waiting for SLP transfer OK ACK " + kmWarning() << "Timeout waiting for SLP transfer OK ACK " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3487,7 +3487,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_FILE_DATA: { - kWarning() << "Timeout waiting for file data " + kmWarning() << "Timeout waiting for file data " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3503,7 +3503,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_DATA_ACK: { - kWarning() << "Timeout waiting for file data received ack " + kmWarning() << "Timeout waiting for file data received ack " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3514,7 +3514,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_HANDSHAKE: { // NOTE: we could start an initiateTransfer() here, but this is clearly a client bug. - kWarning() << "Timeout waiting for DC handshake " + kmWarning() << "Timeout waiting for DC handshake " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3525,7 +3525,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_HANDSHAKE_OK: { // NOTE: we could start an initiateTransfer() here, but this is clearly a client bug. - kWarning() << "Timeout waiting for DC handshake response " + kmWarning() << "Timeout waiting for DC handshake response " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3535,7 +3535,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_SLP_BYE: { - kWarning() << "Timeout waiting for BYE message " + kmWarning() << "Timeout waiting for BYE message " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3547,7 +3547,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_SLP_BYE_ACK: { - kWarning() << "Timeout waiting for BYE-ACK " + kmWarning() << "Timeout waiting for BYE-ACK " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3559,7 +3559,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) case P2P_WAIT_FOR_SLP_ERR_ACK: { - kWarning() << "Timeout waiting for SLP Error-ACK " + kmWarning() << "Timeout waiting for SLP Error-ACK " "(contact=" << getContactHandle() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3571,7 +3571,7 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) default: { - kWarning() << "Timeout waiting " + kmWarning() << "Timeout waiting " "(state=" << (int) getWaitingState() << " session=" << sessionID_ << " class=" << metaObject()->className() << @@ -3596,13 +3596,13 @@ void P2PApplication::showTimeoutMessage( P2PWaitingState waitingState ) void P2PApplication::userAborted() { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "user requests to abort the session. state=" << (int) getWaitingState(); + kmDebug() << "user requests to abort the session. state=" << (int) getWaitingState(); #endif // Make sure a second message is not displayed here. if( isClosing() ) { - kWarning() << "Attempted to close application twice " + kmWarning() << "Attempted to close application twice " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -3617,7 +3617,7 @@ void P2PApplication::userAborted() { // This is a problem when a client does not send a SLP BYE (as seen with amsn 0.97). #ifdef KMESSDEBUG_APPLICATION - kDebug() << "Ignoring request while waiting for SLP BYE."; + kmDebug() << "Ignoring request while waiting for SLP BYE."; #endif return; @@ -3632,7 +3632,7 @@ void P2PApplication::userAborted() // The old switchboard is removed, and all applications abort. // TODO: The switchboard closeConnection() call assumes it's always user initiated. - kWarning() << "not displaying message because data transfer is complete. " + kmWarning() << "not displaying message because data transfer is complete. " "The switchboard was likely closed after receiving all data. " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << @@ -3671,7 +3671,7 @@ void P2PApplication::userRejected() if( isClosing() ) { #ifdef KMESSDEBUG_APPLICATION - kWarning() << "Attempted to close application twice " + kmWarning() << "Attempted to close application twice " "(state=" << (int) getWaitingState() << " contact=" << getContactHandle() << " session=" << sessionID_ << @@ -3686,7 +3686,7 @@ void P2PApplication::userRejected() else { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "user requests to reject the invitation."; + kmDebug() << "user requests to reject the invitation."; #endif // Send abort messages diff --git a/src/network/applications/p2papplicationbase.cpp b/src/network/applications/p2papplicationbase.cpp index 6d7a59a..76d7ddb 100644 --- a/src/network/applications/p2papplicationbase.cpp +++ b/src/network/applications/p2papplicationbase.cpp @@ -108,7 +108,7 @@ P2PApplicationBase::~P2PApplicationBase() { #ifdef KMESSDEBUG_APPLICATION // Can't include getSessionID() here, is virtual method of destructed derived class. - kDebug() << " closing=" << isClosing() << + kmDebug() << " closing=" << isClosing() << " timer=" << waitingTimer_->isActive() << " state=" << waitingState_ << " unackedCount=" << outgoingMessages_.count() << "."; @@ -144,7 +144,7 @@ void P2PApplicationBase::abortDataSending() if( dataSource_ != 0 ) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "application was still sending data, resetting."; + kmDebug() << "application was still sending data, resetting."; #endif dataSource_ = 0; @@ -163,7 +163,7 @@ void P2PApplicationBase::abortDataSending() void P2PApplicationBase::endApplicationLater() { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "setting timeout to destroy object, allow contact to send a final message."; + kmDebug() << "setting timeout to destroy object, allow contact to send a final message."; #endif // If a transfer was active, make sure it ends. @@ -256,7 +256,7 @@ P2PApplicationBase::UnAckedMessage * P2PApplicationBase::getUnAckedMessage(const if( ackUniqueID == unAcked->ackSessionID ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "message is matched, option 1: " + kmDebug() << "message is matched, option 1: " "ackUniqueID = original uniqueID " << ackUniqueID << "."; #endif #ifdef KMESSTEST @@ -278,7 +278,7 @@ P2PApplicationBase::UnAckedMessage * P2PApplicationBase::getUnAckedMessage(const if( ackSessionID == unAcked->ackSessionID && ackUniqueID == 0 ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "message is matched, option 2: " + kmDebug() << "message is matched, option 2: " "ackSessionID = original uniqueID " << ackSessionID << "."; #endif #ifdef KMESSTEST @@ -309,7 +309,7 @@ P2PApplicationBase::UnAckedMessage * P2PApplicationBase::getUnAckedMessage(const && ( ackFlag == P2PMessage::MSN_FLAG_ABORTED_RECEIVING || ackUniqueID == 0 ) ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "message is matched, option 3: " + kmDebug() << "message is matched, option 3: " "ackMessageID = original messageID " << ackSessionID << "."; #endif #ifdef KMESSTEST @@ -374,7 +374,7 @@ P2PApplicationBase::P2PWaitingState P2PApplicationBase::getWaitingState() const void P2PApplicationBase::gotDataFragment(const P2PMessage &message) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Received file data, calling gotData()."; + kmDebug() << "Received file data, calling gotData()."; #endif #ifdef KMESSDEBUG KMESS_ASSERT( waitingState_ == P2P_WAIT_FOR_FILE_DATA ); @@ -386,7 +386,7 @@ void P2PApplicationBase::gotDataFragment(const P2PMessage &message) // Avoid bothering the derived class with these issues. if( waitingState_ == P2P_WAIT_FOR_SLP_BYE_ACK ) { - kWarning() << "Still receiving data while BYE is sent " + kmWarning() << "Still receiving data while BYE is sent " "(contact=" << getContactHandle() << " session=" << getSessionID() << " class=" << metaObject()->className() << @@ -399,7 +399,7 @@ void P2PApplicationBase::gotDataFragment(const P2PMessage &message) // This actually happened when there were some delayed packets in the buffer with WLM. // When switching bridges (SB/DC) it actually cannot guarantee the messages will be sent in order. // This is visible at slow computers. - kWarning() << "Still receiving data while last fragment was received " + kmWarning() << "Still receiving data while last fragment was received " "(contact=" << getContactHandle() << " session=" << getSessionID() << " class=" << metaObject()->className() << @@ -411,7 +411,7 @@ void P2PApplicationBase::gotDataFragment(const P2PMessage &message) { // This happend when the data preparation was rejected, // and the contact kept sending data. - kWarning() << "Still receiving data while the application wants to close " + kmWarning() << "Still receiving data while the application wants to close " "(contact=" << getContactHandle() << " session=" << getSessionID() << " class=" << metaObject()->className() << @@ -426,7 +426,7 @@ void P2PApplicationBase::gotDataFragment(const P2PMessage &message) if( dataOffset == 0 && ! applicationList_->hasDirectConnection() && ( applicationList_->hasPendingConnections() || applicationList_->hasPendingConnectionInvitation() ) ) { - kWarning() << "Contact is already sending data " + kmWarning() << "Contact is already sending data " "while attempting to establish a direct connection " "(state=" << waitingState_ << " contact=" << getContactHandle() << @@ -448,7 +448,7 @@ void P2PApplicationBase::gotDataFragment(const P2PMessage &message) { // Send negative ack message, like WLM does (0x01) // TODO: provide last failed position, allow contact to resume - kWarning() << "Received unexpected offset for message " + kmWarning() << "Received unexpected offset for message " "(offset=" << dataOffset << " messageID=" << message.getMessageID() << " contact=" << getContactHandle() << @@ -479,9 +479,9 @@ void P2PApplicationBase::gotDataFragment(const P2PMessage &message) if( message.isLastFragment() ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got the last fragment, " + kmDebug() << "Got the last fragment, " "but some messages are not received yet."; - kDebug() << "Current message is " << fragmentTracker_.getDebugMap(); + kmDebug() << "Current message is " << fragmentTracker_.getDebugMap(); #endif shouldSendAck_ = false; // could be true if received out of order. } @@ -489,7 +489,7 @@ void P2PApplicationBase::gotDataFragment(const P2PMessage &message) else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got the last fragment. Sending ack, calling gotDataComplete() and showTransferComplete()."; + kmDebug() << "Got the last fragment. Sending ack, calling gotDataComplete() and showTransferComplete()."; #endif // After all data is received, ACK it and send the BYE @@ -506,7 +506,7 @@ void P2PApplicationBase::gotDataFragment(const P2PMessage &message) if( getMode() == APP_MODE_DATACAST ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Application is a datacast handler, request termination immediately."; + kmDebug() << "Application is a datacast handler, request termination immediately."; #endif // FIXME we must decide if it's better implement in derived ink class the method // gotDataComplete called few lines above or keep showTransferComplete(). Also we check @@ -521,7 +521,7 @@ void P2PApplicationBase::gotDataFragment(const P2PMessage &message) // e.g. forget to call the parent P2PApplication::gotDataComplete() method to send the BYE. if( waitingState_ == P2P_WAIT_DEFAULT ) { - kWarning() << "The overwritten gotDataComplete() method did not send anything, nor changed the waiting state, " + kmWarning() << "The overwritten gotDataComplete() method did not send anything, nor changed the waiting state, " "(contact=" << getContactHandle() << " session=" << getSessionID() << " class=" << metaObject()->className() << @@ -572,7 +572,7 @@ void P2PApplicationBase::gotErrorAck(const P2PMessage &message) if( isClosing() ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an P2P error-response while closing " + kmDebug() << "Got an P2P error-response while closing " "(flag=0x" << QString::number( message.getFlags(), 16 ) << ", ignoring message)."; #endif @@ -585,7 +585,7 @@ void P2PApplicationBase::gotErrorAck(const P2PMessage &message) if( message.isNegativeAck() ) { // Received when the transfer failed, e.g. write errors at the direct connection. - kWarning() << "Got an unexpected P2P error-response " + kmWarning() << "Got an unexpected P2P error-response " "(flag=nak" << " byte=" << message.getDataSize() << " state=" << waitingState_ << @@ -598,7 +598,7 @@ void P2PApplicationBase::gotErrorAck(const P2PMessage &message) abortDataSending(); #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for contact to send a BYE message."; + kmDebug() << "Waiting for contact to send a BYE message."; #endif // Wait for BYE at the moment. @@ -607,7 +607,7 @@ void P2PApplicationBase::gotErrorAck(const P2PMessage &message) else { // Error in our headers? - kWarning() << "Got an unexpected P2P error-response " + kmWarning() << "Got an unexpected P2P error-response " "(flag=0x" << QString::number( message.getFlags(), 16 ) << " state=" << waitingState_ << " contact=" << getContactHandle() << @@ -656,17 +656,17 @@ void P2PApplicationBase::gotMessage(const P2PMessage &p2pMessage) if( getMode() == APP_MODE_DATACAST ) { // Special case, abuse of P2P system - kDebug() << "P2P message from " << getContactHandle() << " is handled by a datacast session."; + kmDebug() << "P2P message from " << getContactHandle() << " is handled by a datacast session."; } else if( nextMessageID_ == 0 ) { // No messages sent, new application - kDebug() << "P2P message from " << getContactHandle() << " is handled by a newly created session."; + kmDebug() << "P2P message from " << getContactHandle() << " is handled by a newly created session."; } else { // s/found/received/ since ApplicationList::gotMessage() finds it, but this makes it easier to filter the logs. - kDebug() << "New P2P message from " << getContactHandle() << " is handled by session " << getSessionID() << "."; + kmDebug() << "New P2P message from " << getContactHandle() << " is handled by session " << getSessionID() << "."; } #endif @@ -678,7 +678,7 @@ void P2PApplicationBase::gotMessage(const P2PMessage &p2pMessage) && ! p2pMessage.isAbortedReceivingAck() && ! p2pMessage.isAbortedSendingAck() ) { - kWarning() << "received another message while awaiting termination " + kmWarning() << "received another message while awaiting termination " "(flags=0x" << QString::number( p2pMessage.getFlags(), 16 ) << " size=" << p2pMessage.getDataSize() << " contact=" << getContactHandle() << @@ -722,7 +722,7 @@ void P2PApplicationBase::gotMessage(const P2PMessage &p2pMessage) { if( p2pMessage.isAck() ) // other messages can't relate have the control flags set. { - kWarning() << "Unable to handle ACK message, " + kmWarning() << "Unable to handle ACK message, " "original message not found " "(flags=0x" << QString::number(p2pMessage.getFlags(), 16) << " size=0 state=" << waitingState_ << @@ -741,7 +741,7 @@ void P2PApplicationBase::gotMessage(const P2PMessage &p2pMessage) outgoingMessages_.removeAll( unAcked ); #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Removed ack slot for message " + kmDebug() << "Removed ack slot for message " << "(sid=" << unAcked->sessionID << " mid=" << unAcked->messageID << " ackSid=" << unAcked->ackSessionID @@ -788,7 +788,7 @@ void P2PApplicationBase::gotMessage(const P2PMessage &p2pMessage) } else { - kWarning() << "Unable to handle ACK message, " + kmWarning() << "Unable to handle ACK message, " "unknown flag value encountered " "(flags=0x" << QString::number(p2pMessage.getFlags(), 16) << " size=0 state=" << waitingState_ << @@ -839,7 +839,7 @@ void P2PApplicationBase::gotMessage(const P2PMessage &p2pMessage) } else { - kWarning() << "P2PApplicationBase:gotMessage() - P2P message can't be handled, " + kmWarning() << "P2PApplicationBase:gotMessage() - P2P message can't be handled, " "unknown negotiation message type " "(flags=0x" << QString::number(p2pMessage.getFlags(), 16) << " size=" << p2pMessage.getDataSize() << @@ -873,7 +873,7 @@ void P2PApplicationBase::gotMessage(const P2PMessage &p2pMessage) && p2pMessage.getTotalSize() == 4 ) { // HACK: added for Encarta Instant Answers (has data flag set with preparation message). - kWarning() << "Expecting data-preparation message, " + kmWarning() << "Expecting data-preparation message, " "got message of 4 bytes with incorrect flags " "(assuming data preparation," " contact=" << getContactHandle() << @@ -894,7 +894,7 @@ void P2PApplicationBase::gotMessage(const P2PMessage &p2pMessage) && p2pMessage.isFragment()) { // HACK: added for Kopete 0.9.2 code (has no flag set with data messages). - kWarning() << "Expecting data message, " + kmWarning() << "Expecting data message, " "got fragmented message with no flags set " "(assuming file data," " contact=" << getContactHandle() << @@ -919,7 +919,7 @@ void P2PApplicationBase::gotMessage(const P2PMessage &p2pMessage) else { // Unknown p2p message - kWarning() << "P2P message can't be handled, " + kmWarning() << "P2P message can't be handled, " "unknown data message type " "(flags=0x" << QString::number(p2pMessage.getFlags(), 16) << " size=" << p2pMessage.getDataSize() << @@ -960,7 +960,7 @@ void P2PApplicationBase::gotNegotiationFragment(const P2PMessage &p2pMessage) { // Not everything received yet, buffer it. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got an SLP fragment, buffering it."; + kmDebug() << "Got an SLP fragment, buffering it."; #endif if(buffer_ == 0) @@ -980,7 +980,7 @@ void P2PApplicationBase::gotNegotiationFragment(const P2PMessage &p2pMessage) if(buffer_ != 0) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Got the last SLP fragment."; + kmDebug() << "Got the last SLP fragment."; #endif // Append the last MSNSLP fraqment and call the method. @@ -1032,7 +1032,7 @@ void P2PApplicationBase::gotTimeoutAck(const P2PMessage &message) else { // Apparently the contact was waiting for something, likely some packet we had to send. - kWarning() << "Got an unexpected P2P timeout-error response " + kmWarning() << "Got an unexpected P2P timeout-error response " "(flag=" << QString::number( message.getFlags(), 16 ) << " state=" << waitingState_ << " contact=" << getContactHandle() << @@ -1069,7 +1069,7 @@ void P2PApplicationBase::gotTransferAbortedAck(const P2PMessage &message) if( ! isClosing() ) { - kWarning() << "Got an unexpected P2P transfer aborted-response " + kmWarning() << "Got an unexpected P2P transfer aborted-response " "(flag=" << QString::number( message.getFlags(), 16 ) << " state=" << waitingState_ << " contact=" << getContactHandle() << @@ -1084,7 +1084,7 @@ void P2PApplicationBase::gotTransferAbortedAck(const P2PMessage &message) else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Message confirms abort, requesting terination."; + kmDebug() << "Message confirms abort, requesting terination."; #endif // Make sure the app will exist, but leave it half-open to receive the final 0x08 messages @@ -1190,7 +1190,7 @@ bool P2PApplicationBase::isWaitingState( P2PWaitingState waitingState ) const void P2PApplicationBase::sendData(QIODevice *dataSource, P2PDataType dataType) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Begin of data transfer"; + kmDebug() << "Begin of data transfer"; #endif #ifdef KMESSTEST KMESS_ASSERT( getSessionID() != 0 ); @@ -1201,7 +1201,7 @@ void P2PApplicationBase::sendData(QIODevice *dataSource, P2PDataType dataType) // Make sure we don't activate a slot without a data source. if(dataSource == 0) { - kWarning() << "Couldn't send data, data source is null " + kmWarning() << "Couldn't send data, data source is null " "(contact=" << getContactHandle() << " session=" << getSessionID() << " class=" << metaObject()->className() << @@ -1264,7 +1264,7 @@ void P2PApplicationBase::sendDataPreparation() // - at this point, the data preparation ACK triggers KMess to send the picture data. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for data preparation ACK..."; + kmDebug() << "Waiting for data preparation ACK..."; #endif // Wait until our preparation message is ACK-ed @@ -1283,7 +1283,7 @@ void P2PApplicationBase::sendDataPreparation() void P2PApplicationBase::sendDirectConnectionHandshake( const QString &nonce ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Sending direct connection handshake " + kmDebug() << "Sending direct connection handshake " << "(nonce=" << nonce << ")."; #endif #ifdef KMESSTEST @@ -1330,7 +1330,7 @@ void P2PApplicationBase::sendDirectConnectionHandshake( const QString &nonce ) hex += hexMap[upper]; hex += hexMap[lower]; } - kDebug() << "copied nonce '" << nonce << "' to p2p message header as '" << hex << "'."; + kmDebug() << "copied nonce '" << nonce << "' to p2p message header as '" << hex << "'."; #endif // Forcefully Send the message over the direct connection @@ -1360,7 +1360,7 @@ bool P2PApplicationBase::sendNextDataParts( int preferredFragments ) if( dataType_ == P2P_TYPE_NEGOTIATION || isClosing() || KMESS_NULL(dataSource_) ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "called while aborting " + kmDebug() << "called while aborting " "(datatype=" << dataType_ << " isclosing=" << isClosing() << " userAborted=" << userAborted_ << // sort-of reserved for aborts from ApplicationList. @@ -1384,7 +1384,7 @@ bool P2PApplicationBase::sendNextDataParts( int preferredFragments ) qint64 bytesRead = dataSource_->read( buffer, 1202 ); if( bytesRead < 0 ) { - kWarning() << "Couldn't send more data, " + kmWarning() << "Couldn't send more data, " "read error at " << fragmentOffset_ << " of " << fragmentTotalSize_ << " bytes " "(contact=" << getContactHandle() << " session=" << getSessionID() << @@ -1402,7 +1402,7 @@ bool P2PApplicationBase::sendNextDataParts( int preferredFragments ) QByteArray data = QByteArray::fromRawData( buffer, (int)bytesRead ); #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Sending data:" + kmDebug() << "Sending data:" << " offset=" << fragmentOffset_ << " buffer=" << bytesRead; #endif @@ -1422,7 +1422,7 @@ bool P2PApplicationBase::sendNextDataParts( int preferredFragments ) // Display error message for the first message only. if( fragmentOffset_ == 0 ) { - kWarning() << "Unknown data transfer mode " + kmWarning() << "Unknown data transfer mode " "(mode=" << dataType_ << " contact=" << getContactHandle() << " session=" << getSessionID() << @@ -1440,7 +1440,7 @@ bool P2PApplicationBase::sendNextDataParts( int preferredFragments ) if( ! writeSuccess ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "message could not be written entirely, leaving loop early."; + kmDebug() << "message could not be written entirely, leaving loop early."; #endif break; } @@ -1454,7 +1454,7 @@ bool P2PApplicationBase::sendNextDataParts( int preferredFragments ) // Be verbose if something internally goes wrong. if( dataSource_ != 0 && dataSource_->atEnd() && fragmentOffset_ < fragmentTotalSize_ ) { - kWarning() << "data source is at the end, " + kmWarning() << "data source is at the end, " "but offset byte count is not " "(fragmentoffset=" << fragmentOffset_ << " fragmenttotalsize=" << fragmentTotalSize_ << @@ -1480,7 +1480,7 @@ bool P2PApplicationBase::sendNextDataParts( int preferredFragments ) applicationList_->unregisterDataSendingApplication( this ); #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Waiting for all data received ACK..."; + kmDebug() << "Waiting for all data received ACK..."; #endif // Now wait for the contact to ACK that it received all data. @@ -1504,7 +1504,7 @@ void P2PApplicationBase::sendP2PAbort() #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL if( ! shouldSendAck_ ) { - kDebug() << "NOTICE: sending 0x08 control packet while the contact is not expecting an ack response."; + kmDebug() << "NOTICE: sending 0x08 control packet while the contact is not expecting an ack response."; } #endif @@ -1539,7 +1539,7 @@ bool P2PApplicationBase::sendP2PAck() if( ! shouldSendAck_ ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "NOTICE: not sending 0x02 ack packet, something is already sent (or nothing needs to be sent)."; + kmDebug() << "NOTICE: not sending 0x02 ack packet, something is already sent (or nothing needs to be sent)."; #endif return false; @@ -1568,36 +1568,36 @@ void P2PApplicationBase::sendP2PAckImpl(int ackType, UnAckedMessage *originalMes { if( nextMessageID_ == 0 && getMode() == APP_MODE_NORMAL ) { - kDebug() << "Sending P2P ACK (INVITE-ACK)"; + kmDebug() << "Sending P2P ACK (INVITE-ACK)"; } else { - kDebug() << "Sending P2P ACK"; + kmDebug() << "Sending P2P ACK"; } } else if(ackType == P2PMessage::MSN_FLAG_ERROR) { - kDebug() << "Sending P2P ACK (Error-response)"; + kmDebug() << "Sending P2P ACK (Error-response)"; } else if(ackType == P2PMessage::MSN_FLAG_WAITING) { - kDebug() << "Sending P2P ACK (Timeout-response)"; + kmDebug() << "Sending P2P ACK (Timeout-response)"; } else if(ackType == P2PMessage::MSN_FLAG_WAITING_FOR_ACK) { - kDebug() << "Sending P2P ACK (ACK-timeout-response)"; + kmDebug() << "Sending P2P ACK (ACK-timeout-response)"; } else if(ackType == P2PMessage::MSN_FLAG_ABORTED_SENDING) { - kDebug() << "Sending P2P ACK (Aborted-myself-ACK)"; + kmDebug() << "Sending P2P ACK (Aborted-myself-ACK)"; } else if(ackType == P2PMessage::MSN_FLAG_ABORTED_RECEIVING) { - kDebug() << "Sending P2P ACK (Aborted-you-ACK)"; + kmDebug() << "Sending P2P ACK (Aborted-you-ACK)"; } else { - kDebug() << "Sending P2P ACK (Unknown-type)"; + kmDebug() << "Sending P2P ACK (Unknown-type)"; } #endif #ifdef KMESSTEST @@ -1717,7 +1717,7 @@ void P2PApplicationBase::sendP2PAckImpl(int ackType, UnAckedMessage *originalMes shouldSendAck_ = false; #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "ACK Transmitted " + kmDebug() << "ACK Transmitted " << "(flags=0x" << QString::number(ackType, 16) << ")."; #endif } @@ -1831,7 +1831,7 @@ bool P2PApplicationBase::sendP2PMessageImpl(const QByteArray &messageData, int f && flagField != P2PMessage::MSN_FLAG_OBJECT_DATA && flagField != P2PMessage::MSN_FLAG_FILE_DATA ) { - kWarning() << "Attempting to send splitted ACK message " + kmWarning() << "Attempting to send splitted ACK message " "(flags=0x" << QString::number( flagField, 16 ) << " state=" << waitingState_ << " contact=" << getContactHandle() << @@ -1892,7 +1892,7 @@ bool P2PApplicationBase::sendP2PMessageImpl(const QByteArray &messageData, int f // This only happens when a direct connection transfer is congested. // The same message will be re-sent later. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Message sending was blocked, should try again later."; + kmDebug() << "Message sending was blocked, should try again later."; #endif return false; } @@ -1904,7 +1904,7 @@ bool P2PApplicationBase::sendP2PMessageImpl(const QByteArray &messageData, int f if( offsetField == 0 ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Storing message fields to track the ACK response."; + kmDebug() << "Storing message fields to track the ACK response."; #endif // First message, or single message, store new record for ACKs. QDateTime currentTime; @@ -1921,7 +1921,7 @@ bool P2PApplicationBase::sendP2PMessageImpl(const QByteArray &messageData, int f else { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Updating message fields to track the ACK response."; + kmDebug() << "Updating message fields to track the ACK response."; #endif // Follow-up part of a splitted/fragmented message. // Update the uniqueID aka ackSID field to handle new acks. @@ -1948,7 +1948,7 @@ bool P2PApplicationBase::sendP2PMessageImpl(const QByteArray &messageData, int f if(fragmentOffset_ >= fragmentTotalSize_) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "All message parts sent, resetting fragmentOffset_ and fragmentTotalSize_."; + kmDebug() << "All message parts sent, resetting fragmentOffset_ and fragmentTotalSize_."; #endif fragmentOffset_ = 0; @@ -1958,7 +1958,7 @@ bool P2PApplicationBase::sendP2PMessageImpl(const QByteArray &messageData, int f #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Message transmitted " + kmDebug() << "Message transmitted " << "(sid=" << getSessionID() << " mid=" << messageID << " ackSid=" << ackSessionID @@ -1999,7 +1999,7 @@ void P2PApplicationBase::sendP2PWaitingError() void P2PApplicationBase::sendSlpMessage(const QString &slpMessage, P2PMessageType messageType) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "SLP message=" << slpMessage; + kmDebug() << "SLP message=" << slpMessage; #endif // Get the raw utf8 encoded bytearray @@ -2025,7 +2025,7 @@ void P2PApplicationBase::setCurrentMessageType( P2PMessageType messageType ) // Only send an ACK is this is really needed. if( ! shouldSendAck_ ) { - kWarning() << "NOTICE: ack is likely sent already, setting setCurrentMessageType() has no use anymore."; + kmWarning() << "NOTICE: ack is likely sent already, setting setCurrentMessageType() has no use anymore."; } lastIncomingMessage_.messageType = messageType; @@ -2068,18 +2068,18 @@ void P2PApplicationBase::setWaitingState( P2PWaitingState waitingState, int time if( waitingState_ != waitingState ) { - kDebug() << "temporary switching waitingState of session" << sessionID << "from" << waitingState_ << "to" << waitingState; + kmDebug() << "temporary switching waitingState of session" << sessionID << "from" << waitingState_ << "to" << waitingState; } } else { if( waitingState_ != waitingState ) { - kDebug() << "switching waitingState of session" << sessionID << "from" << waitingState_ << "to" << waitingState; + kmDebug() << "switching waitingState of session" << sessionID << "from" << waitingState_ << "to" << waitingState; } else { - kDebug() << "resuming waitingState of session" << sessionID << "for" << waitingState_; + kmDebug() << "resuming waitingState of session" << sessionID << "for" << waitingState_; } } #endif @@ -2105,7 +2105,7 @@ void P2PApplicationBase::setWaitingState( P2PWaitingState waitingState, int time */ void P2PApplicationBase::slotApplicationListDeleted() { - kWarning() << "ApplicationList is deleted before the P2PApplication class! This should not happen!" + kmWarning() << "ApplicationList is deleted before the P2PApplication class! This should not happen!" "(maybe an old session, " " contact=" << getContactHandle() << " session=" << getSessionID() << @@ -2127,7 +2127,7 @@ void P2PApplicationBase::slotApplicationListDeleted() * When a timeout occurs before the contact sent something we expect, * this function terminates the application automatically. * - * Depending on the internal "waiting state", an error message will be outputted with kWarning(). + * Depending on the internal "waiting state", an error message will be outputted with kmWarning(). */ void P2PApplicationBase::slotCleanup() { @@ -2135,7 +2135,7 @@ void P2PApplicationBase::slotCleanup() if( waitingState_ == P2P_WAIT_END_APPLICATION ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "timer of endApplicationLater() fired, finally destroying object."; + kmDebug() << "timer of endApplicationLater() fired, finally destroying object."; #endif // Directly destroy ...finally. @@ -2146,7 +2146,7 @@ void P2PApplicationBase::slotCleanup() #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "timeout fired, cleaning up " + kmDebug() << "timeout fired, cleaning up " "(contact=" << getContactHandle() << " session=" << getSessionID() << " waitingState=" << waitingState_ << ")."; @@ -2164,7 +2164,7 @@ void P2PApplicationBase::slotCleanup() || waitingState_ == P2P_WAIT_FOR_SLP_BYE_ACK ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Not sending timeout message for current waiting state."; + kmDebug() << "Not sending timeout message for current waiting state."; #endif } else @@ -2176,7 +2176,7 @@ void P2PApplicationBase::slotCleanup() // - ApplicationList informs the MsnSwitchboardConnection it can remove itself. // - ChatMaster processes the putMsg() call, and attempts to deliver the message. #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Not sending error message because application is aborting."; + kmDebug() << "Not sending error message because application is aborting."; #endif testUnAckedMessages( false ); @@ -2244,7 +2244,7 @@ void P2PApplicationBase::testDataSendingAborted() if( unAckedDataMessage != 0 ) { #ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL - kDebug() << "Sent data was not acked, sending 0x40 to abort ack request."; + kmDebug() << "Sent data was not acked, sending 0x40 to abort ack request."; #endif // It's possible WLM also closed it's data stream at this point, @@ -2275,7 +2275,7 @@ void P2PApplicationBase::testUnAckedMessages( bool /*sendError*/ ) UnAckedMessage *unAcked = outgoingMessages_.at(0); // More simple debug statement for most used case. - kWarning() << "there is still " << unackedCount << " unacked message " + kmWarning() << "there is still " << unackedCount << " unacked message " "(type=" << unAcked->messageType << " ackSid=" << unAcked->ackSessionID << " totalsize=" << unAcked->totalSize << @@ -2286,7 +2286,7 @@ void P2PApplicationBase::testUnAckedMessages( bool /*sendError*/ ) } else { - kWarning() << "there are still " << unackedCount << " unacked messages " + kmWarning() << "there are still " << unackedCount << " unacked messages " "(state=" << waitingState_ << " contact=" << getContactHandle() << " class=" << metaObject()->className() << @@ -2294,7 +2294,7 @@ void P2PApplicationBase::testUnAckedMessages( bool /*sendError*/ ) foreach( UnAckedMessage *unAcked, outgoingMessages_ ) { - kWarning() << "Message " << unAcked->messageID << " is unacked " + kmWarning() << "Message " << unAcked->messageID << " is unacked " "(type=" << unAcked->messageType << " ackSid=" << unAcked->ackSessionID << " totalsize=" << unAcked->totalSize << ")."; @@ -2342,7 +2342,7 @@ bool P2PApplicationBase::writeP2PDataToFile( const P2PMessage &message, QIODevic if( offset != (ulong)file->pos() && ! file->seek( offset ) ) { #ifdef KMESSDEBUG_APPLICATION - kDebug() << "data is received out of order, updating file offset."; + kmDebug() << "data is received out of order, updating file offset."; #endif // File position was different and could not be changed.. @@ -2352,7 +2352,7 @@ bool P2PApplicationBase::writeP2PDataToFile( const P2PMessage &message, QIODevic if( offset > ( fileSize + 100000 ) ) // ~100 kB { // TODO: allow contacts to resume at the correct byte position. - kWarning() << "data offset is too far ahead of current end of file " + kmWarning() << "data offset is too far ahead of current end of file " "(filepos=" << file->pos() << " eofpos=" << file->size() << " offset=" << offset << @@ -2368,7 +2368,7 @@ bool P2PApplicationBase::writeP2PDataToFile( const P2PMessage &message, QIODevic { // seek( offset ) should only fail if the offset is beyond the end of the file. // If this is not the case, moving within the file failed so abort. - kWarning() << "file pointer could not be set to message offset " + kmWarning() << "file pointer could not be set to message offset " "(filepos=" << file->pos() << " eofpos=" << file->size() << " offset=" << offset << @@ -2409,7 +2409,7 @@ bool P2PApplicationBase::writeP2PDataToFile( const P2PMessage &message, QIODevic qint64 status = file->write( message.getData(), message.getDataSize() ); if( status == -1 ) { - kWarning() << "Failed to write the data to the file " + kmWarning() << "Failed to write the data to the file " "(contact=" << getContactHandle() << " session=" << getSessionID() << " class=" << metaObject()->className() << diff --git a/src/network/applications/p2papplicationbase.h b/src/network/applications/p2papplicationbase.h index b751b9c..10eae19 100644 --- a/src/network/applications/p2papplicationbase.h +++ b/src/network/applications/p2papplicationbase.h @@ -261,7 +261,7 @@ class P2PApplicationBase : public Application */ enum P2PWaitingState { - // It's recommended to keep these values, as they're also printed by kWarning() statements! + // It's recommended to keep these values, as they're also printed by kmWarning() statements! P2P_WAIT_DEFAULT = 0, ///< Not waiting at all. P2P_WAIT_FOR_SLP_OK_ACK = 1, ///< Waiting for remote client to ack the the SLP OK message. diff --git a/src/network/extra/directconnectionbase.cpp b/src/network/extra/directconnectionbase.cpp index 147b4c4..c1b1840 100644 --- a/src/network/extra/directconnectionbase.cpp +++ b/src/network/extra/directconnectionbase.cpp @@ -57,7 +57,7 @@ DirectConnectionBase::DirectConnectionBase( QObject *parent ) lowestServerPortLimit_ = (quint16)group.readEntry( "lowestTransferPort", 6891 ); highestServerPortLimit_ = (quint16)group.readEntry( "highestTransferPort", 6900 ); #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Using port interval" << lowestServerPortLimit_ << "-" << highestServerPortLimit_; + kmDebug() << "Using port interval" << lowestServerPortLimit_ << "-" << highestServerPortLimit_; #endif connectionTimer_.setSingleShot( true ); @@ -75,7 +75,7 @@ DirectConnectionBase::~DirectConnectionBase() } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "DESTROYED. [connectTo=" << connectingTo_ << " wasConnected=" << isConnected() << " wasServer=" << isServer_ << " wasAuthorized=" << authorized_ << "]"; + kmDebug() << "DESTROYED. [connectTo=" << connectingTo_ << " wasConnected=" << isConnected() << " wasServer=" << isServer_ << " wasAuthorized=" << authorized_ << "]"; #endif } @@ -85,7 +85,7 @@ DirectConnectionBase::~DirectConnectionBase() void DirectConnectionBase::closeConnection() { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "closing sockets"; + kmDebug() << "closing sockets"; #endif // Reset globals @@ -119,7 +119,7 @@ bool DirectConnectionBase::closeClientSocket() } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "destroying client socket."; + kmDebug() << "destroying client socket."; #endif #ifdef KMESS_NETWORK_WINDOW @@ -136,7 +136,7 @@ bool DirectConnectionBase::closeClientSocket() writeHandlerCount_ = 0; #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "destroyed client socket."; + kmDebug() << "destroyed client socket."; #endif return true; @@ -159,11 +159,11 @@ bool DirectConnectionBase::closeServerSocket() #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL if( socket_ == 0 ) { - kDebug() << "destroying server socket."; + kmDebug() << "destroying server socket."; } else { - kDebug() << "closing server socket. Object will not be destroyed yet because a socket is connected."; + kmDebug() << "closing server socket. Object will not be destroyed yet because a socket is connected."; } #endif @@ -265,7 +265,7 @@ quint16 DirectConnectionBase::getLocalServerPort() nextServerPort_++; #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Reserved port " << serverPort_ << " for server socket."; + kmDebug() << "Reserved port " << serverPort_ << " for server socket."; #endif } @@ -392,7 +392,7 @@ bool DirectConnectionBase::isWriteHandlerConnected() const bool DirectConnectionBase::openConnection( const QString &ipAddress, const quint16 port ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Connecting to " << ipAddress << " port " << port << "."; + kmDebug() << "Connecting to " << ipAddress << " port " << port << "."; #endif #ifdef KMESSTEST KMESS_ASSERT( socket_ == 0 ); @@ -435,7 +435,7 @@ bool DirectConnectionBase::openConnection( const QString &ipAddress, const quint bool DirectConnectionBase::openServerPort() { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Creating server socket."; + kmDebug() << "Creating server socket."; #endif #ifdef KMESSTEST KMESS_ASSERT( server_ == 0 ); @@ -465,7 +465,7 @@ bool DirectConnectionBase::openServerPort() if( ! listenSuccess ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Could not listen at port " << port << ", freeing for next one."; + kmDebug() << "Could not listen at port " << port << ", freeing for next one."; #endif serverPort_ = 0; // reset, so getLocalServerPort() picks the next port with another openServerPort() call. delete server_; @@ -509,7 +509,7 @@ qint64 DirectConnectionBase::readBlock( char *buffer, qint64 size ) qint64 noBytesRead = socket_->read( buffer, size ); if( noBytesRead < 0 ) { - kWarning() << "Error while reading " << size << " bytes from socket, return code: " << noBytesRead << ", system error: " << getSocketError() << " remote address: " << getRemoteIp() << ":" << getRemotePort() << "!"; + kmWarning() << "Error while reading " << size << " bytes from socket, return code: " << noBytesRead << ", system error: " << getSocketError() << " remote address: " << getRemoteIp() << ":" << getRemotePort() << "!"; return -1; } @@ -518,7 +518,7 @@ qint64 DirectConnectionBase::readBlock( char *buffer, qint64 size ) { // TODO: Even if the code detects it's not connected anymore, we don't signal this yet. // It opens a new can of worms to handle various event flows which are covered now. - kDebug() << "only " << noBytesRead + kmDebug() << "only " << noBytesRead << " of " << size << " bytes could be read (still connected=" << isConnected() << ")."; } #endif @@ -538,7 +538,7 @@ qint64 DirectConnectionBase::readBlock( QByteArray &buffer, const qint64 maxSize // Make final connected check if( ! isConnected() ) { - kWarning() << "Attempting to read data from a disconnected socket."; + kmWarning() << "Attempting to read data from a disconnected socket."; return false; } @@ -549,17 +549,17 @@ qint64 DirectConnectionBase::readBlock( QByteArray &buffer, const qint64 maxSize // Warn if certain sizes get a unusual value if(buffer.size() == 0) { - kWarning() << "Buffer is not initialized!"; + kmWarning() << "Buffer is not initialized!"; return -1; } else if(bufferSpace < 0) { - kWarning() << "Offset of " << bufferOffset << " bytes" + kmWarning() << "Offset of " << bufferOffset << " bytes" << " exceeds the buffer size of " << buffer.size() << " bytes!"; } else if( bufferSpace < maxSize) { - kWarning() << "Maximum allowed read size" + kmWarning() << "Maximum allowed read size" << " exceeds the buffer size of " << buffer.size() << " bytes!"; } @@ -607,7 +607,7 @@ void DirectConnectionBase::setAuthorized(bool authorized) } else { - kWarning() << "connection is already authorized, not notifying applications again."; + kmWarning() << "connection is already authorized, not notifying applications again."; } } @@ -621,14 +621,14 @@ void DirectConnectionBase::slotAcceptConnection() KMESS_ASSERT( server_ != 0 ); #endif #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Accept a socket"; + kmDebug() << "Accept a socket"; #endif if(socket_ != 0) { // Already accepted a connection, close server #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Already got a connection, rejecting this request"; + kmDebug() << "Already got a connection, rejecting this request"; #endif return; @@ -639,7 +639,7 @@ void DirectConnectionBase::slotAcceptConnection() if( socket_ == 0 ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kWarning() << "Failed to accept incoming connection."; + kmWarning() << "Failed to accept incoming connection."; #endif // TODO: signal failure? return; @@ -647,7 +647,7 @@ void DirectConnectionBase::slotAcceptConnection() // Accept success #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Accept success"; + kmDebug() << "Accept success"; #endif // Close the server, we don't need it anymore (no connectionClosed events()). @@ -693,11 +693,11 @@ void DirectConnectionBase::slotConnectionFailed() if( ! sysError.isNull() ) { - kWarning() << "Failed to connect with " << connectingTo_ << ", system error: " << sysError << "."; + kmWarning() << "Failed to connect with " << connectingTo_ << ", system error: " << sysError << "."; } else { - kWarning() << "Failed to connect with " << connectingTo_ << "!"; + kmWarning() << "Failed to connect with " << connectingTo_ << "!"; } // No events here, this method is called from slotSocketError() @@ -717,14 +717,14 @@ void DirectConnectionBase::slotConnectionTimeout() // This bug is fixed, but keep the check nevertheless. #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Timer fired but connection " + kmDebug() << "Timer fired but connection " "with " << connectingTo_ << " is already established, ignore."; #endif return; } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Timer fired before connection " + kmDebug() << "Timer fired before connection " "with " << connectingTo_ << " was established, " "closing sockets and reporting failure."; #endif @@ -753,7 +753,7 @@ void DirectConnectionBase::slotSocketConnected() KMESS_ASSERT( ! isServer_ ); #endif #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Connected with host " << connectingTo_ << "."; + kmDebug() << "Connected with host " << connectingTo_ << "."; #endif connectionTimer_.stop(); @@ -773,7 +773,7 @@ void DirectConnectionBase::slotSocketDisconnected() KMESS_ASSERT( socket_ != 0 ); #endif #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Socket got closed, state=" << socket_->state() << "."; + kmDebug() << "Socket got closed, state=" << socket_->state() << "."; #endif // Reset the globals. @@ -794,7 +794,7 @@ void DirectConnectionBase::slotSocketError( QAbstractSocket::SocketError error ) // This is called when the socket in openConnection() failed, // or when the socket closed. #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Got error with host " << connectingTo_ << " " + kmDebug() << "Got error with host " << connectingTo_ << " " "(code=" << error << " state=" << socket_->state() << " reason=" << socket_->errorString() << ")."; @@ -818,7 +818,7 @@ void DirectConnectionBase::slotSocketError( QAbstractSocket::SocketError error ) case QAbstractSocket::NetworkError: case QAbstractSocket::UnknownSocketError: #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "No signals emitted for this error code."; + kmDebug() << "No signals emitted for this error code."; #endif break; @@ -839,7 +839,7 @@ void DirectConnectionBase::slotSocketReadyWrite( qint64 bytesWritten ) if( ! additionalWriteBuffer_.isEmpty() ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "flushing buffer with unsent data first. " + kmDebug() << "flushing buffer with unsent data first. " "(bytesWritten=" << bytesWritten << " bytesToWrite=" << socket_->bytesToWrite() << " additional_bytesToWrite=" << additionalWriteBuffer_.size() << ")."; @@ -860,14 +860,14 @@ void DirectConnectionBase::slotSocketReadyWrite( qint64 bytesWritten ) { if( additionalWriteBuffer_.isEmpty() ) { - kWarning() << "the remaining " << newBuffer.size() << + kmWarning() << "the remaining " << newBuffer.size() << " unsent bytes could still not be sent!"; } else { // else ok, remaining is in additional buffer again. #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "buffer not completely flushed yet, " + kmDebug() << "buffer not completely flushed yet, " "still " << additionalWriteBuffer_.size() << " bytes to send."; #endif } @@ -877,7 +877,7 @@ void DirectConnectionBase::slotSocketReadyWrite( qint64 bytesWritten ) } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "buffer flushed, see if the write handler can be called for more data."; + kmDebug() << "buffer flushed, see if the write handler can be called for more data."; #endif } @@ -886,13 +886,13 @@ void DirectConnectionBase::slotSocketReadyWrite( qint64 bytesWritten ) if( socket_->bytesToWrite() > 2000 ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "still got " << socket_->bytesToWrite() << " bytes to write, delaying next write handler signal."; + kmDebug() << "still got " << socket_->bytesToWrite() << " bytes to write, delaying next write handler signal."; #endif } else { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "firing next write handler signal. " + kmDebug() << "firing next write handler signal. " "(bytesWritten=" << bytesWritten << " bytesToWrite=" << socket_->bytesToWrite() << ")."; #endif @@ -923,7 +923,7 @@ bool DirectConnectionBase::writeBlock( const char *block, const qint64 size ) // Make final connected check if( ! isConnected() ) { - kWarning() << "Attempting to write data to a disconnected socket."; + kmWarning() << "Attempting to write data to a disconnected socket."; return false; } @@ -939,14 +939,14 @@ bool DirectConnectionBase::writeBlock( const char *block, const qint64 size ) if( additionalWriteBuffer_.size() > 1000 ) { // only warn with release for larger additions. avoid false-positives for size preamble field. - kWarning() << "received another mesage of " << size << " bytes " + kmWarning() << "received another mesage of " << size << " bytes " "while the write buffer is full!"; } else { // else only warn in debug mode. #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kWarning() << "received another mesage of " << size << " bytes " + kmWarning() << "received another mesage of " << size << " bytes " "while the write buffer is full!"; #endif } @@ -957,7 +957,7 @@ bool DirectConnectionBase::writeBlock( const char *block, const qint64 size ) // 50 kB is more then enough if you're writing messages of 1300 bytes! if( additionalWriteBuffer_.size() > 50000 ) { - kWarning() << "write buffers are flooding, " + kmWarning() << "write buffers are flooding, " "dropping connection immediately!"; additionalWriteBuffer_.truncate(0); closeConnection(); @@ -969,7 +969,7 @@ bool DirectConnectionBase::writeBlock( const char *block, const qint64 size ) qint64 noBytesWritten = socket_->write( block, size ); if( noBytesWritten < 0 ) { - kWarning() << "Error while writing " << size << " bytes to socket, return code: " << noBytesWritten << ", system error: " << getSocketError() << " remote address: " << getRemoteIp() << ":" << getRemotePort() << "!"; + kmWarning() << "Error while writing " << size << " bytes to socket, return code: " << noBytesWritten << ", system error: " << getSocketError() << " remote address: " << getRemoteIp() << ":" << getRemotePort() << "!"; return false; } @@ -984,7 +984,7 @@ bool DirectConnectionBase::writeBlock( const char *block, const qint64 size ) // this corrupts file transfers if the data is not sent later on. if( noBytesWritten < size ) { - kWarning() << "only " << noBytesWritten + kmWarning() << "only " << noBytesWritten << " of " << size << " bytes could be written!"; additionalWriteBuffer_.append( QByteArray::fromRawData( block + noBytesWritten, (int)(size - noBytesWritten) ) ); diff --git a/src/network/extra/directconnectionpool.cpp b/src/network/extra/directconnectionpool.cpp index 84f6542..03fa58d 100644 --- a/src/network/extra/directconnectionpool.cpp +++ b/src/network/extra/directconnectionpool.cpp @@ -41,7 +41,7 @@ DirectConnectionPool::DirectConnectionPool( bool waitForAuthorized ) DirectConnectionPool::~DirectConnectionPool() { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Deleting pending sockets and active connection."; + kmDebug() << "Deleting pending sockets and active connection."; #endif clearPending(); @@ -55,7 +55,7 @@ DirectConnectionPool::~DirectConnectionPool() } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -70,12 +70,12 @@ bool DirectConnectionPool::addConnection(DirectConnectionBase *connection, const // Refuse if there is already an active connection if( activeConnection_ != 0 ) { - kWarning() << "Refusing connection attempt, a connection has already been made."; + kmWarning() << "Refusing connection attempt, a connection has already been made."; return 0; } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Adding new client connection to peer " + kmDebug() << "Adding new client connection to peer " << ipAddress << ":" << port << endl; #endif @@ -99,7 +99,7 @@ bool DirectConnectionPool::addConnection(DirectConnectionBase *connection, const connection->deleteLater(); #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Could not connect to " << ipAddress << ":" << port; + kmDebug() << "Could not connect to " << ipAddress << ":" << port; #endif return false; } @@ -117,12 +117,12 @@ int DirectConnectionPool::addServerConnection(DirectConnectionBase *connection) // Refuse if there is already an active connection if( activeConnection_ != 0 ) { - kWarning() << "Refusing server connection attempt, a connection has already been made."; + kmWarning() << "Refusing server connection attempt, a connection has already been made."; return 0; } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Adding new server connection to listen at port" << connection->getLocalServerPort(); + kmDebug() << "Adding new server connection to listen at port" << connection->getLocalServerPort(); #endif pendingConnections_.append( connection ); // append to pending list before signals are fired. @@ -158,7 +158,7 @@ int DirectConnectionPool::addServerConnection(DirectConnectionBase *connection) pendingConnections_.removeAll( connection ); connection->deleteLater(); - kWarning() << "No available free port could be found"; + kmWarning() << "No available free port could be found"; return 0; } @@ -180,14 +180,14 @@ void DirectConnectionPool::clearPending() } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Removing pending sockets."; + kmDebug() << "Removing pending sockets."; #endif // Tell all other pending connections to abort foreach( DirectConnectionBase *pendingConnection, pendingConnections_ ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Deleting pending connection to peer " + kmDebug() << "Deleting pending connection to peer " << pendingConnection->getRemoteIp() << ":" << pendingConnection->getRemotePort() << endl; #endif @@ -198,7 +198,7 @@ void DirectConnectionPool::clearPending() foreach( DirectConnectionBase *unauthorizedConnection, unauthorizedConnections_ ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Deleting unauthorized connection to peer " + kmDebug() << "Deleting unauthorized connection to peer " << unauthorizedConnection->getRemoteIp() << ":" << unauthorizedConnection->getRemotePort() << endl; #endif @@ -249,7 +249,7 @@ bool DirectConnectionPool::hasPendingConnections() const void DirectConnectionPool::slotConnectionAuthorized() { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "A direct connection was authorized."; + kmDebug() << "A direct connection was authorized."; #endif // Find out which object sent the signal @@ -309,7 +309,7 @@ void DirectConnectionPool::slotConnectionClosed() if(connection == activeConnection_) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Closed connection was the active connection!"; + kmDebug() << "Closed connection was the active connection!"; #endif emit activeConnectionClosed(); @@ -318,14 +318,14 @@ void DirectConnectionPool::slotConnectionClosed() else { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Closed connection was another pending socket from the pool."; + kmDebug() << "Closed connection was another pending socket from the pool."; #endif // Check whethere there is still a chance to get a direct connection if( activeConnection_ == 0 && ! hasPendingConnections() ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "No remaining direct connections left."; + kmDebug() << "No remaining direct connections left."; #endif // Emit signal for fallback (e.g. sending files over the switchboard) @@ -346,14 +346,14 @@ void DirectConnectionPool::slotConnectionClosed() void DirectConnectionPool::slotConnectionEstablished() { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Direct connection established."; + kmDebug() << "Direct connection established."; #endif // Test whether two connection attempts were established quickly after each other. if( activeConnection_ != 0 ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Already got an active connection, removing other connections."; + kmDebug() << "Already got an active connection, removing other connections."; #endif clearPending(); return; @@ -365,7 +365,7 @@ void DirectConnectionPool::slotConnectionEstablished() if( pendingConnection->isConnected() ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Connected to peer " + kmDebug() << "Connected to peer " << pendingConnection->getRemoteIp() << ":" << pendingConnection->getRemotePort() << endl; #endif @@ -379,7 +379,7 @@ void DirectConnectionPool::slotConnectionEstablished() // Not initialized (e.g. preamble cound not be sent in case of a MsnDirectConnection), // try the next item in the list instead. #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "could not initialize connection, " + kmDebug() << "could not initialize connection, " "trying next available connection." << endl; #endif pendingConnection->deleteLater(); @@ -392,7 +392,7 @@ void DirectConnectionPool::slotConnectionEstablished() if( waitForAuthorized_ ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "by request, waiting for the connection to authorize first..."; + kmDebug() << "by request, waiting for the connection to authorize first..."; #endif unauthorizedConnections_.append( pendingConnection ); @@ -424,7 +424,7 @@ void DirectConnectionPool::slotConnectionEstablished() void DirectConnectionPool::slotConnectionFailed() { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "A direct connection failed."; + kmDebug() << "A direct connection failed."; #endif // Find out which object sent the signal @@ -445,7 +445,7 @@ void DirectConnectionPool::slotConnectionFailed() if( ! hasPendingConnections() ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "No remaining direct connections left."; + kmDebug() << "No remaining direct connections left."; #endif // Emit signal for fallback (e.g. sending files over the switchboard) @@ -454,7 +454,7 @@ void DirectConnectionPool::slotConnectionFailed() else { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "There are " << ( pendingConnections_.count() + unauthorizedConnections_.count() ) << " remaining direct connections, waiting for one to succeed."; + kmDebug() << "There are " << ( pendingConnections_.count() + unauthorizedConnections_.count() ) << " remaining direct connections, waiting for one to succeed."; #endif } } @@ -463,7 +463,7 @@ void DirectConnectionPool::slotConnectionFailed() if( connection == activeConnection_ ) { // This really shouldn't happen - kWarning() << "The active connection failed!"; + kmWarning() << "The active connection failed!"; // Reset current object activeConnection_ = 0; @@ -473,7 +473,7 @@ void DirectConnectionPool::slotConnectionFailed() } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Deleting failed connection."; + kmDebug() << "Deleting failed connection."; #endif // Delete the failed connection object. @@ -493,7 +493,7 @@ bool DirectConnectionPool::verifyActiveConnection() && ( ! activeConnection_->isConnected() || activeConnection_->hasTimedOut() ) ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Active connection is no longer connected, deleting connection."; + kmDebug() << "Active connection is no longer connected, deleting connection."; #endif // Delete connection diff --git a/src/network/extra/msndirectconnection.cpp b/src/network/extra/msndirectconnection.cpp index 409c7e0..29a3bf7 100644 --- a/src/network/extra/msndirectconnection.cpp +++ b/src/network/extra/msndirectconnection.cpp @@ -46,7 +46,7 @@ MsnDirectConnection::MsnDirectConnection(const QString &contactHandle) MsnDirectConnection::~MsnDirectConnection() { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "DESTROYED. [handle=" << contactHandle_ << "]"; + kmDebug() << "DESTROYED. [handle=" << contactHandle_ << "]"; #endif } @@ -70,7 +70,7 @@ bool MsnDirectConnection::initialize() } #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "sending preamble message (0x666f6f00)."; + kmDebug() << "sending preamble message (0x666f6f00)."; #endif #ifdef KMESS_NETWORK_WINDOW KMESS_NET_INIT(this, "DC " + getRemoteIp()); @@ -98,7 +98,7 @@ bool MsnDirectConnection::initialize() bool MsnDirectConnection::sendMessage(const QByteArray &message) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "sending message block (size=" << message.size() << ", handle=" << contactHandle_ << ")"; + kmDebug() << "sending message block (size=" << message.size() << ", handle=" << contactHandle_ << ")"; #endif #ifdef KMESSTEST KMESS_ASSERT( message.size() <= 1352 ); // max message size for official client @@ -115,7 +115,7 @@ bool MsnDirectConnection::sendMessage(const QByteArray &message) P2PMessage::insertBytes( lengthField, message.size(), 0 ); if( ! writeBlock( lengthField ) && ! hasTemporaryWriteError() ) { - kWarning() << "Unable to send the preamble block " + kmWarning() << "Unable to send the preamble block " "(contact=" << contactHandle_ << ")." << endl; return false; } @@ -132,7 +132,7 @@ void MsnDirectConnection::slotSocketDataReceived() // HACK: Completely avoid using DirectConnectionBase::getAvailableBytes() in this method: it makes this method // to freeze. It seems that the call to the socket ( KExtendedSocket::bytesAvailable() ) always returns zero. // This wouldn't be SO bad as an issue by itself. But the loop ( doing getAvailableBytes() > 0 ) evals to TRUE - // sticking itself in an infinite loop. I've tried putting a "kWarning() << getAvailableBytes()" statement + // sticking itself in an infinite loop. I've tried putting a "kmWarning() << getAvailableBytes()" statement // immediately before the while() statement as last instruction of the loop: in the log it says "kmess: WARNING: // 0", but the loop goes on anyways. @@ -153,7 +153,7 @@ void MsnDirectConnection::slotSocketDataReceived() if( 0 < noBytesPeeked && noBytesPeeked < 4 ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Socket buffer only has " << noBytesPeeked << " of 4 bytes for the size preamble field, will wait for new data."; + kmDebug() << "Socket buffer only has " << noBytesPeeked << " of 4 bytes for the size preamble field, will wait for new data."; #endif return; } @@ -167,13 +167,13 @@ void MsnDirectConnection::slotSocketDataReceived() if( noBytesRead == 0 ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Socket buffer is empty, will wait for new data (read=" << noBytesRead << " peek=" << noBytesPeeked << ")."; + kmDebug() << "Socket buffer is empty, will wait for new data (read=" << noBytesRead << " peek=" << noBytesPeeked << ")."; #endif return; } else if( noBytesRead < 0 ) { - kWarning() << "read error on socket " + kmWarning() << "read error on socket " "(read=" << noBytesRead << " peek=" << noBytesPeeked << " offset=" << preambleOffset_ << " contact=" << contactHandle_ << ")." << endl; @@ -183,7 +183,7 @@ void MsnDirectConnection::slotSocketDataReceived() else if( noBytesRead < 4 ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "read partial size preamble message " + kmDebug() << "read partial size preamble message " "(read=" << noBytesRead << " offset=" << preambleOffset_ << " peek=" << noBytesPeeked << ")." << endl; #endif @@ -195,13 +195,13 @@ void MsnDirectConnection::slotSocketDataReceived() preambleOffset_ = 0; #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "got final part of size preamble message."; + kmDebug() << "got final part of size preamble message."; #endif } else { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "will wait for " + kmDebug() << "will wait for " "the remaining " << ( 4 - noBytesRead ) << " bytes of the size preamble message..." << endl; #endif @@ -230,7 +230,7 @@ void MsnDirectConnection::slotSocketDataReceived() // Official client only allows up to 1352 bytes. if( remainingBlockBytes_ > 4000 ) { - kWarning() << "received unexpected large block length, " + kmWarning() << "received unexpected large block length, " "aborting transfer " "(length=" << remainingBlockBytes_ << " contact=" << contactHandle_ << ")!" << endl; @@ -244,7 +244,7 @@ void MsnDirectConnection::slotSocketDataReceived() bufferOffset_ = 0; #ifdef KMESSDEBUG_DIRECTCONNECTION_RECEIVING - kDebug() << "4 bytes read, " + kmDebug() << "4 bytes read, " << "next block size is " << remainingBlockBytes_ << " bytes." << endl; #endif @@ -261,7 +261,7 @@ void MsnDirectConnection::slotSocketDataReceived() qint64 noBytesRead = readBlock( buffer_, remainingBlockBytes_, bufferOffset_ ); if( noBytesRead < 0 ) { - kWarning() << "read error " + kmWarning() << "read error " "(returned " << noBytesRead << " block size=" << buffer_.size() << " buffer offset=" << bufferOffset_ << @@ -273,7 +273,7 @@ void MsnDirectConnection::slotSocketDataReceived() { // Buffer is currently empty: wait the next data arrival to handle it #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "Socket buffer is empty, will wait for new data."; + kmDebug() << "Socket buffer is empty, will wait for new data."; #endif return; } @@ -287,7 +287,7 @@ void MsnDirectConnection::slotSocketDataReceived() remainingBlockBytes_ -= noBytesRead; #ifdef KMESSDEBUG_DIRECTCONNECTION_RECEIVING - kDebug() << "read " + kmDebug() << "read " << noBytesRead << " bytes, " << remainingBlockBytes_ << " remaining." << endl; #endif #ifdef KMESSTEST @@ -304,19 +304,19 @@ void MsnDirectConnection::slotSocketDataReceived() if( QByteArray(buffer_.data(), 3) == "foo" ) { #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL - kDebug() << "received preamble packet, ignoring."; + kmDebug() << "received preamble packet, ignoring."; #endif } else { - kWarning() << "received unexpected preamble packet, ignoring" + kmWarning() << "received unexpected preamble packet, ignoring" << " (data=" << buffer_.data() << " contact=" << contactHandle_ << ")." << endl; } } else { #ifdef KMESSDEBUG_DIRECTCONNECTION_RECEIVING - kDebug() << "Emitting message received signal."; + kmDebug() << "Emitting message received signal."; #endif // A normal message was received emit messageReceived( buffer_ ); diff --git a/src/network/extra/msnftpconnection.cpp b/src/network/extra/msnftpconnection.cpp index 90614e9..02e9bef 100644 --- a/src/network/extra/msnftpconnection.cpp +++ b/src/network/extra/msnftpconnection.cpp @@ -65,7 +65,7 @@ MsnFtpConnection::~MsnFtpConnection() void MsnFtpConnection::cancelTransfer(bool userCancelled) { #ifdef KMESSDEBUG_MSNFTP_GENERAL - kDebug() << "Cancelling."; + kmDebug() << "Cancelling."; #endif #ifdef KMESSTEST KMESS_ASSERT( isConnected() ); @@ -94,7 +94,7 @@ void MsnFtpConnection::cancelTransfer(bool userCancelled) void MsnFtpConnection::closeConnection() { #ifdef KMESSDEBUG_MSNFTP_GENERAL - kDebug() << "MsnFtpConnection - closing sockets"; + kmDebug() << "MsnFtpConnection - closing sockets"; #endif // Reset the current mode @@ -162,7 +162,7 @@ void MsnFtpConnection::parseCommand(const QStringList &command) // Mark connection as authorized, this command is received in response to our USR. setAuthorized(true); #ifdef KMESSDEBUG_MSNFTP_GENERAL - kDebug() << "There are " << fileBytesRemaining_ << " bytes to be received."; + kmDebug() << "There are " << fileBytesRemaining_ << " bytes to be received."; #endif } else if(command[0] == "USR") @@ -182,9 +182,9 @@ void MsnFtpConnection::parseCommand(const QStringList &command) } else { - kWarning() << "user authorisation was incorrect."; + kmWarning() << "user authorisation was incorrect."; #ifdef KMESSDEBUG_MSNFTP_GENERAL - kDebug() << "expected " << authHandle_ << "/" << authCookie_ + kmDebug() << "expected " << authHandle_ << "/" << authCookie_ << " got " << command[1] << "/" << command[2] << "." << endl; #endif cancelTransfer(false); @@ -206,7 +206,7 @@ void MsnFtpConnection::parseCommand(const QStringList &command) else { // Never passed authorisation test - kWarning() << "user authorisation was skipped by contact."; + kmWarning() << "user authorisation was skipped by contact."; cancelTransfer(false); // TODO: test it } @@ -226,7 +226,7 @@ void MsnFtpConnection::parseCommand(const QStringList &command) } else { - kDebug() << "File transfer got unhandled command: " << command[0] << "."; + kmDebug() << "File transfer got unhandled command: " << command[0] << "."; // Cancel, session is of no use now. cancelTransfer(false); } @@ -279,7 +279,7 @@ void MsnFtpConnection::parseReceivedFileData() remainingBlockBytes_ = (byte1 | byte2 << 8); #ifdef KMESSDEBUG_MSNFTP_RECEIVING - kDebug() << "Receiving new block, size = " << remainingBlockBytes_ << ". " + kmDebug() << "Receiving new block, size = " << remainingBlockBytes_ << ". " << "socket bytes available: " << getAvailableBytes() << "." << endl; #endif } @@ -323,7 +323,7 @@ void MsnFtpConnection::parseReceivedFileData() if(noBytesRead <= 0) { #ifdef KMESSDEBUG_MSNFTP_GENERAL - kWarning() << "read error (returned " << noBytesRead << " block size=" << blockSize << ")"; + kmWarning() << "read error (returned " << noBytesRead << " block size=" << blockSize << ")"; #endif // Socket error, exit emit transferFailed(); @@ -342,7 +342,7 @@ void MsnFtpConnection::parseReceivedFileData() outputStream_->write( rawBlock, noBytesRead ); #ifdef KMESSDEBUG_MSNFTP_RECEIVING - kDebug() << noBytesRead << " bytes read. " + kmDebug() << noBytesRead << " bytes read. " << fileBytesRemaining_ << " bytes remaining." << endl; #endif } @@ -352,7 +352,7 @@ void MsnFtpConnection::parseReceivedFileData() if(fileBytesRemaining_ <= 0) { #ifdef KMESSDEBUG_MSNFTP_GENERAL - kDebug() << "Done receiving file data."; + kmDebug() << "Done receiving file data."; #endif mode_ = SEND_BYE; return; @@ -530,7 +530,7 @@ void MsnFtpConnection::slotSocketDataReceived() #ifdef KMESSDEBUG_MSNFTP_GENERAL - kDebug() << "<<< " << commandLine; + kmDebug() << "<<< " << commandLine; #endif // Parse the command @@ -663,7 +663,7 @@ void MsnFtpConnection::slotWriteData() void MsnFtpConnection::writeCancelData() { #ifdef KMESSDEBUG_MSNFTP_GENERAL - kDebug() << "Cancelling transfer"; + kmDebug() << "Cancelling transfer"; #endif // Send a new data block @@ -705,7 +705,7 @@ void MsnFtpConnection::writeFileData() } #ifdef KMESSDEBUG_MSNFTP_GENERAL - kDebug() << noBytesRead << " bytes written. " + kmDebug() << noBytesRead << " bytes written. " << fileBytesRemaining_ << " bytes remaining." << " connected=" << isConnected() << endl; #endif @@ -725,7 +725,7 @@ void MsnFtpConnection::writeFileData() // See if we're done if(fileBytesRemaining_ <= 0 ) { - kDebug() << "done transferring file."; + kmDebug() << "done transferring file."; mode_ = WAIT; // Wait for BYE } } @@ -739,8 +739,8 @@ void MsnFtpConnection::writeMessage(QString message) writeBlock( messageUtf8 ); #ifdef KMESSDEBUG_MSNFTP_GENERAL - kDebug() << "mode is " << mode_; - kDebug() << "MsnFtpConnection >>> " << message; + kmDebug() << "mode is " << mode_; + kmDebug() << "MsnFtpConnection >>> " << message; #endif } diff --git a/src/network/extra/p2pfragmenttracker.cpp b/src/network/extra/p2pfragmenttracker.cpp index e5f152c..b4d60a1 100644 --- a/src/network/extra/p2pfragmenttracker.cpp +++ b/src/network/extra/p2pfragmenttracker.cpp @@ -108,7 +108,7 @@ quint32 P2PFragmentTracker::getTransferredBytes() const if( transferredBytes_ != realCount ) { - kWarning() << "P2PFragmentTracker: Invalid byte count for " << getDebugMap(); + kmWarning() << "P2PFragmentTracker: Invalid byte count for " << getDebugMap(); return realCount; } diff --git a/src/network/mimemessage.cpp b/src/network/mimemessage.cpp index 6e269cf..12f9d88 100644 --- a/src/network/mimemessage.cpp +++ b/src/network/mimemessage.cpp @@ -46,7 +46,7 @@ MimeMessage::MimeMessage() MimeMessage::MimeMessage(const QString &message) { #ifdef KMESSDEBUG_MIMEMESSAGE - kDebug() << "Parsing the sub message"; + kmDebug() << "Parsing the sub message"; #endif parseMessage( message ); } @@ -82,11 +82,11 @@ MimeMessage::MimeMessage(const QByteArray &message) #ifdef KMESSDEBUG_MIMEMESSAGE if( isP2P ) { - kDebug() << "Parsing the message, extracting binary p2p body."; + kmDebug() << "Parsing the message, extracting binary p2p body."; } else if( isMultiPacket ) { - kDebug() << "Parsing the message, preserving multi-packet body as binary."; + kmDebug() << "Parsing the message, preserving multi-packet body as binary."; } #endif @@ -104,7 +104,7 @@ MimeMessage::MimeMessage(const QByteArray &message) else { #ifdef KMESSDEBUG_MIMEMESSAGE - kDebug() << "Parsing the message."; + kmDebug() << "Parsing the message."; #endif // This is a normal plain-text message. @@ -119,7 +119,7 @@ MimeMessage::MimeMessage(const QByteArray &message) MimeMessage::MimeMessage(const MimeMessage& other) { #ifdef KMESSDEBUG_MIMEMESSAGE - kDebug() << "copy constructor"; + kmDebug() << "copy constructor"; #endif // Get the body of the other message @@ -468,7 +468,7 @@ QString MimeMessage::getValue(const QString& field ) const return values_[i]; } } - kWarning() << "This message contained no field \"" << field << "\"."; + kmWarning() << "This message contained no field \"" << field << "\"."; return QString(); } @@ -534,20 +534,20 @@ void MimeMessage::parseMessage(const QString& message) // Print the contents of the message to kDebug (for debugging purposes) void MimeMessage::print() const { - kDebug() << "Printing MIME message, " << fields_.count() << " fields."; + kmDebug() << "Printing MIME message, " << fields_.count() << " fields."; // Get the fields and values for( int i = 0; i < fields_.count(); i++ ) { - kDebug() << "Field: \"" << fields_[i] << "\" value: \"" << values_[i] << "\""; + kmDebug() << "Field: \"" << fields_[i] << "\" value: \"" << values_[i] << "\""; } if( binaryBody_.isEmpty() ) { - kDebug() << "Body:" << endl << body_; + kmDebug() << "Body:" << endl << body_; } else { - kDebug() << "Body: (" << binaryBody_.size() << " bytes of binary data)"; + kmDebug() << "Body: (" << binaryBody_.size() << " bytes of binary data)"; } } @@ -612,7 +612,7 @@ void MimeMessage::splitLine(QString& field, QString& value, const QString& line) } else { - kWarning() << "Couldn't split line '" << line << "'"; + kmWarning() << "Couldn't split line '" << line << "'"; } } @@ -621,28 +621,14 @@ void MimeMessage::splitLine(QString& field, QString& value, const QString& line) // Split the message head into components and store it in the string list void MimeMessage::splitHead(QStringList& stringList, const QString& head) const { - int left = 0, right = 0; - QString line; - - stringList.clear(); - right = head.indexOf( "\r\n" ); - while ( right >= 0 ) + // adam (16 Oct 10) - split on \n only + // the OfflineIM service is doing something funky and only + // terminating lines with \n. If we split on \n, then trim() the string, + // we'll strip out any \r's as well. + stringList = head.split("\n"); + for( int i = 0; i < stringList.count(); i++ ) { - // Get the message between "left" and "right". - line = head.mid( left, right - left ); - stringList << line; - - // Find the next occurence of "\r\n" after left. - left = right + 2; - right = head.indexOf( "\r\n", left ); - - if(right == -1 && ! head.endsWith("\r\n")) - { - // This happens with MSNP2P/SLP content messages - // I try to parse with the MimeMessage constructor. - line = head.mid(left); - stringList << line; - } + stringList[i] = stringList[i].trimmed(); } } @@ -652,9 +638,19 @@ void MimeMessage::splitHead(QStringList& stringList, const QString& head) const void MimeMessage::splitMessage(QString& head, QString& body, const QString& message) const { int index; - + int count; // The message is split into head and body at "\r\n\r\n" index = message.indexOf( "\r\n\r\n" ); + count = 4; + + // Offline IM MIME messages don't use \r\n anymore? + // wtf? (adam - 16 Oct 10) + if ( index < 0 ) + { + index = message.indexOf("\n\n"); + count = 2; + } + if ( index < 0 ) { head = message; @@ -662,7 +658,7 @@ void MimeMessage::splitMessage(QString& head, QString& body, const QString& mess } else { - head = message.left( index + 2 ); // Keep a "\r\n" at the end - body = message.right( message.length() - index - 4 ); + head = message.left( index + ( count / 2 ) ); // Keep a "\r\n" at the end + body = message.right( message.length() - index - count ); } } diff --git a/src/network/msnchallengehandler.cpp b/src/network/msnchallengehandler.cpp index 2a1e735..6caf296 100644 --- a/src/network/msnchallengehandler.cpp +++ b/src/network/msnchallengehandler.cpp @@ -63,7 +63,7 @@ const QString MSNChallengeHandler::computeHash( const QString& challengeString ) QCryptographicHash::Md5 ).toHex() ); #ifdef KMESSDEBUG_CHALLENGEHANDLER - kDebug() << "md5: " << digest; + kmDebug() << "md5: " << digest; #endif QVector md5Integers(4); @@ -72,7 +72,7 @@ const QString MSNChallengeHandler::computeHash( const QString& challengeString ) md5Integers[i] = hexSwap( digest.mid( i * 8, 8 ) ).toUInt( 0, 16 ) & 0x7FFFFFFF; #ifdef KMESSDEBUG_CHALLENGEHANDLER - kDebug() << "hex " << i << " 0x" + hexSwap( digest.mid( i * 8, 8 ) ) << " = " << md5Integers[i]; + kmDebug() << "hex " << i << " 0x" + hexSwap( digest.mid( i * 8, 8 ) ) << " = " << md5Integers[i]; #endif } @@ -83,7 +83,7 @@ const QString MSNChallengeHandler::computeHash( const QString& challengeString ) challengeKey = challengeKey.leftJustified(challengeKey.length() + ( 8 - challengeKey.length() % 8 ), '0'); #ifdef KMESSDEBUG_CHALLENGEHANDLER - kDebug() << "challenge key: " << challengeKey; + kmDebug() << "challenge key: " << challengeKey; #endif QVector challengeIntegers( challengeKey.length() / 4 ); @@ -105,7 +105,7 @@ const QString MSNChallengeHandler::computeHash( const QString& challengeString ) challengeIntegers[i] = sNumHex.toInt(0, 16); #ifdef KMESSDEBUG_CHALLENGEHANDLER - kDebug() << "challenge int " << sNum << (": 0x" + sNumHex) << " = " << challengeIntegers[i]; + kmDebug() << "challenge int " << sNum << (": 0x" + sNumHex) << " = " << challengeIntegers[i]; #endif } diff --git a/src/network/msnconnection.cpp b/src/network/msnconnection.cpp index fdf71f2..d93a6c5 100644 --- a/src/network/msnconnection.cpp +++ b/src/network/msnconnection.cpp @@ -90,7 +90,7 @@ MsnConnection::~MsnConnection() delete socket_; #ifdef KMESSDEBUG_CONNECTION - kDebug() << objectName() << "- DESTROYED"; + kmDebug() << objectName() << "- DESTROYED"; #endif } @@ -107,7 +107,7 @@ MsnConnection::~MsnConnection() void MsnConnection::addSoapClient( HttpSoapConnection *client ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Adding SOAP client to list."; + kmDebug() << "Adding SOAP client to list."; #endif // Connect signals @@ -131,7 +131,7 @@ void MsnConnection::addSoapClient( HttpSoapConnection *client ) void MsnConnection::attachToSocketSignals() { #ifdef KMESSDEBUG_CONNECTION - kDebug() << objectName() << "- Connecting socket signals."; + kmDebug() << objectName() << "- Connecting socket signals."; #endif #ifdef KMESSTEST KMESS_ASSERT( socket_ != 0 ); @@ -171,11 +171,11 @@ void MsnConnection::connectToServer( const QString& server, const quint16 port ) #ifdef KMESSDEBUG_CONNECTION_SOCKET if( server.isEmpty() && port == 0 ) { - kDebug() << objectName() << "- Connecting to the default server."; + kmDebug() << objectName() << "- Connecting to the default server."; } else { - kDebug() << objectName() << "- Connecting to server at" << server << ":" << port << "."; + kmDebug() << objectName() << "- Connecting to server at" << server << ":" << port << "."; } #endif @@ -213,7 +213,7 @@ void MsnConnection::deleteSoapClients() if( ! soapClients_.isEmpty() ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Closing SOAP sessions."; + kmDebug() << "Closing SOAP sessions."; #endif foreach( HttpSoapConnection *soapClient, soapClients_ ) @@ -241,7 +241,7 @@ void MsnConnection::deleteSoapClients() void MsnConnection::disconnectFromServer( bool isTransfer ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET - kDebug() << objectName() << "- Closing the connection."; + kmDebug() << objectName() << "- Closing the connection."; #endif // Gracefully disconnect @@ -273,7 +273,7 @@ void MsnConnection::disconnectFromServer( bool isTransfer ) const QString MsnConnection::getLocalIp() const { #ifdef KMESSDEBUG_SWITCHBOARD_FILETRANSFER - kDebug() << objectName() << "- Local IP is " << socket_->getLocalIp(); + kmDebug() << objectName() << "- Local IP is " << socket_->getLocalIp(); #endif return socket_->getLocalIp(); @@ -294,7 +294,7 @@ bool MsnConnection::initialize() { if( initialized_ ) { - kDebug() << objectName() << "- Already initialized!"; + kmDebug() << objectName() << "- Already initialized!"; return false; } @@ -351,16 +351,16 @@ void MsnConnection::parseError( const QStringList &command, const QByteArray &pa { if( command[0].toInt() == 0 ) { - kWarning() << "Invalid error command received:" << command; + kmWarning() << "Invalid error command received:" << command; return; } // Always print error codes, to ease a bit the error resolution - kWarning() << "Received error code" << command[0] << "from server."; + kmWarning() << "Received error code" << command[0] << "from server."; if( ! payloadData.isEmpty() ) { - kWarning() << "The error also carries a payload:"; - kWarning() << payloadData; + kmWarning() << "The error also carries a payload:"; + kmWarning() << payloadData; } QString errorMessage; @@ -630,7 +630,7 @@ void MsnConnection::parseError( const QStringList &command, const QByteArray &pa default: // No need to bugger the users with strange error messages - kWarning() << "Unknown error" << command[0] << "received from the server! Full string:" << command.join( " " ); + kmWarning() << "Unknown error" << command[0] << "received from the server! Full string:" << command.join( " " ); #ifdef KMESSDEBUG_NOTIFICATION_GENERAL slotError( i18n( "Unknown error code received from the server: %1
Technical details: %2", command[0], @@ -647,7 +647,7 @@ void MsnConnection::parseError( const QStringList &command, const QByteArray &pa if( isNotice ) { // emit statusMessage( errorMessage, false ); - kDebug() << errorMessage; + kmDebug() << errorMessage; return; } // We've received a warning message: show it in a dialog box, but do not disconnect @@ -678,7 +678,7 @@ void MsnConnection::parseError( const QStringList &command, const QByteArray &pa void MsnConnection::parseMultiPacketMimeMessage( const QStringList &command, const MimeMessage &mimeMessage ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET - kDebug() << objectName() << "- Message is a multi-packet message, buffering."; + kmDebug() << objectName() << "- Message is a multi-packet message, buffering."; #endif // Get associated multi-packet message buffer, create one if it doesn't exist yet. @@ -843,10 +843,10 @@ void MsnConnection::slotDataReceived( const QStringList &commandLine, const QByt { #ifdef KMESSDEBUG_SERVERMESSAGES // Display the received command data - kDebug() << objectName() << "- <<< (C) " << commandLine; + kmDebug() << objectName() << "- <<< (C) " << commandLine; if( ! payloadData.isEmpty() ) { - kDebug() << objectName() << "- <<< (P) " << payloadData; + kmDebug() << objectName() << "- <<< (P) " << payloadData; } #endif @@ -929,13 +929,13 @@ bool MsnConnection::switchToHttpSocket() if( qobject_cast( socket_ ) ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET - kDebug() << "Cannot switch to HTTP connection. Class is" << socket_->metaObject()->className(); + kmDebug() << "Cannot switch to HTTP connection. Class is" << socket_->metaObject()->className(); #endif return false; } #ifdef KMESSDEBUG_CONNECTION_SOCKET - kDebug() << "Attempting switch to HTTP connection."; + kmDebug() << "Attempting switch to HTTP connection."; #endif // Save the socket details to use the same ones for the new socket @@ -980,13 +980,13 @@ bool MsnConnection::switchToTcpSocket() if( qobject_cast( socket_ ) ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET - kDebug() << "Cannot switch to TCP connection. Class is" << socket_->metaObject()->className(); + kmDebug() << "Cannot switch to TCP connection. Class is" << socket_->metaObject()->className(); #endif return false; } #ifdef KMESSDEBUG_CONNECTION_SOCKET - kDebug() << "Attempting to switch back to TCP connection."; + kmDebug() << "Attempting to switch back to TCP connection."; #endif // Save the socket details to use the same ones for the new socket @@ -1019,7 +1019,7 @@ void MsnConnection::writeBinaryData( const QByteArray& data ) { if( ! isConnected() ) { - kWarning() << objectName() << "- Attempting to write binary data while disconnected, aborting."; + kmWarning() << objectName() << "- Attempting to write binary data while disconnected, aborting."; return; } @@ -1028,10 +1028,10 @@ void MsnConnection::writeBinaryData( const QByteArray& data ) /* QByteArray debugData( data ); for( int i = 0; i < debugData.size(); i++ ) { if( debugData[i] < 10 ) debugData[ i ] = '?'; } - kDebug() << objectName() << "- >>> " << QString::fromUtf8( debugData.data(), debugData.size() ); + kmDebug() << objectName() << "- >>> " << QString::fromUtf8( debugData.data(), debugData.size() ); */ // To display the first readable part: (removing the final \r\n) - kDebug() << objectName() << "- >>> " << QString( data ).trimmed(); + kmDebug() << objectName() << "- >>> " << QString( data ).trimmed(); #endif // Write to the socket @@ -1050,12 +1050,12 @@ void MsnConnection::writeData( const QString& data ) { if( ! isConnected() ) { - kWarning() << objectName() << "- Attempting to write data while disconnected, aborting."; + kmWarning() << objectName() << "- Attempting to write data while disconnected, aborting."; return; } #ifdef KMESSDEBUG_SERVERMESSAGES - kDebug() << objectName() << "- >>> " << data.trimmed(); + kmDebug() << objectName() << "- >>> " << data.trimmed(); #endif const QByteArray binData( data.toUtf8() ); @@ -1063,7 +1063,7 @@ void MsnConnection::writeData( const QString& data ) if( noBytesWritten != binData.length() ) // Note that the previous code used data.length instead of unicode.length(), but I { // changed this since that is the string we send to the socket... (could be wrong here) - kWarning() << objectName() << "- Wanted to write " << data.length() << " bytes to the socket, wrote " << noBytesWritten << "."; + kmWarning() << objectName() << "- Wanted to write " << data.length() << " bytes to the socket, wrote " << noBytesWritten << "."; } // Append message to the network window diff --git a/src/network/msnnotificationconnection.cpp b/src/network/msnnotificationconnection.cpp index ee2339f..a446e79 100644 --- a/src/network/msnnotificationconnection.cpp +++ b/src/network/msnnotificationconnection.cpp @@ -111,6 +111,12 @@ MsnNotificationConnection::MsnNotificationConnection() connect( &loginTimer_, SIGNAL( timeout() ), this, SLOT ( slotAuthenticationFailed() ) ); + // Setup the timer to log in immediately if the SOAP requests take too long + friendlyNameWaitTimer_.stop(); + friendlyNameWaitTimer_.setSingleShot( true ); + connect( &friendlyNameWaitTimer_, SIGNAL( timeout() ), + this, SLOT( goOnline() ) ); + notificationUnlockTimer_.setSingleShot( true ); connect( ¬ificationUnlockTimer_, SIGNAL( timeout() ), this, SLOT( unlockNotifications() ) ); } @@ -138,7 +144,7 @@ MsnNotificationConnection::~MsnNotificationConnection() // closeConnection() also cleans up a lot too. #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -156,7 +162,7 @@ MsnNotificationConnection::~MsnNotificationConnection() void MsnNotificationConnection::addContactToGroup(QString handle, QString groupId) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "adding '" << handle << " to '" << groupId << "'."; + kmDebug() << "adding '" << handle << " to '" << groupId << "'."; #endif AddressBookService *addressBook = createAddressBookService(); @@ -186,7 +192,7 @@ void MsnNotificationConnection::addContactToGroup(QString handle, QString groupI void MsnNotificationConnection::addExistingContact( QString handle, const QStringList& groupsId ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Re-adding contact " << handle; + kmDebug() << "Re-adding contact " << handle; #endif Contact *c = contactList_->getContactByHandle( handle ); @@ -216,7 +222,7 @@ void MsnNotificationConnection::addExistingContact( QString handle, const QStrin void MsnNotificationConnection::addNewContact( QString handle, const QStringList& groupsId ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Adding contact " << handle; + kmDebug() << "Adding contact " << handle; #endif AddressBookService *addressBook = createAddressBookService(); @@ -243,7 +249,7 @@ void MsnNotificationConnection::addNewContact( QString handle, const QStringList else { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << handle << "is already on the address book; ignoring."; + kmDebug() << handle << "is already on the address book; ignoring."; #endif return; } @@ -279,7 +285,7 @@ void MsnNotificationConnection::addNewContact( QString handle, const QStringList void MsnNotificationConnection::allowContact(QString handle) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Allowing contact " << handle; + kmDebug() << "Allowing contact " << handle; #endif putAdl( handle, Contact::MSN_LIST_ALLOWED ); @@ -327,7 +333,7 @@ void MsnNotificationConnection::addGroup(QString name) void MsnNotificationConnection::blockContact(QString handle) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Blocking contact " << handle; + kmDebug() << "Blocking contact " << handle; #endif putRml( handle, Contact::MSN_LIST_ALLOWED ); @@ -409,7 +415,7 @@ void MsnNotificationConnection::changeFriendlyName( QString newName ) { if ( newName.trimmed().isEmpty() ) { - kWarning() << "Tried to set an empty friendly name; ignoring."; + kmWarning() << "Tried to set an empty friendly name; ignoring."; return; } @@ -431,7 +437,7 @@ void MsnNotificationConnection::changeFriendlyName( QString newName ) if( !initialStatusSent_ ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Got Roaming friendly name, going online..."; + kmDebug() << "Got Roaming friendly name, going online..."; #endif goOnline(); } @@ -468,7 +474,7 @@ void MsnNotificationConnection::changePersonalProperties( const QString& cid, in void MsnNotificationConnection::changePersonalMessage( QString newMessage ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Changing personal message to " << newMessage; + kmDebug() << "Changing personal message to " << newMessage; #endif lastPsm_ = Qt::escape(newMessage); @@ -537,7 +543,7 @@ void MsnNotificationConnection::changeProperty( QString handle, QString type, QS // Avoid disconnects by the server if( contact->getGuid().isEmpty() ) { - kWarning() << "Can't change property, contact GUID is empty" + kmWarning() << "Can't change property, contact GUID is empty" << " (contact=" << handle << " property=" << type << ")." << endl; return; } @@ -579,7 +585,7 @@ void MsnNotificationConnection::changeStatus( const Status newStatus ) if( newStatus == STATUS_OFFLINE ) { - kWarning() << "Cannot change status to Offline!"; + kmWarning() << "Cannot change status to Offline!"; return; } @@ -623,7 +629,7 @@ void MsnNotificationConnection::checkSwitchboardsTimeout() } #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Removing expired switchboard requests."; + kmDebug() << "Removing expired switchboard requests."; #endif // Delete any pending switchboard @@ -652,15 +658,16 @@ void MsnNotificationConnection::checkSwitchboardsTimeout() void MsnNotificationConnection::closeConnection() { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Close the connection."; + kmDebug() << "Close the connection."; #endif // Disconnect from the server first. // emits the signals so other classes can clean up / save properties. disconnectFromServer(); - // Stop the login timer + // Stop the waiting timers loginTimer_.stop(); + friendlyNameWaitTimer_.stop(); // Delete all SOAP clients, and unset local references here. deleteSoapClients(); @@ -676,7 +683,7 @@ void MsnNotificationConnection::closeConnection() if ( contactList_ != 0 ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Resetting contactlist."; + kmDebug() << "Resetting contactlist."; #endif // Save the contact list settings @@ -723,7 +730,7 @@ AddressBookService* MsnNotificationConnection::createAddressBookService() connect( addressBookService_, SIGNAL( contactAdded( const QString&, const QString&, const QStringList& ) ), this, SLOT( slotContactAdded( const QString&, const QString&, const QStringList& ) ) ); - connect( addressBookService_, SIGNAL( contactDeleted( const QString& ) ), + connect( addressBookService_, SIGNAL( contactDeleted( const QString&, const QString& ) ), this, SLOT( slotContactDeleted( const QString& ) ) ); connect( addressBookService_, SIGNAL( contactBlocked( const QString& ) ), @@ -738,10 +745,10 @@ AddressBookService* MsnNotificationConnection::createAddressBookService() this, SLOT( slotContactDeletedFromGroup( const QString&, const QString& ) ) ); // Group actions signals/slots - connect( addressBookService_, SIGNAL( groupAdded( const QString&, const QString& ) ), + connect( addressBookService_, SIGNAL( groupAdded( const QString&, const QString& ) ), contactList_, SLOT( addGroup( const QString&, const QString& ) ) ); - connect( addressBookService_, SIGNAL( groupDeleted( const QString& ) ), - contactList_, SLOT( removeGroup( const QString& ) ) ); + connect( addressBookService_, SIGNAL( groupDeleted( const QString&, const QString& ) ), + contactList_, SLOT( removeGroup( const QString& ) ) ); connect( addressBookService_, SIGNAL( groupRenamed( const QString&, const QString& ) ), contactList_, SLOT( renameGroup( const QString&, const QString& ) ) ); @@ -758,8 +765,10 @@ AddressBookService* MsnNotificationConnection::createAddressBookService() this, SLOT( changePersonalProperties(const QString&,int) ) ); connect( addressBookService_, SIGNAL( soapWarning(const QString&,bool) ), this, SLOT ( slotWarning(const QString&,bool) ) ); - } + connect( addressBookService_, SIGNAL( addressBookChanged( const QString&, AddressBookService::AddressBookUpdate ) ), + this, SIGNAL( addressBookChanged( const QString&, AddressBookService::AddressBookUpdate ) )); + } return addressBookService_; } @@ -793,7 +802,7 @@ OfflineImService* MsnNotificationConnection::createOfflineImService() #ifdef KMESSDEBUG_NOTIFICATION else { - kWarning() << "Could not parse authentication field:" << field; + kmWarning() << "Could not parse authentication field:" << field; } #endif } @@ -952,7 +961,7 @@ void MsnNotificationConnection::goOnline() if( initialStatusSent_ ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Initial status already sent, skipping call."; + kmDebug() << "Initial status already sent, skipping call."; #endif return; } @@ -961,13 +970,13 @@ void MsnNotificationConnection::goOnline() if( goneOnline_ ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Already gone online, skipping call."; + kmDebug() << "Already gone online, skipping call."; #endif return; } #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Going online!"; + kmDebug() << "Going online!"; #endif // Stop the authentication timer, we're done with that part @@ -985,7 +994,7 @@ void MsnNotificationConnection::goOnline() if( lastStatus_ != -1 && lastStatus_ != STATUS_OFFLINE && lastStatus_ != STATUS_IDLE ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Last status was set:" << MsnStatus::getCode( (Status)lastStatus_ ); + kmDebug() << "Last status was set:" << MsnStatus::getCode( (Status)lastStatus_ ); #endif initialStatus = lastStatus_; lastStatus_ = -1; @@ -996,7 +1005,7 @@ void MsnNotificationConnection::goOnline() // Change to the initial status #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Changing initial status to" << MsnStatus::getCode( (Status)initialStatus ); + kmDebug() << "Changing initial status to" << MsnStatus::getCode( (Status)initialStatus ); #endif changeStatus( (Status)initialStatus ); @@ -1042,7 +1051,7 @@ void MsnNotificationConnection::goOnline() goneOnline_ = true; #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Gone online!"; + kmDebug() << "Gone online!"; #endif } @@ -1061,9 +1070,9 @@ void MsnNotificationConnection::gotAdl( const QStringList& command, const QStrin // We want to wait for the SOAP friendlyname response before we goOnline. // See the docs for goOnline() for more information. #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Scheduling goOnline()...."; + kmDebug() << "Scheduling goOnline()...."; #endif - QTimer::singleShot( 5000, this, SLOT( goOnline() ) ); + friendlyNameWaitTimer_.start(); connected_ = true; } @@ -1101,7 +1110,7 @@ void MsnNotificationConnection::gotAdl( const QStringList& command, const QStrin else { // Else if the contact isn't present, ask to user what he want to do. - kDebug() << "The contact: " << handle << " not present in contact list added user"; + kmDebug() << "The contact: " << handle << " not present in contact list added user"; emit contactAddedUser( handle ); } } @@ -1115,7 +1124,7 @@ void MsnNotificationConnection::gotChg( const QStringList& command ) if(KMESS_NULL(currentAccount_)) return; #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "User's status changed to " << command[2] << "."; + kmDebug() << "User's status changed to " << command[2] << "."; #endif // Change the user's status @@ -1159,7 +1168,7 @@ void MsnNotificationConnection::gotFln( const QStringList& command ) if(KMESS_NULL(contactList_)) return; #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << command[1] << " went offline."; + kmDebug() << command[1] << " went offline."; #endif contactList_->changeContactStatus( command[1].toLower(), STATUS_OFFLINE ); @@ -1184,7 +1193,7 @@ void MsnNotificationConnection::gotIln( const QStringList& command ) Status status = MsnStatus::codeToStatus( command[2] ); #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << handle << " is initially " << command[2] << "."; + kmDebug() << handle << " is initially " << command[2] << "."; #endif // Check if the received MSN object is empty, a "0" (Kopete), or shorter than the string "" @@ -1196,7 +1205,7 @@ void MsnNotificationConnection::gotIln( const QStringList& command ) #ifdef KMESSDEBUG_NOTIFICATION_GENERAL if( ! msnObject.isEmpty() ) { - kDebug() << "This person has an msn6 picture: " << msnObject; + kmDebug() << "This person has an msn6 picture: " << msnObject; } #endif @@ -1251,7 +1260,7 @@ void MsnNotificationConnection::gotNln( const QStringList& command ) } #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << handle << " is now " << MsnStatus::getCode( status ) << "."; + kmDebug() << handle << " is now " << MsnStatus::getCode( status ) << "."; #endif // Update contact status. @@ -1267,7 +1276,7 @@ void MsnNotificationConnection::gotOut( const QStringList& command ) if( command[1] == "OTH" ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Got notice that this account has connected from elsewhere."; + kmDebug() << "Got notice that this account has connected from elsewhere."; #endif // No need to reconnect with the last status if we were kicked out @@ -1279,7 +1288,7 @@ void MsnNotificationConnection::gotOut( const QStringList& command ) else { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Received notice of disconnection from the server."; + kmDebug() << "Received notice of disconnection from the server."; #endif // Save the status, to use it again when reconnecting @@ -1316,7 +1325,7 @@ void MsnNotificationConnection::gotPrp( const QStringList& command ) } else { -// kWarning() << "Received unsupported property name/value: " << propertyName << " " << propertyValue << "!"; +// kmWarning() << "Received unsupported property name/value: " << propertyName << " " << propertyValue << "!"; } } @@ -1353,11 +1362,11 @@ void MsnNotificationConnection::gotRng( const QStringList& command ) quint16 port = (quint16) portString.toUInt( &goodPort ); if( ! goodPort ) { - kWarning() << "Couldn't get port from string " << portString; + kmWarning() << "Couldn't get port from string " << portString; return; } #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << handle << " is requesting a chat at: " + kmDebug() << handle << " is requesting a chat at: " << server << ":" << port << " id=" << chatId << " auth=" << auth; #endif @@ -1371,7 +1380,7 @@ void MsnNotificationConnection::gotRng( const QStringList& command ) void MsnNotificationConnection::gotUbx( const QStringList &command, const QByteArray &payload ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Got UBX information."; + kmDebug() << "Got UBX information."; #endif Contact *contact = contactList_->getContactByHandle( command[1].toLower() ); @@ -1388,8 +1397,8 @@ void MsnNotificationConnection::gotUbx( const QStringList &command, const QByteA QDomDocument xml; if( ! xml.setContent(payload) ) { - kWarning() << "Could not parse personal status message (invalid XML, contact=" << command[1] << ")!"; - kWarning() << "The invalid XML was:" << payload; + kmWarning() << "Could not parse personal status message (invalid XML, contact=" << command[1] << ")!"; + kmWarning() << "The invalid XML was:" << payload; } // Parse payload @@ -1419,7 +1428,7 @@ void MsnNotificationConnection::gotUbx( const QStringList &command, const QByteA if( media[2] != "1" ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "CurrentMedia is set, but not enabled."; + kmDebug() << "CurrentMedia is set, but not enabled."; #endif currentMedia = QString::null; } @@ -1450,7 +1459,7 @@ void MsnNotificationConnection::gotUbx( const QStringList &command, const QByteA void MsnNotificationConnection::gotUrl( const QStringList& command ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Got URL information."; + kmDebug() << "Got URL information."; #endif if(KMESS_NULL(currentAccount_)) return; @@ -1513,7 +1522,7 @@ void MsnNotificationConnection::gotUsr( const QStringList& command ) #ifdef KMESSDEBUG_NOTIFICATION_GENERAL if( ! isVerified ) { - kWarning() << "Passport account of the user is not verified yet."; + kmWarning() << "Passport account of the user is not verified yet."; } #endif @@ -1531,7 +1540,7 @@ void MsnNotificationConnection::gotUsr( const QStringList& command ) } else { - kWarning() << "Received unexpected USR step:" << step; + kmWarning() << "Received unexpected USR step:" << step; } } @@ -1571,24 +1580,24 @@ void MsnNotificationConnection::gotXfr(const QStringList& command) bool goodPort; quint16 port = (quint16) portString.toUInt( &goodPort ); #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Got " << serverType << " transfer to " << server << ":" << port << "."; + kmDebug() << "Got " << serverType << " transfer to " << server << ":" << port << "."; #endif if( ! goodPort ) { - kDebug() << "Got bad port number : " << portString << "."; + kmDebug() << "Got bad port number : " << portString << "."; return; } if( serverType == "NS" ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Disconnecting from old server."; + kmDebug() << "Disconnecting from old server."; #endif // Disconnect from the existing server. disconnectFromServer( true ); #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Connecting to new server."; + kmDebug() << "Connecting to new server."; #endif #ifdef KMESS_NETWORK_WINDOW @@ -1626,14 +1635,14 @@ void MsnNotificationConnection::gotXfr(const QStringList& command) if( switchboardInfo == 0 ) { - kWarning() << "Got an XFR response, but there are no corresponding open requests."; + kmWarning() << "Got an XFR response, but there are no corresponding open requests."; return; } // Update the server information switchboardInfo->setServerInformation( server, port, command[5] ); #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "emitting startSwitchboard() signal."; + kmDebug() << "emitting startSwitchboard() signal."; #endif // Signal the new connection @@ -1788,12 +1797,12 @@ bool MsnNotificationConnection::initialize() { if ( initialized_ ) { - kDebug() << "already initialized!"; + kmDebug() << "already initialized!"; return false; } if ( ! MsnConnection::initialize() ) { - kDebug() << "Couldn't initialize base class."; + kmDebug() << "Couldn't initialize base class."; return false; } @@ -1912,7 +1921,7 @@ void MsnNotificationConnection::loginSucceeded() void MsnNotificationConnection::loginIncorrect() { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Passport login was incorrect."; + kmDebug() << "Passport login was incorrect."; #endif // NOTE: a similar thing also happens in soapRequestFailed(), @@ -1933,7 +1942,7 @@ void MsnNotificationConnection::loginIncorrect() void MsnNotificationConnection::moveContact(QString handle, QString fromGroupId, QString toGroupId) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Moving '" << handle << "' from '" << fromGroupId << "' to '" << toGroupId << "'."; + kmDebug() << "Moving '" << handle << "' from '" << fromGroupId << "' to '" << toGroupId << "'."; #endif AddressBookService *addressBook = createAddressBookService(); @@ -1960,11 +1969,11 @@ void MsnNotificationConnection::moveContact(QString handle, QString fromGroupId, bool MsnNotificationConnection::openConnection() { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Opening connection."; + kmDebug() << "Opening connection."; #endif if ( !initialized_ ) { - kWarning() << "Notification should be initialized before attempting to connect."; + kmWarning() << "Notification should be initialized before attempting to connect."; return false; } @@ -1989,7 +1998,7 @@ bool MsnNotificationConnection::openConnection() connectToServer(); #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Socket started connecting to the server. Started timer."; + kmDebug() << "Socket started connecting to the server. Started timer."; #endif return true; @@ -2001,7 +2010,7 @@ bool MsnNotificationConnection::openConnection() void MsnNotificationConnection::parseCommand( const QStringList& command ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Parsing command '" << command[0] << "'."; + kmDebug() << "Parsing command '" << command[0] << "'."; #endif // Allow some time until the next message is received @@ -2017,7 +2026,7 @@ void MsnNotificationConnection::parseCommand( const QStringList& command ) // If it's not a command, something has went wrong. if( isNumber ) { - kWarning() << "Invalid command received:" << command; + kmWarning() << "Invalid command received:" << command; return; } @@ -2123,7 +2132,7 @@ void MsnNotificationConnection::parseCommand( const QStringList& command ) else { // No need to bugger the common user with strange error messages - kWarning() << "Unknown command" << command[0] << "received from the server! Full string:" << command.join( " " ); + kmWarning() << "Unknown command" << command[0] << "received from the server! Full string:" << command.join( " " ); #ifdef KMESSDEBUG_NOTIFICATION_GENERAL slotError( i18n( "Unknown command received from the server: %1", command[0] ), MsnSocketBase::ERROR_INTERNAL ); #endif @@ -2144,7 +2153,7 @@ void MsnNotificationConnection::parseError( const QStringList& command, const QB if( chatInvite->getTransactionId() == transactionId ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Removing chat invitation from list."; + kmDebug() << "Removing chat invitation from list."; #endif openRequests_.removeAll( chatInvite ); @@ -2165,7 +2174,7 @@ void MsnNotificationConnection::parseMimeMessage( const QStringList& command, co { Q_UNUSED( command ); #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Got " << mainMessage.getSubValue("Content-Type") << "."; + kmDebug() << "Got " << mainMessage.getSubValue("Content-Type") << "."; #endif const QString contentType( mainMessage.getSubValue("Content-Type") ); @@ -2173,7 +2182,7 @@ void MsnNotificationConnection::parseMimeMessage( const QStringList& command, co #ifdef KMESSDEBUG_NOTIFICATION_MESSAGES mainMessage.print(); - kDebug() << "Message body as mime:"; + kmDebug() << "Message body as mime:"; message.print(); #endif @@ -2181,7 +2190,7 @@ void MsnNotificationConnection::parseMimeMessage( const QStringList& command, co if ( contentType == "text/x-msmsgsprofile" ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Load profile information."; + kmDebug() << "Load profile information."; #endif uint externalPort = mainMessage.getValue("ClientPort").toUInt(); externalPort = ((externalPort & 0x00ff) << 8) | ((externalPort & 0xff00) >> 8); // Byte swapped @@ -2227,7 +2236,7 @@ void MsnNotificationConnection::parseMimeMessage( const QStringList& command, co QDomDocument mailData; if( ! mailData.setContent(message.getValue("Mail-Data")) ) { - kWarning() << "Could not parse XML Mail-Data field!"; + kmWarning() << "Could not parse XML Mail-Data field!"; return; } @@ -2237,7 +2246,7 @@ void MsnNotificationConnection::parseMimeMessage( const QStringList& command, co else if ( contentType == "text/x-msmsgsemailnotification" ) { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "An email was received" + kmDebug() << "An email was received" << " from \"" << message.getValue("From") << "\"" << " with the subject \"" << message.getValue("Subject") << "\"" << " in the folder \"" << message.getValue("Dest-Folder") << "\"." << endl; @@ -2300,7 +2309,7 @@ void MsnNotificationConnection::parseMimeMessage( const QStringList& command, co } else { - kWarning() << "Content-Type '" << contentType << "' not reconized, message ignored."; + kmWarning() << "Content-Type '" << contentType << "' not reconized, message ignored."; } } @@ -2320,14 +2329,14 @@ void MsnNotificationConnection::parsePayloadMessage( const QStringList &command, // to disable certain features or possibly block // certain filenames/contents. #ifdef KMESSDEBUG_NOTIFICATION_MESSAGES - kDebug() << "Ignoring security configuration file, message dump follows." << endl << QString::fromUtf8( payload.data(), payload.size() ); + kmDebug() << "Ignoring security configuration file, message dump follows." << endl << QString::fromUtf8( payload.data(), payload.size() ); #endif } else if( command[0] == "NOT" ) { // Ignore "notification" messages coming from MSN Calendar, MSN Alerts, and MSN Mobile. #ifdef KMESSDEBUG_NOTIFICATION_MESSAGES - kDebug() << "Ignoring text event notification, message dump follows." << endl << QString::fromUtf8( payload.data(), payload.size() ); + kmDebug() << "Ignoring text event notification, message dump follows." << endl << QString::fromUtf8( payload.data(), payload.size() ); #endif } else if( command[0] == "ADL" ) @@ -2336,7 +2345,7 @@ void MsnNotificationConnection::parsePayloadMessage( const QStringList &command, } else { - kWarning() << "Unhandled payload command: " << command[0] << "!" + kmWarning() << "Unhandled payload command: " << command[0] << "!" << " (message dump follows)\n" << QString::fromUtf8(payload.data(), payload.size()) << endl; } } @@ -2404,7 +2413,7 @@ void MsnNotificationConnection::receivedMailData( QDomElement mailData ) { // Found an initial email status notification. #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Load initial email information."; + kmDebug() << "Load initial email information."; #endif QDomElement inboxUnread = childNode.namedItem("IU").toElement(); @@ -2412,7 +2421,7 @@ void MsnNotificationConnection::receivedMailData( QDomElement mailData ) if( inboxUnread.isNull() || othersUnread.isNull() ) { - kWarning() << "Reveived email notification, but 'IU' and 'OU' elements are missing!"; + kmWarning() << "Reveived email notification, but 'IU' and 'OU' elements are missing!"; } #ifdef KMESSTEST @@ -2431,12 +2440,12 @@ void MsnNotificationConnection::receivedMailData( QDomElement mailData ) QString messageId( childNode.namedItem("I").toElement().text() ); if( messageId.isEmpty() ) { - kWarning() << "Unable to parse Mail-Data payload, offline-im message-id not found."; + kmWarning() << "Unable to parse Mail-Data payload, offline-im message-id not found."; return; } #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Received offline-IM notification '" << messageId << "'"; + kmDebug() << "Received offline-IM notification '" << messageId << "'"; #endif // Create a SOAP client to request the Offline-IM @@ -2449,7 +2458,7 @@ void MsnNotificationConnection::receivedMailData( QDomElement mailData ) else { // Warn for unsupported tags. - kWarning() << "Unsupported tag '" << childName << "' encountered in Mail-Data payload!"; + kmWarning() << "Unsupported tag '" << childName << "' encountered in Mail-Data payload!"; } } @@ -2480,7 +2489,7 @@ void MsnNotificationConnection::receivedOfflineIm( const QString &messageId, con const QString &runId, int sequenceNum ) { #ifdef KMESSDEBUG_NOTIFICATION - kDebug() << "Received an offline IM message " + kmDebug() << "Received an offline IM message " << "(from=" << from << " runid=" << runId << " sequenceNum=" << sequenceNum << ")" << endl; @@ -2520,7 +2529,7 @@ void MsnNotificationConnection::receivedOfflineIm( const QString &messageId, con if( nextOfflineIm->sequenceNum > sequenceNum ) { #ifdef KMESSDEBUG_NOTIFICATION - kDebug() << "inserted message '" << date << "', #" << sequenceNum << " " + kmDebug() << "inserted message '" << date << "', #" << sequenceNum << " " << "before '" << nextOfflineIm->date << "', #" << nextOfflineIm->sequenceNum << "." << endl; #endif break; @@ -2535,7 +2544,7 @@ void MsnNotificationConnection::receivedOfflineIm( const QString &messageId, con // Remove from pending list if( pendingOfflineImMessages_.removeAll( messageId ) == 0 ) { - kWarning() << "Could not remove " + kmWarning() << "Could not remove " "message '" << messageId << "' from the list!" << endl; } @@ -2544,7 +2553,7 @@ void MsnNotificationConnection::receivedOfflineIm( const QString &messageId, con if( ! pendingOfflineImMessages_.isEmpty() ) { #ifdef KMESSDEBUG_NOTIFICATION - kDebug() << "Requesting the next offline-im message."; + kmDebug() << "Requesting the next offline-im message."; #endif // Not all messages are received yet, request next @@ -2557,7 +2566,7 @@ void MsnNotificationConnection::receivedOfflineIm( const QString &messageId, con // display the messages in the chat windows. #ifdef KMESSDEBUG_NOTIFICATION - kDebug() << "All messages received, displaying messages in chat window."; + kmDebug() << "All messages received, displaying messages in chat window."; #endif const ContactBase *contact = 0; @@ -2694,7 +2703,7 @@ void MsnNotificationConnection::requestSwitchboard( QString handle, ChatInformat // Protect again invalid uses. if( handle.isEmpty() ) { - kWarning() << "no contact handle set!"; + kmWarning() << "no contact handle set!"; return; } @@ -2704,7 +2713,7 @@ void MsnNotificationConnection::requestSwitchboard( QString handle, ChatInformat if( switchboardInfo->getContactHandle() == handle ) { #ifdef KMESSDEBUG_NOTIFICATION - kDebug() << "A pending switchboard for contact " + kmDebug() << "A pending switchboard for contact " << handle << " is already present." << endl; #endif return; @@ -2732,7 +2741,7 @@ void MsnNotificationConnection::requestSwitchboard( QString handle, ChatInformat void MsnNotificationConnection::readProperties() { #ifdef KMESSDEBUG_NOTIFICATION - kDebug() << "Loading properties for the notification connection"; + kmDebug() << "Loading properties for the notification connection"; #endif // Load the contact list's settings @@ -2745,13 +2754,13 @@ void MsnNotificationConnection::readProperties() void MsnNotificationConnection::saveProperties() { #ifdef KMESSDEBUG_NOTIFICATION - kDebug() << "Saving properties for the notification connection"; + kmDebug() << "Saving properties for the notification connection"; #endif // Do not save account properties when it's a temporary account if( currentAccount_->isGuestAccount() ) { - kWarning() << "Requested to save properties, but this is a guest account!"; + kmWarning() << "Requested to save properties, but this is a guest account!"; return; } @@ -2769,7 +2778,7 @@ void MsnNotificationConnection::saveProperties() void MsnNotificationConnection::slotAuthenticationFailed() { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Connection not successful within time limit."; + kmDebug() << "Connection not successful within time limit."; #endif // Bounce back to the unified error handler to give the user a message @@ -2950,7 +2959,7 @@ void MsnNotificationConnection::slotGotMembershipLists( const QString &serviceTy { if( serviceType != "Messenger" ) { - kWarning() << "Unable to parse membership list:" << serviceType; + kmWarning() << "Unable to parse membership list:" << serviceType; return; } @@ -3041,7 +3050,7 @@ void MsnNotificationConnection::unblockContact( QString handle ) void MsnNotificationConnection::slotConnected() { #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Connected to server, sending VER."; + kmDebug() << "Connected to server, sending VER."; #endif // Start the login timer, allowing the defined maximum time between each @@ -3065,7 +3074,7 @@ void MsnNotificationConnection::slotConnected() */ void MsnNotificationConnection::slotError( QString error, MsnSocketBase::ErrorType type ) { - kWarning() << "MSN Notification Connection error type" << type << ":" << error; + kmWarning() << "MSN Notification Connection error type" << type << ":" << error; QString message; QString additionalInfo; @@ -3125,7 +3134,7 @@ void MsnNotificationConnection::slotError( QString error, MsnSocketBase::ErrorTy lastStatus_ = lastStatus; #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Changed the lastStatus to " << MsnStatus::getCode( (Status)lastStatus_ ); + kmDebug() << "Changed the lastStatus to " << MsnStatus::getCode( (Status)lastStatus_ ); #endif // Then decide what kind of message to show @@ -3259,7 +3268,7 @@ void MsnNotificationConnection::slotError( QString error, MsnSocketBase::ErrorTy QMap details; details[ "errorType" ] = (int) type; details[ "errorString" ] = error; - details[ "detailedMessage" ] = detailedMessage; + details[ "detailedMessage" ] = "" + detailedMessage + ""; NotificationManager::EventSettings settings; settings.sender = this; @@ -3269,7 +3278,7 @@ void MsnNotificationConnection::slotError( QString error, MsnSocketBase::ErrorTy settings.data = details; // Notify the user about the network error - NotificationManager::instance()->notify( "status", message, settings ); + NotificationManager::instance()->notify( "status", "" + message + "", settings ); } // Try connecting again @@ -3298,7 +3307,7 @@ void MsnNotificationConnection::slotErrorEventActivated( NotificationManager::Ev { case NotificationManager::BUTTON_MORE_DETAILS: #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Showing error details"; + kmDebug() << "Showing error details"; #endif #ifdef KMESSDEBUG_NOTIFICATION_GENERAL @@ -3331,14 +3340,14 @@ void MsnNotificationConnection::slotErrorEventActivated( NotificationManager::Ev case NotificationManager::BUTTON_HIDE: #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Hiding status notification"; + kmDebug() << "Hiding status notification"; #endif // Do nothing break; default: #ifdef KMESSDEBUG_NOTIFICATION_GENERAL - kDebug() << "Invalid button" << button; + kmDebug() << "Invalid button" << button; #endif return; } diff --git a/src/network/msnnotificationconnection.h b/src/network/msnnotificationconnection.h index 7cc9fb4..8cb97db 100644 --- a/src/network/msnnotificationconnection.h +++ b/src/network/msnnotificationconnection.h @@ -20,6 +20,7 @@ #include "../contact/msnstatus.h" #include "../notification/notificationmanager.h" +#include "../network/soap/addressbookservice.h" #include "chatinformation.h" #include "msnconnection.h" @@ -43,7 +44,6 @@ class AddressBookService; class RoamingService; - /** * @brief The primary connection to the MSN server. * @@ -276,8 +276,7 @@ class MsnNotificationConnection : public MsnConnection void slotAuthenticationFailed(); // Unlock notifications after the first seconds of connections void unlockNotifications(); - - // Contact added, notify it to contactlist + // Contact added, notify it to contactlist void slotContactAdded( const QString &handle, const QString &contactId, const QStringList &groupsId ); // Contact added to group @@ -300,7 +299,7 @@ class MsnNotificationConnection : public MsnConnection private: // Private attributes - // The address book service + // The address book service AddressBookService *addressBookService_; bool connected_; // Nonce received by the server on first SSO command @@ -356,6 +355,8 @@ class MsnNotificationConnection : public MsnConnection QTimer loginTimer_; // A timer used to unlock notifications after the last ILN is received. QTimer notificationUnlockTimer_; + // A timer to login directly if the SOAP requests take too long. + QTimer friendlyNameWaitTimer_; // The received offline messages. QList offlineImMessages_; // The Offline-IM SOAP client @@ -385,6 +386,8 @@ class MsnNotificationConnection : public MsnConnection void reconnect( QString handle ); // A new switchboard with a contact has been opened void startSwitchboard( const ChatInformation &chatInfo ); + // Signal that a change has occurred in the AB (contact add/remove/delete, etc) + void addressBookChanged( const QString &id, AddressBookService::AddressBookUpdate update ); }; diff --git a/src/network/msnsocketbase.cpp b/src/network/msnsocketbase.cpp index c5a2a06..d79dbf5 100644 --- a/src/network/msnsocketbase.cpp +++ b/src/network/msnsocketbase.cpp @@ -115,8 +115,8 @@ bool MsnSocketBase::isPayloadCommand( const QString &command ) const void MsnSocketBase::proxyAuthenticate( const QNetworkProxy &proxy, QAuthenticator *authenticator ) { #ifdef KMESSDEBUG_SHARED_PROXY_AUTH - kDebug() << "Authentication to proxy" << proxy.hostName() << "required."; - kDebug() << "Realm:" << authenticator->realm() << "Username:" << authenticator->user(); + kmDebug() << "Authentication to proxy" << proxy.hostName() << "required."; + kmDebug() << "Realm:" << authenticator->realm() << "Username:" << authenticator->user(); #else Q_UNUSED( proxy ); #endif diff --git a/src/network/msnsockethttp.cpp b/src/network/msnsockethttp.cpp index 714e2dc..3d39638 100644 --- a/src/network/msnsockethttp.cpp +++ b/src/network/msnsockethttp.cpp @@ -111,7 +111,7 @@ MsnSocketHttp::~MsnSocketHttp() delete http_; #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "DESTROYED"; + kmDebug() << "DESTROYED"; #endif } @@ -167,7 +167,7 @@ void MsnSocketHttp::connectToServer( const QString& server, const quint16 port ) #endif #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Connecting to server at " << desiredAddress << ":" << DEFAULT_GATEWAY_PORT << "."; + kmDebug() << "Connecting to server at " << desiredAddress << ":" << DEFAULT_GATEWAY_PORT << "."; #endif // Set up the gateway where to send our messages @@ -180,7 +180,7 @@ void MsnSocketHttp::connectToServer( const QString& server, const quint16 port ) case SERVER_NOTIFICATION: serverType = "NS"; break; case SERVER_SWITCHBOARD: serverType = "SB"; break; default: - kWarning() << "Unknown type of server" << serverType_ << "!"; + kmWarning() << "Unknown type of server" << serverType_ << "!"; return; } @@ -234,7 +234,7 @@ void MsnSocketHttp::disconnectFromServer( bool isTransfer ) if( ! queuedRequests_.isEmpty() ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Sending" << queuedRequests_.count() << "remaining requests before closing."; + kmDebug() << "Sending" << queuedRequests_.count() << "remaining requests before closing."; #endif QNetworkRequest request( requestHeader_ ); @@ -263,7 +263,7 @@ void MsnSocketHttp::disconnectFromServer( bool isTransfer ) queuedRequests_.takeFirst(); } #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Merged" << mergedRequests << "requests out from the queue."; + kmDebug() << "Merged" << mergedRequests << "requests out from the queue."; #endif // Set up the header @@ -297,9 +297,9 @@ void MsnSocketHttp::disconnectFromServer( bool isTransfer ) #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP if( http_->currentId() != 0 && ! pollingTimer_.isActive() ) { - kDebug() << "Could not send the last request within timeout."; + kmDebug() << "Could not send the last request within timeout."; #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP_DUMPS - kDebug() << "Full dump:" << endl + kmDebug() << "Full dump:" << endl << header.toString() << QString::fromUtf8( data ); #endif @@ -318,7 +318,7 @@ void MsnSocketHttp::disconnectFromServer( bool isTransfer ) } #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Emitting disconnection signal."; + kmDebug() << "Emitting disconnection signal."; #endif emit disconnected(); @@ -333,32 +333,32 @@ void MsnSocketHttp::dump( void *obj, QByteArray data, bool isRequest ) if( isRequest ) { QNetworkRequest *request = (QNetworkRequest *)obj; - kDebug() << "-- Request dump below --" << endl + kmDebug() << "-- Request dump below --" << endl << "URL:" << request->url() << endl << "Contents:" << QString::fromUtf8( data ); int i = 1; - kDebug() << request->rawHeaderList().size() << "header items present:"; + kmDebug() << request->rawHeaderList().size() << "header items present:"; foreach( const QByteArray &headerName, request->rawHeaderList() ) { - kDebug() << "(" << i++ << ")" << headerName << ": " << request->rawHeader( headerName ); + kmDebug() << "(" << i++ << ")" << headerName << ": " << request->rawHeader( headerName ); } - kDebug() << "-- Request dump above --"; + kmDebug() << "-- Request dump above --"; } else { QNetworkReply *reply = (QNetworkReply *)obj; - kDebug() << "-- Reply dump below --" << endl + kmDebug() << "-- Reply dump below --" << endl << "URL:" << reply->url() << endl << "Contents:" << QString::fromUtf8( data ); int i = 1; - kDebug() << reply->rawHeaderList().size() << "header items present:"; + kmDebug() << reply->rawHeaderList().size() << "header items present:"; foreach( const QByteArray &headerName, reply->rawHeaderList() ) { - kDebug() << "(" << i++ << ")" << headerName << ": " << reply->rawHeader( headerName ); + kmDebug() << "(" << i++ << ")" << headerName << ": " << reply->rawHeader( headerName ); } - kDebug() << "-- Reply dump above --"; + kmDebug() << "-- Reply dump above --"; } #else Q_UNUSED( obj ); @@ -401,14 +401,31 @@ void MsnSocketHttp::sendNextRequest() return; } - QTime now( QTime::currentTime() ); + QDateTime now( QDateTime::currentDateTime() ); // Do not send messages too fast, or the server will ignore them - int elapsedMsecs = lastRequestTime_.msecsTo( now ); + qint64 elapsedMsecs; +#if QT_VERSION >= 0x040700 + elapsedMsecs = lastRequestTime_.msecsTo( now ); +#else + // Workaround: adapted code of QDateTime::msecsTo() since it's only in Qt 4.7+ + // Snippet licensed LGPL 2.1, copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + elapsedMsecs = ( static_cast( lastRequestTime_.date().daysTo( now.date() ) ) + * static_cast( 86400000/*MSECS_PER_DAY*/ ) ) + + static_cast( lastRequestTime_.time().msecsTo( now.time() ) ); +#endif + + // Fix clock skews + if( elapsedMsecs < 0 ) + { + lastRequestTime_ = now; + elapsedMsecs = 0; + } + if( elapsedMsecs <= 1000 ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Not sending another message in" << elapsedMsecs << "more milliseconds."; + kmDebug() << "Not sending another message in" << elapsedMsecs << "more milliseconds."; #endif // The polling method will call this method back @@ -463,7 +480,7 @@ void MsnSocketHttp::sendNextRequest() queuedRequests_.takeFirst(); } #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Merged" << mergedRequests << "requests out from the queue."; + kmDebug() << "Merged" << mergedRequests << "requests out from the queue."; #endif // Set up the header @@ -491,7 +508,7 @@ void MsnSocketHttp::sendNextRequest() http_->post( request, data ); #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Sent a request. Queue size now:" << queuedRequests_.size(); + kmDebug() << "Sent a request. Queue size now:" << queuedRequests_.size(); #endif #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP_DUMPS dump( &request, data, true ); @@ -519,7 +536,7 @@ void MsnSocketHttp::sendNextRequest() void MsnSocketHttp::setGateway( QString host ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Using server at" << host << ":" << DEFAULT_GATEWAY_PORT << "as gateway."; + kmDebug() << "Using server at" << host << ":" << DEFAULT_GATEWAY_PORT << "as gateway."; #endif // Save the server address to use in our requests @@ -624,7 +641,7 @@ void MsnSocketHttp::slotReplyReceived( QNetworkReply *reply ) if( ! connected_ ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Disconnected, ignoring reply."; + kmDebug() << "Disconnected, ignoring reply."; #endif #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP_DUMPS dump( reply, reply->readAll(), false ); @@ -647,7 +664,7 @@ void MsnSocketHttp::slotReplyReceived( QNetworkReply *reply ) // some HTTP redirection happening, like an authentication web page (e.g. web-based login proxy) if( reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt() != 200 || ! hasMsnHeader ) { - kWarning() << "Received a type" << reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt() + kmWarning() << "Received a type" << reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt() << "response."; #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP_DUMPS dump( reply, responseData, false ); @@ -754,7 +771,7 @@ void MsnSocketHttp::slotReplyReceived( QNetworkReply *reply ) if( ! gatewayAddress_.contains( value ) ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Switching gateways:" << gatewayAddress_ << "->" << value; + kmDebug() << "Switching gateways:" << gatewayAddress_ << "->" << value; #endif setGateway( value ); } @@ -767,7 +784,7 @@ void MsnSocketHttp::slotReplyReceived( QNetworkReply *reply ) if( value == "close" && connected_ ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Received disconnection command"; + kmDebug() << "Received disconnection command"; #endif cleanUp(); @@ -777,7 +794,7 @@ void MsnSocketHttp::slotReplyReceived( QNetworkReply *reply ) else { #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Unknown attribute received in the MSN Header:" << item; + kmDebug() << "Unknown attribute received in the MSN Header:" << item; #endif } } @@ -873,7 +890,7 @@ qint64 MsnSocketHttp::writeBinaryData( const QByteArray &data ) { if( ! connected_ ) { - kWarning() << "Attempted to write data to a disconnected interface, aborting."; + kmWarning() << "Attempted to write data to a disconnected interface, aborting."; return -1; } @@ -896,7 +913,7 @@ qint64 MsnSocketHttp::writeBinaryData( const QByteArray &data ) queuedRequests_.append( newRequest ); #ifdef KMESSDEBUG_CONNECTION_SOCKET_HTTP - kDebug() << "Queued a new request"; + kmDebug() << "Queued a new request"; #endif // Try to immediately send the new message, if possible diff --git a/src/network/msnsockethttp.h b/src/network/msnsockethttp.h index f776704..6ece6dc 100644 --- a/src/network/msnsockethttp.h +++ b/src/network/msnsockethttp.h @@ -131,7 +131,7 @@ class MsnSocketHttp : public MsnSocketBase // State variable to detect whether it's possible or not to send another request bool canSendRequests_; // Time at which the last request has been sent - QTime lastRequestTime_; + QDateTime lastRequestTime_; // Saved gateway address QString gatewayAddress_; // The HTTP interface diff --git a/src/network/msnsockettcp.cpp b/src/network/msnsockettcp.cpp index 0bcd985..84d22e2 100644 --- a/src/network/msnsockettcp.cpp +++ b/src/network/msnsockettcp.cpp @@ -120,7 +120,7 @@ MsnSocketTcp::~MsnSocketTcp() delete socket_; #ifdef KMESSDEBUG_CONNECTION_SOCKET_TCP - kDebug() << "DESTROYED"; + kmDebug() << "DESTROYED"; #endif } @@ -164,8 +164,8 @@ void MsnSocketTcp::connectToServer( const QString& server, const quint16 port ) #endif #ifdef KMESSDEBUG_CONNECTION_SOCKET_TCP - kDebug() << "Connecting to server at " << desiredServer << ":" << desiredPort << "."; - kDebug() << "Socket state is " << socket_->state() << "."; + kmDebug() << "Connecting to server at " << desiredServer << ":" << desiredPort << "."; + kmDebug() << "Socket state is " << socket_->state() << "."; #endif // Flush any pending data if the socket is closing a previous connection @@ -175,7 +175,7 @@ void MsnSocketTcp::connectToServer( const QString& server, const quint16 port ) // Check if we are disconnected (the socket is idle) if( socket_->state() != QAbstractSocket::UnconnectedState ) { - kWarning() << "Socket is not disconnected. Already connected? The socket is in state" << socket_->state() << "."; + kmWarning() << "Socket is not disconnected. Already connected? The socket is in state" << socket_->state() << "."; } // Prepare state vars for the new connection @@ -215,7 +215,7 @@ void MsnSocketTcp::disconnectFromServer( bool isTransfer ) connectionTimer_.stop(); #ifdef KMESSDEBUG_CONNECTION_SOCKET_TCP - kDebug() << "Close the socket."; + kmDebug() << "Close the socket."; #endif // Disconnect the socket @@ -237,7 +237,7 @@ void MsnSocketTcp::disconnectFromServer( bool isTransfer ) } #ifdef KMESSDEBUG_CONNECTION_SOCKET_TCP - kDebug() << "Emitting disconnection signal."; + kmDebug() << "Emitting disconnection signal."; #endif emit disconnected(); @@ -340,7 +340,7 @@ void MsnSocketTcp::slotDisconnected() void MsnSocketTcp::slotHostFound() { #ifdef KMESSDEBUG_CONNECTION_SOCKET_TCP - kDebug() << "Server host address found."; + kmDebug() << "Server host address found."; #endif // Restart the connection timer, to watch over the actual connection establishment. @@ -359,7 +359,7 @@ void MsnSocketTcp::slotHostFound() void MsnSocketTcp::slotLoginFailed() { #ifdef KMESSDEBUG_CONNECTION_SOCKET_TCP - kDebug() << "Connection not successful within time limit."; + kmDebug() << "Connection not successful within time limit."; #endif // Bounce back to the unified error handler to give the user a message @@ -513,7 +513,7 @@ void MsnSocketTcp::slotSocketDataReceived() void MsnSocketTcp::slotSocketError( QAbstractSocket::SocketError errorCode ) { #ifdef KMESSDEBUG_CONNECTION_SOCKET_TCP - kWarning() << "Received error" << errorCode << "from the socket" + kmWarning() << "Received error" << errorCode << "from the socket" "(socket state=" << socket_->state() << ")."; #endif @@ -566,7 +566,7 @@ qint64 MsnSocketTcp::writeBinaryData( const QByteArray &data ) if( ! isConnected() ) { - kWarning() << "Attempted to write data to a disconnected socket, aborting."; + kmWarning() << "Attempted to write data to a disconnected socket, aborting."; return -1; } @@ -574,7 +574,7 @@ qint64 MsnSocketTcp::writeBinaryData( const QByteArray &data ) noBytesWritten = socket_->write( data.data(), data.size() ); if ( noBytesWritten != data.size() ) { - kWarning() << "Wanted to write " << data.size() << " bytes to the socket, wrote " << noBytesWritten << "."; + kmWarning() << "Wanted to write " << data.size() << " bytes to the socket, wrote " << noBytesWritten << "."; } return noBytesWritten; @@ -589,7 +589,7 @@ qint64 MsnSocketTcp::writeData( const QString &data ) if( ! isConnected() ) { - kWarning() << "Attempted to write data to a disconnected socket, aborting."; + kmWarning() << "Attempted to write data to a disconnected socket, aborting."; return -1; } @@ -598,7 +598,7 @@ qint64 MsnSocketTcp::writeData( const QString &data ) noBytesWritten = socket_->write( binData.data(), binData.length() ); if( noBytesWritten != binData.size() ) { - kWarning() << "Wanted to write " << binData.size() << " bytes to the socket, wrote " << noBytesWritten << "."; + kmWarning() << "Wanted to write " << binData.size() << " bytes to the socket, wrote " << noBytesWritten << "."; } return noBytesWritten; diff --git a/src/network/msnswitchboardconnection.cpp b/src/network/msnswitchboardconnection.cpp index ec19c47..8560b88 100644 --- a/src/network/msnswitchboardconnection.cpp +++ b/src/network/msnswitchboardconnection.cpp @@ -97,7 +97,7 @@ MsnSwitchboardConnection::MsnSwitchboardConnection( const MsnSwitchboardConnecti offlineImService_(0) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "entering copy constructor"; + kmDebug() << "entering copy constructor"; #endif setObjectName("MsnSwitchboardConnection"); @@ -109,7 +109,7 @@ MsnSwitchboardConnection::MsnSwitchboardConnection( const MsnSwitchboardConnecti MsnSwitchboardConnection::~MsnSwitchboardConnection() { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "entering destructor"; + kmDebug() << "entering destructor"; #endif // Close the connection @@ -121,7 +121,7 @@ MsnSwitchboardConnection::~MsnSwitchboardConnection() emit deleteMe( this ); #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -165,7 +165,7 @@ void MsnSwitchboardConnection::activity() keepAliveTimer_->start( 50000 ); #ifdef KMESSDEBUG_SWITCHBOARD_KEEPALIVE - kDebug() << ( backgroundConnection_ ? "Background" : "Chatting" ) + kmDebug() << ( backgroundConnection_ ? "Background" : "Chatting" ) << "keepalive session restarted." << endl; #endif } @@ -215,7 +215,7 @@ void MsnSwitchboardConnection::cleanUnackedMessages() if( join.isEmpty() ) join += ","; join += QString::number( key ); } - kDebug() << "removing expired messages " << join << "."; + kmDebug() << "removing expired messages " << join << "."; #endif foreach( int key, removeAcks ) @@ -226,7 +226,7 @@ void MsnSwitchboardConnection::cleanUnackedMessages() #ifdef KMESSDEBUG_SWITCHBOARD_ACKS - kDebug() << "removed " << ( mapCount - unAckedMessages_.size() ) << " messages, " + kmDebug() << "removed " << ( mapCount - unAckedMessages_.size() ) << " messages, " << "kept " << unAckedMessages_.size() << " messages until those expire." << endl; #endif } @@ -269,7 +269,7 @@ void MsnSwitchboardConnection::closeConnection() if( isConnected() ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Still connected, closing the connection."; + kmDebug() << "Still connected, closing the connection."; #endif disconnectFromServer(); @@ -287,7 +287,7 @@ void MsnSwitchboardConnection::closeConnection() } #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Session ended."; + kmDebug() << "Session ended."; #endif } @@ -297,7 +297,7 @@ void MsnSwitchboardConnection::closeConnection() void MsnSwitchboardConnection::closeConnectionLater( bool autoDelete ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "aborting applications nicely and closing connection."; + kmDebug() << "aborting applications nicely and closing connection."; #endif ContactBase *contact; @@ -369,7 +369,7 @@ void MsnSwitchboardConnection::closeConnectionLater( bool autoDelete ) void MsnSwitchboardConnection::contactJoined( const QString& handle, const QString& friendlyName, const uint capabilities ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Contact " << handle << " has joined."; + kmDebug() << "Contact " << handle << " has joined."; #endif // Update states @@ -385,7 +385,7 @@ void MsnSwitchboardConnection::contactJoined( const QString& handle, const QStri if( keepAliveTimer_ && contactsInChat_.count() > 1 ) { #ifdef KMESSDEBUG_SWITCHBOARD_KEEPALIVE - kDebug() << "Starting group chat: stopping keepalive session." << endl; + kmDebug() << "Starting group chat: stopping keepalive session." << endl; #endif keepAliveTimer_->stop(); delete keepAliveTimer_; @@ -425,7 +425,7 @@ void MsnSwitchboardConnection::contactLeft(const QString& handle) KMESS_ASSERT( connectionState_ == SB_CHAT_STARTED ); #endif #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Contact " << handle << " has left."; + kmDebug() << "Contact " << handle << " has left."; #endif // Check if the contact is in the chat.. @@ -438,7 +438,7 @@ void MsnSwitchboardConnection::contactLeft(const QString& handle) } #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "emitting that '" << handle << "' left chat."; + kmDebug() << "emitting that '" << handle << "' left chat."; #endif // Start the keep-alive timer again when ending a group chat @@ -467,7 +467,7 @@ void MsnSwitchboardConnection::contactLeft(const QString& handle) #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL else { - kDebug() << "Not sending contactLeftChat() signal for background chats."; + kmDebug() << "Not sending contactLeftChat() signal for background chats."; } #endif @@ -485,7 +485,7 @@ void MsnSwitchboardConnection::contactLeft(const QString& handle) // sentEmoticons_.clear(); #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "last contact left chat, closing connection."; + kmDebug() << "last contact left chat, closing connection."; #endif // No contacts left in the chat, close connection since it is of little use. // - the connection can still be used to 'CAL' the last contact again @@ -609,7 +609,7 @@ void MsnSwitchboardConnection::gotAck( const QStringList& command ) int ackNumber = command[1].toUInt(); if( ! unAckedMessages_.contains( ackNumber ) ) { - kWarning() << "Received an ACK message but message is not in sent queue."; + kmWarning() << "Received an ACK message but message is not in sent queue."; return; } @@ -617,7 +617,7 @@ void MsnSwitchboardConnection::gotAck( const QStringList& command ) acksPending_--; #ifdef KMESSDEBUG_SWITCHBOARD_ACKS - kDebug() << "Received one ACK message, still " << acksPending_ << " unacked."; + kmDebug() << "Received one ACK message, still " << acksPending_ << " unacked."; #endif // Signal that the switchboard is no longer busy and can accept new application messages. @@ -684,7 +684,7 @@ void MsnSwitchboardConnection::gotNak( const QStringList& command ) int ackNumber = command[1].toUInt(); if( ! unAckedMessages_.contains( ackNumber ) ) { - kWarning() << "Received a NAK message but message is not in sent queue."; + kmWarning() << "Received a NAK message but message is not in sent queue."; return; } @@ -695,7 +695,7 @@ void MsnSwitchboardConnection::gotNak( const QStringList& command ) acksPending_--; #ifdef KMESSDEBUG_SWITCHBOARD_ACKS - kDebug() << "Received one NAK message, still " << acksPending_ << " unacked."; + kmDebug() << "Received one NAK message, still " << acksPending_ << " unacked."; #endif @@ -710,7 +710,7 @@ void MsnSwitchboardConnection::gotNak( const QStringList& command ) if( backgroundConnection_ ) { #ifdef KMESSDEBUG_SWITCHBOARD_ACKS - kDebug() << "Not displaying undelivered message for background chats."; + kmDebug() << "Not displaying undelivered message for background chats."; #endif return; } @@ -727,7 +727,7 @@ void MsnSwitchboardConnection::gotNak( const QStringList& command ) #ifdef KMESSDEBUG_SWITCHBOARD_ACKS else { - kDebug() << "Received notice of undelivered message for all contacts."; + kmDebug() << "Received notice of undelivered message for all contacts."; } #endif @@ -739,7 +739,7 @@ void MsnSwitchboardConnection::gotNak( const QStringList& command ) && ! contentType.startsWith( "application/x-ms-ink" ) ) { #ifdef KMESSDEBUG_SWITCHBOARD_ACKS - kDebug() << "Not displaying undelivered message for a service message of type" << contentType; + kmDebug() << "Not displaying undelivered message for a service message of type" << contentType; #endif return; } @@ -752,7 +752,7 @@ void MsnSwitchboardConnection::gotNak( const QStringList& command ) if( ! sender.isEmpty() ) { #ifdef KMESSDEBUG_SWITCHBOARD_ACKS - kDebug() << "Signaling sending failure for contact" << sender; + kmDebug() << "Signaling sending failure for contact" << sender; #endif ContactBase *contact = CurrentAccount::instance()->getContactByHandle( sender ); if( KMESS_NULL(contact) ) @@ -768,7 +768,7 @@ void MsnSwitchboardConnection::gotNak( const QStringList& command ) else { #ifdef KMESSDEBUG_SWITCHBOARD_ACKS - kDebug() << "Signaling sending failure for all participants"; + kmDebug() << "Signaling sending failure for all participants"; #endif // The message couldn't be delivered to any of the recipients: // let the user know that the message wasn't delivered, @@ -783,7 +783,7 @@ void MsnSwitchboardConnection::gotNak( const QStringList& command ) void MsnSwitchboardConnection::gotOut(const QStringList& /*command*/) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Switchboard - got OUT."; + kmDebug() << "Switchboard - got OUT."; #endif closeConnection(); @@ -802,12 +802,12 @@ void MsnSwitchboardConnection::gotUsr(const QStringList& command) // This should just be a confirmation if ( command[2] != "OK" ) { - kWarning() << "Switchboard authentication failed"; + kmWarning() << "Switchboard authentication failed"; return; } #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "authentication successful, inviting " << firstContact_; + kmDebug() << "authentication successful, inviting " << firstContact_; #endif connectionState_ = SB_INVITING_CONTACTS; @@ -833,12 +833,12 @@ bool MsnSwitchboardConnection::initialize( QString handle ) { if ( initialized_ ) { - kDebug() << "already initialized!"; + kmDebug() << "already initialized!"; return false; } if ( ! MsnConnection::initialize() ) { - kDebug() << "Couldn't initialize base class."; + kmDebug() << "Couldn't initialize base class."; return false; } @@ -873,7 +873,7 @@ void MsnSwitchboardConnection::inviteContact( const QString& handle ) pendingInvitations_.append( handle ); #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Added pending invitation for contact " << handle; + kmDebug() << "Added pending invitation for contact " << handle; #endif return; @@ -882,7 +882,7 @@ void MsnSwitchboardConnection::inviteContact( const QString& handle ) if ( backgroundConnection_ ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Chat is still in the background, requesting chat window."; + kmDebug() << "Chat is still in the background, requesting chat window."; #endif backgroundConnection_ = false; @@ -892,7 +892,7 @@ void MsnSwitchboardConnection::inviteContact( const QString& handle ) sendCommand( "CAL", handle ); #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Invited contact " << handle; + kmDebug() << "Invited contact " << handle; #endif } @@ -902,8 +902,8 @@ void MsnSwitchboardConnection::inviteContact( const QString& handle ) bool MsnSwitchboardConnection::isContactInChat( const QString& handle ) const { #ifdef KMESSDEBUG_SWITCHBOARD_CONTACTS - kDebug() << "Checking handle " << handle << " - participants are: " << contactsInChat_.join(",") << " - lastContact: " << lastContact_; - kDebug() << "returning " << ( ( (contactsInChat_.count() == 0) ? (lastContact_ == handle) : (contactsInChat_.contains( handle )) ) ? "true" : "false" ); + kmDebug() << "Checking handle " << handle << " - participants are: " << contactsInChat_.join(",") << " - lastContact: " << lastContact_; + kmDebug() << "returning " << ( ( (contactsInChat_.count() == 0) ? (lastContact_ == handle) : (contactsInChat_.contains( handle )) ) ? "true" : "false" ); #endif return ( (contactsInChat_.count() == 0) ? (lastContact_ == handle) : (contactsInChat_.contains( handle )) ); @@ -933,7 +933,7 @@ bool MsnSwitchboardConnection::isEmpty() const bool MsnSwitchboardConnection::isExclusiveChatWithContact(const QString& handle) const { #ifdef KMESSDEBUG_SWITCHBOARD_CONTACTS - kDebug() << "Checking if chat is exclusive with " << handle + kmDebug() << "Checking if chat is exclusive with " << handle << " (contacts=" << contactsInChat_.join(",") << ", lastContact=" << lastContact_ << ")" << endl; #endif @@ -945,7 +945,7 @@ bool MsnSwitchboardConnection::isExclusiveChatWithContact(const QString& handle) || ( count == 0 && lastContact_ == handle); #ifdef KMESSDEBUG_SWITCHBOARD_CONTACTS - kDebug() << "returning " << ( result ? "true" : "false" ); + kmDebug() << "returning " << ( result ? "true" : "false" ); #endif return result; @@ -1019,7 +1019,7 @@ void MsnSwitchboardConnection::parseCommand(const QStringList& command) } else { - kDebug() << "got unhandled command " << command[0] << " (contacts=" << contactsInChat_ << ")."; + kmDebug() << "got unhandled command " << command[0] << " (contacts=" << contactsInChat_ << ")."; } } @@ -1041,7 +1041,7 @@ void MsnSwitchboardConnection::parseChatMessage( const QString &contactHandle, c } #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Got message by " << contactHandle << ": " << message.getBody(); + kmDebug() << "Got message by " << contactHandle << ": " << message.getBody(); #endif // Get the font and color from the format string @@ -1076,7 +1076,7 @@ void MsnSwitchboardConnection::parseChatMessage( const QString &contactHandle, c void MsnSwitchboardConnection::parseClientCapsMessage( const QString &contactHandle, const MimeMessage &message ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Got third-party client info message. (message dump follows)" << endl + kmDebug() << "Got third-party client info message. (message dump follows)" << endl << message.getMessage().data() << endl; #endif @@ -1112,14 +1112,14 @@ void MsnSwitchboardConnection::parseDatacastMessage( const QString &contactHandl int dataType = message.getValue( "ID" ).toInt(); #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Parsing datacast message (ID=" << dataType << ")"; + kmDebug() << "Parsing datacast message (ID=" << dataType << ")"; #endif // Request a chat window when the chat is still in the background. if( backgroundConnection_ ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "chat is still in the background, requesting chat window."; + kmDebug() << "chat is still in the background, requesting chat window."; #endif backgroundConnection_ = false; emit requestChatWindow( this ); @@ -1135,7 +1135,7 @@ void MsnSwitchboardConnection::parseDatacastMessage( const QString &contactHandl case 2: // A wink #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Datacast message contains an msn object (wink), signalling ChatMaster to download it."; + kmDebug() << "Datacast message contains an msn object (wink), signalling ChatMaster to download it."; #endif // A wink from a contact @@ -1144,21 +1144,21 @@ void MsnSwitchboardConnection::parseDatacastMessage( const QString &contactHandl case 4: // An action message // Not supported yet - kDebug() << "Received unhandled action message from contact" << contactHandle; + kmDebug() << "Received unhandled action message from contact" << contactHandle; emit showWarning( WARNING_UNSUPPORTED_ACTIONMESSAGE, contact ); break; case 3: // A voice clip // Not supported yet - kDebug() << "Received unhandled voice clip from contact" << contactHandle; + kmDebug() << "Received unhandled voice clip from contact" << contactHandle; emit showWarning( WARNING_UNSUPPORTED_VOICECLIP, contact ); break; default: // Completely unknown message type // Not supported yet - kDebug() << "Received unhandled datacast message (ID" << dataType << ") from contact" << contactHandle << ":"; + kmDebug() << "Received unhandled datacast message (ID" << dataType << ") from contact" << contactHandle << ":"; message.print(); // So that we may discover what it is emit showWarning( WARNING_UNSUPPORTED_UNKNOWN, contact ); @@ -1176,14 +1176,14 @@ void MsnSwitchboardConnection::parseEmoticonMessage( const QString &contactHandl if( KMESS_NULL(contact) ) return; #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Received custom emoticon list for " << contactHandle << "."; + kmDebug() << "Received custom emoticon list for " << contactHandle << "."; #endif // Request a chat window when the chat is still in the background. if( backgroundConnection_ ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Chat is still in the background, requesting chat window."; + kmDebug() << "Chat is still in the background, requesting chat window."; #endif backgroundConnection_ = false; emit requestChatWindow( this ); @@ -1207,7 +1207,7 @@ void MsnSwitchboardConnection::parseEmoticonMessage( const QString &contactHandl // If the number of fields is odd, this custom emoticons list contains errors. if( it == msnObjects.end() ) { - kWarning() << "Emoticon message has an unexpected format: odd number of fields! " + kmWarning() << "Emoticon message has an unexpected format: odd number of fields! " << "(ignoring msnobject, contact=" << contactHandle << ")." << endl; break; } @@ -1217,13 +1217,13 @@ void MsnSwitchboardConnection::parseEmoticonMessage( const QString &contactHandl // Perform a syntax check. if( msnObjectData.length() < 20 ) { - kWarning() << "Emoticon message has an unexpected format " + kmWarning() << "Emoticon message has an unexpected format " << "(ignoring msnobject, contact=" << contactHandle << ", message='" << msnObjectData << "')." << endl; continue; } #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Adding emoticon code " << emoticonCode << "."; + kmDebug() << "Adding emoticon code " << emoticonCode << "."; #endif // Store the emoticon code for the contact. @@ -1245,11 +1245,11 @@ void MsnSwitchboardConnection::parseError( const QStringList& command, const QBy // twice. if ( command[0] == "215" ) { - kWarning() << "A contact was invited twice!"; + kmWarning() << "A contact was invited twice!"; } else if ( command[0] == "712" ) { - kWarning() << "The SB session is overloaded."; + kmWarning() << "The SB session is overloaded."; } else if( command[0] == "216" || command[0] == "217" ) { @@ -1257,7 +1257,7 @@ void MsnSwitchboardConnection::parseError( const QStringList& command, const QBy if( backgroundConnection_ ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Ignoring a 'contact is offline/invisible' error in background chats."; + kmDebug() << "Ignoring a 'contact is offline/invisible' error in background chats."; #endif return; } @@ -1272,11 +1272,11 @@ void MsnSwitchboardConnection::parseError( const QStringList& command, const QBy else if ( command[0] == "282" ) { // Got it once when I sent a bad P2P message or something. - kWarning() << "got the mysterious 282 error response (contacts=" << contactsInChat_ << ")."; + kmWarning() << "got the mysterious 282 error response (contacts=" << contactsInChat_ << ")."; } else if ( command[0] == "911" ) { - kDebug() << "authentication failed."; + kmDebug() << "authentication failed."; } else { @@ -1293,7 +1293,7 @@ void MsnSwitchboardConnection::parseMimeMessage(const QStringList& command, cons // Get the message type from the head const QString contentType( message.getSubValue( "Content-Type" ) ); #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Received mime message of type '" << contentType << "'."; + kmDebug() << "Received mime message of type '" << contentType << "'."; #endif // Get the sender's handle and friendly name @@ -1325,7 +1325,7 @@ void MsnSwitchboardConnection::parseMimeMessage(const QStringList& command, cons || contentType == "application/x-ms-ink" ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "chat is still in the background, requesting chat window."; + kmDebug() << "chat is still in the background, requesting chat window."; #endif // We've just received a message over a background connection: whoever @@ -1394,12 +1394,12 @@ void MsnSwitchboardConnection::parseMimeMessage(const QStringList& command, cons else if( contentType == "text/x-keepalive" ) { #ifdef KMESSDEBUG_SWITCHBOARD_KEEPALIVE - kDebug() << "Keep alive message from " << contactHandle << "."; + kmDebug() << "Keep alive message from " << contactHandle << "."; #endif } else { - kDebug() << "got unhandled message type (type=" << contentType << " contact=" << contactHandle << ")."; + kmDebug() << "got unhandled message type (type=" << contentType << " contact=" << contactHandle << ")."; } // Messages which are part of the switchboard session management, will not be considered "activity" @@ -1417,7 +1417,7 @@ void MsnSwitchboardConnection::parsePayloadMessage(const QStringList &command, c { // Switchboard has no payload commands yet. // This method is added because the functionality is generic in the base class. - kWarning() << "Unhandled payload command: " << command[0] << "!"; + kmWarning() << "Unhandled payload command: " << command[0] << "!"; } @@ -1432,7 +1432,7 @@ void MsnSwitchboardConnection::parseP2PMessage( const QString &contactHandle, co { // P2P dest is empty if we produce an error when a session is not initiated yet (MSNSLP header also has To: set) // Also seen with amsn 0.97 once. - kWarning() << "Unable to handle P2P message, P2P-Dest field is empty " + kmWarning() << "Unable to handle P2P message, P2P-Dest field is empty " "(contact=" << contactHandle << ")." << endl; return; } @@ -1440,7 +1440,7 @@ void MsnSwitchboardConnection::parseP2PMessage( const QString &contactHandle, co { // Ignore messages ment for other contacts #ifdef KMESSDEBUG_SWITCHBOARD_P2P - kDebug() << "Received a P2P message, but it's for '" << p2pDest << "'."; + kmDebug() << "Received a P2P message, but it's for '" << p2pDest << "'."; #endif return; } @@ -1460,7 +1460,7 @@ void MsnSwitchboardConnection::parseTypingMessage( const QString &/*contactHandl if( closingConnection_ ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Not emitting typing message because switchboard is closing."; + kmDebug() << "Not emitting typing message because switchboard is closing."; #endif return; } @@ -1506,7 +1506,7 @@ void MsnSwitchboardConnection::sendApplicationMessage( const MimeMessage &messag } else { - kWarning() << "unknown message type '" << contentType << "', can't send message!" << endl; + kmWarning() << "unknown message type '" << contentType << "', can't send message!" << endl; return; } @@ -1527,7 +1527,7 @@ void MsnSwitchboardConnection::sendChatMessage( const QString& text ) if ( currentAccount_ == 0 ) { - kWarning() << "currentAccount_ is null!"; + kmWarning() << "currentAccount_ is null!"; return; } @@ -1587,14 +1587,14 @@ void MsnSwitchboardConnection::sendChatMessage( const QString& text ) if( pictureFile.isEmpty() ) { #ifdef KMESSDEBUG_SWITCHBOARD_EMOTICONS - kDebug() << "Custom emoticon '" << code << "' not found!"; + kmDebug() << "Custom emoticon '" << code << "' not found!"; #endif continue; } #ifdef KMESSDEBUG_SWITCHBOARD_EMOTICONS - kDebug() << "Found custom emoticon '" << code << "' which file is '" + kmDebug() << "Found custom emoticon '" << code << "' which file is '" << ( emoticonThemePath + pictureFile ) << "'." << endl; #endif @@ -1602,7 +1602,7 @@ void MsnSwitchboardConnection::sendChatMessage( const QString& text ) if( ! iFile.open( QIODevice::ReadOnly ) ) { #ifdef KMESSDEBUG_SWITCHBOARD_EMOTICONS - kDebug() << "Unable to read picture '" << pictureFile << "'!"; + kmDebug() << "Unable to read picture '" << pictureFile << "'!"; #endif iFile.close(); continue; @@ -1755,7 +1755,7 @@ void MsnSwitchboardConnection::sendInk( InkFormat format, const QByteArray& ink unsupportingContact = contact; capable = false; #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Contact" << handle << "does not support our wink. " + kmDebug() << "Contact" << handle << "does not support our wink. " << "Has multipacket?" << contact->hasCapability( ContactBase::MSN_CAP_MULTI_PACKET ) << "Has this ink type support?" << contact->hasCapability( (ContactBase::MsnClientCapabilities)inkCapabilityFlag ); #endif @@ -1771,7 +1771,7 @@ void MsnSwitchboardConnection::sendInk( InkFormat format, const QByteArray& ink if( contactsInChat_.count() == 1 ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "None of the contacts support the wink, aborting."; + kmDebug() << "None of the contacts support the wink, aborting."; #endif return; } @@ -1834,7 +1834,7 @@ void MsnSwitchboardConnection::sendKeepAlive() if( keepAlivesRemaining_ < 1 ) { #ifdef KMESSDEBUG_SWITCHBOARD_KEEPALIVE - kDebug() << "Session has expired, letting it timeout."; + kmDebug() << "Session has expired, letting it timeout."; #endif if( keepAliveTimer_ != 0 ) @@ -1859,7 +1859,7 @@ void MsnSwitchboardConnection::sendKeepAlive() if( backgroundConnection_ ) { #ifdef KMESSDEBUG_SWITCHBOARD_KEEPALIVE - kDebug() << "Not sending keep alives for background connections."; + kmDebug() << "Not sending keep alives for background connections."; #endif return; } @@ -1868,7 +1868,7 @@ void MsnSwitchboardConnection::sendKeepAlive() if( ! isConnected() ) { #ifdef KMESSDEBUG_SWITCHBOARD_KEEPALIVE - kDebug() << "Cannot send keep alive while disconnected!"; + kmDebug() << "Cannot send keep alive while disconnected!"; #endif return; } @@ -1877,7 +1877,7 @@ void MsnSwitchboardConnection::sendKeepAlive() if( contactsInChat_.isEmpty() ) { #ifdef KMESSDEBUG_SWITCHBOARD_KEEPALIVE - kDebug() << "Stopping keep alive, no contacts in chat."; + kmDebug() << "Stopping keep alive, no contacts in chat."; #endif keepAliveTimer_->stop(); @@ -1885,7 +1885,7 @@ void MsnSwitchboardConnection::sendKeepAlive() } #ifdef KMESSDEBUG_SWITCHBOARD_KEEPALIVE - kDebug() << "Sending a keep alive message," << keepAlivesRemaining_ << "left before expiration."; + kmDebug() << "Sending a keep alive message," << keepAlivesRemaining_ << "left before expiration."; #endif // Build the keepalive message @@ -1915,7 +1915,7 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M if( isConnected() && ! contactsInChat_.empty() ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Sending mime message of type '" << message.getValue("Content-Type") << "'."; + kmDebug() << "Sending mime message of type '" << message.getValue("Content-Type") << "'."; #endif #ifdef KMESSTEST KMESS_ASSERT( connectionState_ == SB_CHAT_STARTED ); @@ -1931,7 +1931,7 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M || contentType == "application/x-ms-ink" ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "chat is still in the background, requesting chat window."; + kmDebug() << "chat is still in the background, requesting chat window."; #endif backgroundConnection_ = false; emit requestChatWindow( this ); @@ -1950,8 +1950,8 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M // There's no active connection, store as pending message #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Chat is not active, queueing message to send later."; - kDebug() << "Status info -- Connected:" << isConnected() + kmDebug() << "Chat is not active, queueing message to send later."; + kmDebug() << "Status info -- Connected:" << isConnected() << "Contacts in chat:" << contactsInChat_ << "Status code:" << connectionState_; #endif @@ -1971,7 +1971,7 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M // See if we need to invite the contacts #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Already waiting for the connection to be authorized..."; + kmDebug() << "Already waiting for the connection to be authorized..."; #endif return; @@ -1981,13 +1981,13 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M // without it, isConnected() returns true, so any unsent message gets sent before USR, causing a disconnection. #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Already waiting for connection to establish..."; + kmDebug() << "Already waiting for connection to establish..."; #endif return; case SB_INVITING_CONTACTS: #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Already waiting for contacts to join the chat..."; + kmDebug() << "Already waiting for contacts to join the chat..."; #endif return; @@ -1997,14 +1997,14 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M #endif if( contactsInChat_.count() > 1 ) { - kWarning() << "failed to re-connect; multiple contacts are left in chat!"; + kmWarning() << "failed to re-connect; multiple contacts are left in chat!"; return; } if( message.hasField("P2P-Dest") && message.getValue("P2P-Dest") != lastContact_ ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "All contacts left the chat, calling the contact from the P2P-Dest field."; + kmDebug() << "All contacts left the chat, calling the contact from the P2P-Dest field."; #endif connectionState_ = SB_INVITING_CONTACTS; sendCommand( "CAL", message.getValue("P2P-Dest") ); @@ -2012,12 +2012,12 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M else { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "All contacts left the chat, calling the last contact left."; + kmDebug() << "All contacts left the chat, calling the last contact left."; #endif if( lastContact_.isEmpty() ) { - kWarning() << "Switchboard failed to re-connect; no contact left to invite!"; + kmWarning() << "Switchboard failed to re-connect; no contact left to invite!"; return; } @@ -2040,7 +2040,7 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M // It's not possible to simply re-open it, because we need a new authcookie for the USR command. #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Already waiting for MsnNotificationConnection to request a new chat..."; + kmDebug() << "Already waiting for MsnNotificationConnection to request a new chat..."; #endif return; @@ -2051,7 +2051,7 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M // Simply restore it. #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Connection was closed unexpectedly."; + kmDebug() << "Connection was closed unexpectedly."; #endif // Reset the connection's status @@ -2065,7 +2065,7 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M // Should never happen, but you never know. if( lastContact_.isEmpty() ) { - kWarning() << "Cannot find a contact to send offline messages to."; + kmWarning() << "Cannot find a contact to send offline messages to."; return; } @@ -2076,7 +2076,7 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M if( ! contact || ! contact->isOffline() ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Not sending offline message to an" << (contact?"online":"unknown") << "contact."; + kmDebug() << "Not sending offline message to an" << (contact?"online":"unknown") << "contact."; #endif break; } @@ -2086,14 +2086,14 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M if( ! contentType.startsWith( "text/plain" ) ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Ignoring message of type" << contentType << "in an offline messaging session."; + kmDebug() << "Ignoring message of type" << contentType << "in an offline messaging session."; #endif pendingMessages_.removeAll( newPendingMessage ); return; } #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Sending offline message..."; + kmDebug() << "Sending offline message..."; #endif // Only load the OIM service on demand if( offlineImService_ == 0 ) @@ -2120,7 +2120,7 @@ void MsnSwitchboardConnection::sendMimeMessageWhenReady(AckType ackType, const M } // Switch for connectionState_ ends here #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Connection is closed, requesting a new chat from the notification server..."; + kmDebug() << "Connection is closed, requesting a new chat from the notification server..."; #endif #ifdef KMESSTEST KMESS_ASSERT( connectionState_ == SB_DISCONNECTED ); @@ -2141,7 +2141,7 @@ void MsnSwitchboardConnection::sendPendingMessages() if( ! isConnected() || connectionState_ != SB_CHAT_STARTED ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Skipping message sending, the connection is not ready."; + kmDebug() << "Skipping message sending, the connection is not ready."; #endif return; } @@ -2150,7 +2150,7 @@ void MsnSwitchboardConnection::sendPendingMessages() // The switchboard should still be (re-)initializing if( contactsInChat_.isEmpty() ) { - kWarning() << "No contacts available in the chat."; + kmWarning() << "No contacts available in the chat."; return; } @@ -2159,7 +2159,7 @@ void MsnSwitchboardConnection::sendPendingMessages() foreach( pendingMessage, pendingMessages_ ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Sending pending messages, " << ( pendingMessages_.count() -1 ) << " remaining."; + kmDebug() << "Sending pending messages, " << ( pendingMessages_.count() -1 ) << " remaining."; #endif // Send the message @@ -2185,7 +2185,7 @@ void MsnSwitchboardConnection::sendTypingMessage() if( lastContact_.isEmpty() ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Not sending typing notification, no contacts in chat, nor one to re-invite."; + kmDebug() << "Not sending typing notification, no contacts in chat, nor one to re-invite."; #endif return; } @@ -2197,14 +2197,14 @@ void MsnSwitchboardConnection::sendTypingMessage() if( contact == 0 || contact->isOffline() ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Not sending typing notification, last contact is offline."; + kmDebug() << "Not sending typing notification, last contact is offline."; #endif return; } } #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Sending typing notification."; + kmDebug() << "Sending typing notification."; #endif // Build the typing notification message @@ -2248,7 +2248,7 @@ void MsnSwitchboardConnection::setUserStartedChat( bool startedByUser ) void MsnSwitchboardConnection::slotApplicationsAborted(const QString &handle) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "All applications of contact '" << handle << "' have been aborted."; + kmDebug() << "All applications of contact '" << handle << "' have been aborted."; #endif #ifdef KMESSTEST KMESS_ASSERT( abortingApplications_ ); @@ -2276,7 +2276,7 @@ void MsnSwitchboardConnection::slotApplicationsAborted(const QString &handle) if( contactsInChat_.isEmpty() ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "No other contacts need to abort, closing connection."; + kmDebug() << "No other contacts need to abort, closing connection."; #endif abortingApplications_ = false; @@ -2291,7 +2291,7 @@ void MsnSwitchboardConnection::slotApplicationsAborted(const QString &handle) else { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Waiting for applications of " << contactsInChat_.count() << " other contacts to abort..."; + kmDebug() << "Waiting for applications of " << contactsInChat_.count() << " other contacts to abort..."; #endif } } @@ -2302,7 +2302,7 @@ void MsnSwitchboardConnection::slotApplicationsAborted(const QString &handle) void MsnSwitchboardConnection::slotConnected() { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Connected to server, sending authentication."; + kmDebug() << "Connected to server, sending authentication."; #endif #ifdef KMESSTEST KMESS_ASSERT( connectionState_ == SB_CONNECTING || connectionState_ == SB_REQUESTING_CHAT ); @@ -2334,7 +2334,7 @@ void MsnSwitchboardConnection::slotConnected() */ void MsnSwitchboardConnection::slotError( QString error, MsnSocketBase::ErrorType type ) { - kWarning() << "MSN Switchboard Connection error type" << type << " (contacts=" << contactsInChat_ << "):" << error; + kmWarning() << "MSN Switchboard Connection error type" << type << " (contacts=" << contactsInChat_ << "):" << error; // Decide what kind of message to show switch( type ) @@ -2389,12 +2389,12 @@ void MsnSwitchboardConnection::start( const ChatInformation &chatInfo ) { if( ! contactsInChat_.isEmpty() && ! isExclusiveChatWithContact(chatInfo.getContactHandle())) { - kWarning() << "already connected, can't start new chat with '" << chatInfo.getContactHandle() << "'!" << endl; + kmWarning() << "already connected, can't start new chat with '" << chatInfo.getContactHandle() << "'!" << endl; return; } #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Resuming a connection with a different server, reconnecting."; + kmDebug() << "Resuming a connection with a different server, reconnecting."; #endif closeConnection(); } @@ -2403,7 +2403,7 @@ void MsnSwitchboardConnection::start( const ChatInformation &chatInfo ) if( ! contactsInChat_.isEmpty() ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Deleting active contacts: " << contactsInChat_.join(","); + kmDebug() << "Deleting active contacts: " << contactsInChat_.join(","); #endif // Make sure all contacts are removed, which will also abort their applications in ApplicationList. @@ -2432,7 +2432,7 @@ void MsnSwitchboardConnection::start( const ChatInformation &chatInfo ) #endif #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Initializing offline connection with " << chatInfo.getContactHandle() << "."; + kmDebug() << "Initializing offline connection with " << chatInfo.getContactHandle() << "."; #endif // lastContact_ gets set even when making offline connections, so isExclusiveChatWithContact() returns true; @@ -2448,7 +2448,7 @@ void MsnSwitchboardConnection::start( const ChatInformation &chatInfo ) #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "Initializing connection with " << chatInfo.getContactHandle() + kmDebug() << "Initializing connection with " << chatInfo.getContactHandle() << ": Connecting to SB " << chatInfo.getIp() << ":" << chatInfo.getPort() << "." << endl; #endif @@ -2469,7 +2469,7 @@ void MsnSwitchboardConnection::start( const ChatInformation &chatInfo ) if( backgroundConnection_ && chatInfo.getType() == ChatInformation::CONNECTION_CHAT ) { #ifdef KMESSDEBUG_SWITCHBOARD_GENERAL - kDebug() << "requesting chat window for initiated chat invitation."; + kmDebug() << "requesting chat window for initiated chat invitation."; #endif emit requestChatWindow( this ); backgroundConnection_ = false; @@ -2500,7 +2500,7 @@ void MsnSwitchboardConnection::storeMessageForAcknowledgement(int ack, AckType a unAckedMessages_.insert( ack, unAcked ); #ifdef KMESSDEBUG_SWITCHBOARD_ACKS - kDebug() << "Stored message for acknowledgement. " + kmDebug() << "Stored message for acknowledgement. " << "There are currently " << unAckedMessages_.count() << " messages kept, " << acksPending_ << " need to be ACKed." << endl; #endif diff --git a/src/network/multipacketmessage.cpp b/src/network/multipacketmessage.cpp index 11f9862..c7c0c37 100644 --- a/src/network/multipacketmessage.cpp +++ b/src/network/multipacketmessage.cpp @@ -79,7 +79,7 @@ void MultiPacketMessage::addChunk( const MimeMessage &message ) if( isComplete() ) { - kWarning() << "already received last chunk!"; + kmWarning() << "already received last chunk!"; return; } @@ -92,7 +92,7 @@ void MultiPacketMessage::addChunk( const MimeMessage &message ) // Test whether the object is already initialized. if( ! messageId_.isNull() ) { - kWarning() << "reveived message contains 'Chunks' header, but is not the first message!"; + kmWarning() << "reveived message contains 'Chunks' header, but is not the first message!"; return; } @@ -104,7 +104,7 @@ void MultiPacketMessage::addChunk( const MimeMessage &message ) // Avoid denial-of-service attacks. if( chunks_ > 20 ) { - kWarning() << "about to receive a message of more then 20 chunks, ignoring message!"; + kmWarning() << "about to receive a message of more then 20 chunks, ignoring message!"; return; } @@ -127,14 +127,14 @@ void MultiPacketMessage::addChunk( const MimeMessage &message ) // Test whether this is the correct chunk if( message.getValue("Chunk").toInt() != lastChunk_ ) { - kWarning() << "received message chunk " << message.getValue("Chunk").toInt() << + kmWarning() << "received message chunk " << message.getValue("Chunk").toInt() << ", expecting chunk " << lastChunk_ << "!" << endl; return; } } else { - kWarning() << "received message without 'Chunks' or 'Chunk' field, ignoring message!"; + kmWarning() << "received message without 'Chunks' or 'Chunk' field, ignoring message!"; return; } @@ -156,7 +156,7 @@ void MultiPacketMessage::addChunk( const MimeMessage &message ) if( lastChunk_ == chunks_ ) { #ifdef KMESSDEBUG_MULTIPACKETMESSAGE - kDebug() << "Stored final part, restoring message."; + kmDebug() << "Stored final part, restoring message."; #endif // Read all data @@ -178,7 +178,7 @@ void MultiPacketMessage::addChunk( const MimeMessage &message ) else { #ifdef KMESSDEBUG_MULTIPACKETMESSAGE - kDebug() << "Stored part " << lastChunk_ << " of " << chunks_; + kmDebug() << "Stored part " << lastChunk_ << " of " << chunks_; #endif } } @@ -242,7 +242,7 @@ const MimeMessage& MultiPacketMessage::getNextPart() lastChunk_++; #ifdef KMESSDEBUG_MULTIPACKETMESSAGE - kDebug() << "Sending part: " << lastChunk_; + kmDebug() << "Sending part: " << lastChunk_; #endif return result_; diff --git a/src/network/p2pmessage.cpp b/src/network/p2pmessage.cpp index ad32b54..c3ced64 100644 --- a/src/network/p2pmessage.cpp +++ b/src/network/p2pmessage.cpp @@ -245,7 +245,7 @@ void P2PMessage::parseP2PHeader() { // This clearly indicates an internal parsing error (in MimeMessage) // bodyData may be NULL - kWarning() << "no data found to parse!"; + kmWarning() << "no data found to parse!"; sessionID_ = 0; messageID_ = 0; dataOffset_ = 0; @@ -279,7 +279,7 @@ void P2PMessage::parseP2PHeader() // Verify data size! if( (uint) message_.size() < ( 48 + dataSize_ ) ) // message size could also contain the footer code. { - kWarning().nospace() << "corrupt data size header detected " + kmWarning().nospace() << "corrupt data size header detected " "(header=48" " datasize=" << dataSize_ << " total=" << message_.size() << ")"; @@ -435,7 +435,7 @@ QString P2PMessage::extractUtf16String( const char *data, const int offset, int && data[ offset + size - 2 ] == '\0' ) { #ifdef KMESSDEBUG_P2PMESSAGE - kDebug() << "avoid copying null character to utf16 string"; + kmDebug() << "avoid copying null character to utf16 string"; #endif size--; } diff --git a/src/network/soap/addressbookservice.cpp b/src/network/soap/addressbookservice.cpp index 57b8b66..71ad52a 100644 --- a/src/network/soap/addressbookservice.cpp +++ b/src/network/soap/addressbookservice.cpp @@ -545,7 +545,7 @@ void AddressBookService::retrieveGleams() void AddressBookService::parseAddressBook( const QDomElement &body ) { #ifdef KMESSDEBUG_ADDRESSBOOKSERVICE - kDebug() << "Parsing address book."; + kmDebug() << "Parsing address book."; int debugGroupCount = 0; #endif @@ -640,7 +640,7 @@ void AddressBookService::parseAddressBook( const QDomElement &body ) // easy the life of the users...for the moment..:P if( handle.isEmpty() || handle == "messenger@microsoft.com" ) { - kWarning() << "Skipped 'messenger@microsoft.com' contact!"; + kmWarning() << "Skipped 'messenger@microsoft.com' contact!"; continue; } @@ -682,7 +682,7 @@ void AddressBookService::parseAddressBook( const QDomElement &body ) } #ifdef KMESSDEBUG_ADDRESSBOOKSERVICE - kDebug() << "Address book successfully parsed: found" << contacts.count() << "contacts and" << debugGroupCount << "groups."; + kmDebug() << "Address book successfully parsed: found" << contacts.count() << "contacts and" << debugGroupCount << "groups."; #endif // Signal that the of address book has been parsed @@ -712,7 +712,7 @@ void AddressBookService::parseMembershipLists( const QDomElement &body ) if( serviceType.isEmpty() ) { - kWarning() << "Retrieved unknown service type!"; + kmWarning() << "Retrieved unknown service type!"; continue; } @@ -744,7 +744,7 @@ void AddressBookService::parseMembershipLists( const QDomElement &body ) else if( role == "Pending" ) roleId = Contact::MSN_LIST_PENDING; else { - kWarning() << "Unknown membership role" << role << "in service" << serviceType << "!"; + kmWarning() << "Unknown membership role" << role << "in service" << serviceType << "!"; continue; } @@ -778,7 +778,7 @@ void AddressBookService::parseMembershipLists( const QDomElement &body ) QString type = XmlFunctions::getNodeValue( memberNode, "Type" ).toLower(); if ( type != "passport" ) { - kDebug() << "Skipped non-passport contact" << handle; + kmDebug() << "Skipped non-passport contact" << handle; continue; } @@ -807,7 +807,7 @@ void AddressBookService::parseSecureFault( SoapMessage *message ) // Should never happen if( ! message->isFaultMessage() ) { - kWarning() << "Incorrect fault detected on incoming message"; + kmWarning() << "Incorrect fault detected on incoming message"; return; } @@ -829,7 +829,7 @@ void AddressBookService::parseSecureFault( SoapMessage *message ) { QString email( info.toStringList().first() ); - kWarning() << "Malformed email address found by the server:" << email; + kmWarning() << "Malformed email address found by the server:" << email; emit soapWarning( i18nc( "Warning message", "The specified email address, \"%1\", is not a valid email address!", @@ -857,7 +857,7 @@ void AddressBookService::parseSecureFault( SoapMessage *message ) else if( errorCode == "ABDoesNotExist" ) { #ifdef KMESSDEBUG_ADDRESSBOOKSERVICE - kDebug() << "Address book does not exist: creating new one."; + kmDebug() << "Address book does not exist: creating new one."; #endif createAddressBook(); return; @@ -920,7 +920,7 @@ void AddressBookService::parseSecureResult( SoapMessage *message ) { // New address book was created: proceed with it #ifdef KMESSDEBUG_ADDRESSBOOKSERVICE - kDebug() << "Address book successfully created: retrying to obtain membership lists."; + kmDebug() << "Address book successfully created: retrying to obtain membership lists."; #endif retrieveMembershipLists(); return; @@ -942,17 +942,19 @@ void AddressBookService::parseSecureResult( SoapMessage *message ) if( ! contactId.isEmpty() && ! handle.isEmpty() ) { emit contactAdded( handle, contactId, groupsId ); + emit addressBookChanged( handle, ContactAdded ); } } else if( data.type == "ContactDelete" ) { // A contact was deleted from the AB - const QString contactId( data.value.toString() ); + const QString handle (data.value.toString() ); if( ! contactId.isEmpty() ) { - emit contactDeleted( contactId ); + emit contactDeleted( contactId, handle ); + emit addressBookChanged( handle, ContactDeleted ); } } else if( data.type == "ContactBlock" || data.type == "ContactUnblock" ) @@ -966,10 +968,12 @@ void AddressBookService::parseSecureResult( SoapMessage *message ) if( role == "BL" ) { emit contactBlocked( handle ); + emit addressBookChanged( handle, ContactBlocked ); } else if( role == "AL" ) { emit contactUnblocked( handle ); + emit addressBookChanged( handle, ContactUnblock ); } } else if( data.type == "ContactAddToGroup" ) @@ -982,6 +986,7 @@ void AddressBookService::parseSecureResult( SoapMessage *message ) if( ! contactId.isEmpty() && ! groupId.isEmpty() ) { emit contactAddedToGroup( contactId, groupId ); + emit addressBookChanged( contactId, ContactAddedToGroup ); } } else if( data.type == "ContactDeleteFromGroup" ) @@ -995,6 +1000,7 @@ void AddressBookService::parseSecureResult( SoapMessage *message ) if( ! contactId.isEmpty() && ! groupId.isEmpty() ) { emit contactDeletedFromGroup( contactId, groupId ); + emit addressBookChanged( contactId, ContactDeletedFromGroup ); } } else if( data.type == "GroupAdd" ) @@ -1006,16 +1012,19 @@ void AddressBookService::parseSecureResult( SoapMessage *message ) if( ! groupId.isEmpty() && ! name.isEmpty() ) { emit groupAdded( groupId, name ); + emit addressBookChanged( groupId, GroupAdded ); } } else if( data.type == "GroupDelete" ) { // A group was removed const QString groupId( data.value.toString() ); - + const QStringList info ( data.value.toStringList() ); + const QString name( info.value( 0 ) ); if( ! groupId.isEmpty() ) { - emit groupDeleted( groupId ); + emit groupDeleted( groupId, name ); + emit addressBookChanged( name, GroupDeleted ); } } else if( data.type == "GroupRename" ) @@ -1028,11 +1037,12 @@ void AddressBookService::parseSecureResult( SoapMessage *message ) if( ! groupId.isEmpty() && ! name.isEmpty() ) { emit groupRenamed( groupId, name ); + emit addressBookChanged( name, GroupRenamed ); } } else { - kWarning() << "Response data not recognized:" << data.type; + kmWarning() << "Response data not recognized:" << data.type; } } diff --git a/src/network/soap/addressbookservice.h b/src/network/soap/addressbookservice.h index c609848..87c25ee 100644 --- a/src/network/soap/addressbookservice.h +++ b/src/network/soap/addressbookservice.h @@ -42,6 +42,22 @@ class AddressBookService : public PassportLoginService PROPERTY_PRIVACY }; + /** + * Represents a change made to the address book. + */ + enum AddressBookUpdate + { + ContactAdded = 0, + ContactDeleted, + ContactBlocked, + ContactUnblock, + ContactDeletedFromGroup, + ContactAddedToGroup, + GroupAdded, + GroupDeleted, + GroupRenamed + }; + // The constructor AddressBookService( QObject *parent = 0 ); // The destructor @@ -101,7 +117,7 @@ class AddressBookService : public PassportLoginService // Contact was blocked void contactBlocked( const QString &handle ); // Contact was deleted - void contactDeleted( const QString &contactId ); + void contactDeleted( const QString &contactId, const QString &handle ); // Contact was delete from group void contactDeletedFromGroup( const QString &contactId, const QString &groupId ); // Contact was unblocked @@ -111,7 +127,7 @@ class AddressBookService : public PassportLoginService // Group was added void groupAdded( const QString& groupId, const QString& name ); // Group was removed - void groupDeleted( const QString& groupId ); + void groupDeleted( const QString& groupId, const QString& name ); // Group was renamed void groupRenamed( const QString& groupId, const QString& name ); // A group's details have been received @@ -124,6 +140,9 @@ class AddressBookService : public PassportLoginService void gotPersonalInformation( const QString &cid, int blp ); // The address book was entirely received and parsed void gotAddressBookList( const QList< QHash > &contacts ); + // All AdressBookSignals here + void addressBookChanged( const QString &id, AddressBookService::AddressBookUpdate update ); + }; #endif diff --git a/src/network/soap/httpsoapconnection.cpp b/src/network/soap/httpsoapconnection.cpp index 5422167..99870fb 100644 --- a/src/network/soap/httpsoapconnection.cpp +++ b/src/network/soap/httpsoapconnection.cpp @@ -66,7 +66,7 @@ HttpSoapConnection::HttpSoapConnection( QObject *parent ) , isSending_( false ) { #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "CREATED."; + kmDebug() << "CREATED."; #endif // Create the network request object @@ -101,7 +101,7 @@ HttpSoapConnection::~HttpSoapConnection() delete http_; #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -172,7 +172,7 @@ bool HttpSoapConnection::isIdle() bool HttpSoapConnection::parseHttpBody( const QByteArray &responseBody ) { #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "Request finished, pasing body."; + kmDebug() << "Request finished, pasing body."; #endif // Attempt to convert to XML @@ -181,7 +181,7 @@ bool HttpSoapConnection::parseHttpBody( const QByteArray &responseBody ) QDomDocument xml; if( ! xml.setContent( responseBody, true, &xmlError ) ) // true for namespace processing. { - kWarning() << "Unable to parse XML " + kmWarning() << "Unable to parse XML " "(error='" << xmlError << "' endpoint=" << endpoint_ << ")" << endl; return false; } @@ -194,7 +194,7 @@ bool HttpSoapConnection::parseHttpBody( const QByteArray &responseBody ) if( ! faultNode.isNull() ) { #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "Found soap fault outside the body!"; + kmDebug() << "Found soap fault outside the body!"; #endif closeConnection(); parseSoapFault( faultNode, headerNode ); @@ -205,7 +205,7 @@ bool HttpSoapConnection::parseHttpBody( const QByteArray &responseBody ) QDomElement resultNode = XmlFunctions::getNode(xml, "/Envelope/Body").firstChild().toElement(); if( resultNode.isNull() ) { - kWarning() << "Unable to parse response: result node is null " + kmWarning() << "Unable to parse response: result node is null " << "(root=" << xml.nodeName() << " endpoint=" << endpoint_ << ")." << endl; return false; } @@ -216,7 +216,7 @@ bool HttpSoapConnection::parseHttpBody( const QByteArray &responseBody ) && resultNode.namespaceURI() == XMLNS_SOAP ) { #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "Found soap fault."; + kmDebug() << "Found soap fault."; #endif closeConnection(); parseSoapFault( resultNode, headerNode ); @@ -236,7 +236,7 @@ bool HttpSoapConnection::parseHttpBody( const QByteArray &responseBody ) // Request completed, indicate derived class and listeners. #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "Request finished, signalling to start parsing of the result node " + kmDebug() << "Request finished, signalling to start parsing of the result node " "(name:" << resultNode.nodeName() << " prefix:" << resultNode.prefix() << " localName:" << resultNode.localName() << @@ -317,7 +317,7 @@ void HttpSoapConnection::sendNextRequest() endpoint.setHost( redirections_[ endpoint.host() ] ); #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "Sending with redirection from:" << endpointAddress << "to:" << endpoint; + kmDebug() << "Sending with redirection from:" << endpointAddress << "to:" << endpoint; #endif } @@ -373,8 +373,8 @@ void HttpSoapConnection::sendNextRequest() #endif #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_HTTPDUMP - kDebug() << "Request contents:"; - kDebug() << contents; + kmDebug() << "Request contents:"; + kmDebug() << contents; #endif } @@ -395,11 +395,11 @@ void HttpSoapConnection::sendRequest( SoapMessage *message, bool urgent ) #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL if( urgent ) { - kDebug() << "Immediately sending message to endpoint:" << message->getEndPoint(); + kmDebug() << "Immediately sending message to endpoint:" << message->getEndPoint(); } else { - kDebug() << "Queueing message to endpoint:" << message->getEndPoint(); + kmDebug() << "Queueing message to endpoint:" << message->getEndPoint(); } #endif @@ -426,7 +426,7 @@ void HttpSoapConnection::slotAuthenticationRequired( QNetworkReply *reply, QAuth // A response has arrived, stop the timeout detection timer responseTimer_.stop(); - kWarning() << "Got http authentication request for" << authenticator->realm() << + kmWarning() << "Got http authentication request for" << authenticator->realm() << "while connecting to" << reply->url(); // Inform listeners that the request failed @@ -446,7 +446,7 @@ void HttpSoapConnection::slotRequestFinished( QNetworkReply *reply ) // An unexpected response has arrived if( currentRequest_ == 0 ) { - kWarning() << "No request in progress!"; + kmWarning() << "No request in progress!"; return; } @@ -460,17 +460,17 @@ void HttpSoapConnection::slotRequestFinished( QNetworkReply *reply ) #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL bool requestSuccess = false; const QUrl replyUrl( reply->url() ); - kDebug() << "Received response: code" << statusCode + kmDebug() << "Received response: code" << statusCode << reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ) << " from" << replyUrl; #endif #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_HTTPDUMP - kDebug() << "Reply contents:"; + kmDebug() << "Reply contents:"; // Create the document with the content of SOAP reply to indent it QDomDocument document; document.setContent( replyContents ); - kDebug() << document.toString(); + kmDebug() << document.toString(); #endif // Parse the body of the HTTP response (copying the other attributes from the request) @@ -501,7 +501,7 @@ void HttpSoapConnection::slotRequestFinished( QNetworkReply *reply ) const QString redirectHost( redirectUrl.host() ); #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "Received redirection from:" << originalHost << "to:" << redirectHost; + kmDebug() << "Received redirection from:" << originalHost << "to:" << redirectHost; #endif // Save the redirection target @@ -543,7 +543,7 @@ void HttpSoapConnection::slotRequestFinished( QNetworkReply *reply ) if( ! preferredHostName.isEmpty() && ! redirections_.contains( originalHost ) ) { #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "Received hostname suggestion from:" << originalUrl << "to:" << preferredHostName; + kmDebug() << "Received hostname suggestion from:" << originalUrl << "to:" << preferredHostName; #endif redirectionCounts_[ originalHost ] = 0; @@ -572,10 +572,10 @@ void HttpSoapConnection::slotRequestFinished( QNetworkReply *reply ) else { // Display at the console for logging - kWarning() << "Received an unknown" << statusCode << "status code (" << error + kmWarning() << "Received an unknown" << statusCode << "status code (" << error << ") while connecting to endpoint" << reply->url(); - kWarning() << "Reply contents:"; - kWarning() << replyContents; + kmWarning() << "Reply contents:"; + kmWarning() << replyContents; // Inform listeners that the request failed emit soapError( i18nc( "Error message with description (system-generated description)", @@ -596,7 +596,7 @@ void HttpSoapConnection::slotRequestFinished( QNetworkReply *reply ) isSending_ = false; #ifdef KMESSDEBUG_HTTPSOAPCONNECTION_GENERAL - kDebug() << "Completed response handling from endpoint" << replyUrl << ", with success?" << requestSuccess; + kmDebug() << "Completed response handling from endpoint" << replyUrl << ", with success?" << requestSuccess; #endif // Send the next queued message @@ -631,7 +631,7 @@ void HttpSoapConnection::slotSslErrors( QNetworkReply *reply, const QListurl(); + kmWarning() << "Got SSL error" << error.errorString() << "while connecting to endpoint" << reply->url(); } // It's needed to ignore SSL errors because rsi.hotmail.com uses an invalid certificate. diff --git a/src/network/soap/msnappdirectoryservice.cpp b/src/network/soap/msnappdirectoryservice.cpp index 68ada02..fbb0af6 100644 --- a/src/network/soap/msnappdirectoryservice.cpp +++ b/src/network/soap/msnappdirectoryservice.cpp @@ -40,7 +40,7 @@ MsnAppDirectoryService::MsnAppDirectoryService( QObject *parent ) : HttpSoapConnection( parent ) { #ifdef KMESSDEBUG_APPDIRECTORYSERVICE_GENERAL - kDebug() << "CREATED."; + kmDebug() << "CREATED."; #endif setObjectName( "MsnAppDirectoryService" ); @@ -54,7 +54,7 @@ MsnAppDirectoryService::~MsnAppDirectoryService() qDeleteAll( entries_ ); #ifdef KMESSDEBUG_APPDIRECTORYSERVICE_GENERAL - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -88,7 +88,7 @@ const QList& MsnAppDirectoryService::getEntries( void MsnAppDirectoryService::parseSoapResult( SoapMessage *message ) { #ifdef KMESSDEBUG_APPDIRECTORYSERVICE_GENERAL - kDebug() << "Got query response"; + kmDebug() << "Got query response"; #endif // Parse the list of result entries @@ -141,7 +141,7 @@ void MsnAppDirectoryService::parseSoapResult( SoapMessage *message ) entry->hidden = XmlFunctions::getNodeValue( entryProperties, "Hidden" ) == "True"; #ifdef KMESSDEBUG_APPDIRECTORYSERVICE_GENERAL - kDebug() << "Received entry " << entry->name << "."; + kmDebug() << "Received entry " << entry->name << "."; #endif // Add to the list @@ -149,7 +149,7 @@ void MsnAppDirectoryService::parseSoapResult( SoapMessage *message ) } #ifdef KMESSDEBUG_APPDIRECTORYSERVICE_GENERAL - kDebug() << "Emitting that request was successful"; + kmDebug() << "Emitting that request was successful"; #endif } @@ -161,7 +161,7 @@ void MsnAppDirectoryService::queryServiceList( MsnAppDirectoryServiceType type ) Q_UNUSED( type ); #ifdef KMESSDEBUG_APPDIRECTORYSERVICE_GENERAL - kDebug() << "Querying service list"; + kmDebug() << "Querying service list"; #endif QString body( "\n" diff --git a/src/network/soap/offlineimservice.cpp b/src/network/soap/offlineimservice.cpp index 1ae3454..85df018 100644 --- a/src/network/soap/offlineimservice.cpp +++ b/src/network/soap/offlineimservice.cpp @@ -69,7 +69,7 @@ OfflineImService::OfflineImService( const QString &authT, const QString &authP, , nextSequenceNum_(0) { #ifdef KMESSDEBUG_OFFLINE_IM_GENERAL - kDebug() << "CREATED offline IM receiver service"; + kmDebug() << "CREATED offline IM receiver service"; #endif setObjectName( "OfflineImService[receiver]" ); @@ -96,7 +96,7 @@ OfflineImService::OfflineImService( QObject *parent ) , nextSequenceNum_(0) { #ifdef KMESSDEBUG_OFFLINE_IM_GENERAL - kDebug() << "CREATED offline IM sender service"; + kmDebug() << "CREATED offline IM sender service"; #endif setObjectName( "OfflineImService[sender]" ); @@ -110,7 +110,7 @@ OfflineImService::OfflineImService( QObject *parent ) OfflineImService::~OfflineImService() { #ifdef KMESSDEBUG_OFFLINE_IM_GENERAL - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -123,7 +123,7 @@ OfflineImService::~OfflineImService() void OfflineImService::deleteMessages( const QStringList &messageIds ) { #ifdef KMESSDEBUG_OFFLINE_IM_GENERAL - kDebug() << "requesting deletion of messages:" << messageIds; + kmDebug() << "requesting deletion of messages:" << messageIds; #endif #ifdef KMESSTEST KMESS_ASSERT( ! messageIds.isEmpty() ); @@ -184,7 +184,7 @@ QString OfflineImService::extractRFC822Address( const QString &address ) void OfflineImService::getMessage( const QString &messageId, bool markAsRead ) { #ifdef KMESSDEBUG_OFFLINE_IM_GENERAL - kDebug() << "requesting message with ID:" << messageId; + kmDebug() << "requesting message with ID:" << messageId; #endif // Initialize the call data, which will be used in the slots to know which session this was @@ -221,7 +221,7 @@ void OfflineImService::getMessage( const QString &messageId, bool markAsRead ) void OfflineImService::getMetaData() { #ifdef KMESSDEBUG_OFFLINE_IM_GENERAL - kDebug() << "requesting Mail-Data field"; + kmDebug() << "requesting Mail-Data field"; #endif // Initialize the call data, which will be used in the slots to know which session this was @@ -246,7 +246,7 @@ void OfflineImService::parseSecureFault( SoapMessage *message ) // Should never happen if( ! message->isFaultMessage() ) { - kWarning() << "Incorrect fault detected on incoming message"; + kmWarning() << "Incorrect fault detected on incoming message"; return; } @@ -285,8 +285,8 @@ void OfflineImService::parseSecureFault( SoapMessage *message ) currentAccount_->setOfflineImKey( handler.computeHash( lockKeyChallenge ) ); #ifdef KMESSDEBUG_OFFLINE_IM_GENERAL - kDebug() << "Lock key to compute:" << lockKeyChallenge; - kDebug() << "Computed lock key:" << currentAccount_->getOfflineImKey(); + kmDebug() << "Lock key to compute:" << lockKeyChallenge; + kmDebug() << "Computed lock key:" << currentAccount_->getOfflineImKey(); #endif // Check if there is a TweenerChallenge, and if not re-send the message with the new lock key if( tweenerChallenge.isEmpty() ) @@ -305,7 +305,7 @@ void OfflineImService::parseSecureFault( SoapMessage *message ) } // Any other situation means something is wrong. - kWarning() << "Unknown challenge type received"; + kmWarning() << "Unknown challenge type received"; emit sendMessageFailed( recipient, originalMessage ); } else if( faultCode == "q0:SystemUnavailable" // contact does not exist OR has blocked you (unlikely) @@ -318,12 +318,12 @@ void OfflineImService::parseSecureFault( SoapMessage *message ) emit sendMessageFailed( recipient, originalMessage ); // Also report at the console. - kWarning() << "Received SOAP fault" << faultCode << "when sending an offline-im message to" << recipient; + kmWarning() << "Received SOAP fault" << faultCode << "when sending an offline-im message to" << recipient; } else { // Any other situation means something is wrong. - kWarning() << "Unknown response type received: fault code:" << faultCode + kmWarning() << "Unknown response type received: fault code:" << faultCode << "endpoint:" << message->getEndPoint(); // Notify the sender if this error was @@ -352,7 +352,7 @@ void OfflineImService::parseSecureFault( SoapMessage *message ) void OfflineImService::parseSecureResult( SoapMessage *message ) { #ifdef KMESSDEBUG_OFFLINE_IM_GENERAL - kDebug() << "parsing SOAP response."; + kmDebug() << "parsing SOAP response."; #endif QDomElement body ( message->getBody().toElement() ); @@ -377,7 +377,7 @@ void OfflineImService::parseSecureResult( SoapMessage *message ) QString recipient( info.value( 0 ) ); QString contents ( info.value( 1 ) ); - kDebug() << "Stored offline message for" << recipient << ":" << contents; + kmDebug() << "Stored offline message for" << recipient << ":" << contents; #endif // Reset the session ID @@ -385,7 +385,7 @@ void OfflineImService::parseSecureResult( SoapMessage *message ) } else { - kWarning() << "Unknown response type" << resultName << "received from endpoint" << message->getEndPoint(); + kmWarning() << "Unknown response type" << resultName << "received from endpoint" << message->getEndPoint(); } } @@ -402,7 +402,7 @@ void OfflineImService::parseSecureResult( SoapMessage *message ) void OfflineImService::processGetMessageResult( SoapMessage *message ) { #ifdef KMESSDEBUG_OFFLINE_IM_GENERAL - kDebug() << "Parsing downloaded Offline-IM message."; + kmDebug() << "Parsing downloaded Offline-IM message."; #endif // Retrieve the data stored in the SOAP message @@ -439,21 +439,21 @@ void OfflineImService::processGetMessageResult( SoapMessage *message ) QString contentType( mimeMessage.getValue( "Content-Type" ) ); if( contentType.toLower() != "text/plain; charset=utf-8" ) { - kWarning() << "Received unexpected content type:" << contentType; + kmWarning() << "Received unexpected content type:" << contentType; } // Validate transfer encoding QString transferEncoding( mimeMessage.getValue( "Content-Transfer-Encoding" ) ); if( transferEncoding != "base64" ) { - kWarning() << "Received unexpected transfer encoding:" << transferEncoding; + kmWarning() << "Received unexpected transfer encoding:" << transferEncoding; } // Validate message type QString messageType( mimeMessage.getValue( "X-OIM-Message-Type" ) ); if( messageType != "OfflineMessage" ) { - kWarning() << "Received unexpected message type:" << messageType; + kmWarning() << "Received unexpected message type:" << messageType; } // Process the body diff --git a/src/network/soap/passportloginservice.cpp b/src/network/soap/passportloginservice.cpp index d5471a3..dc1bb29 100644 --- a/src/network/soap/passportloginservice.cpp +++ b/src/network/soap/passportloginservice.cpp @@ -86,7 +86,7 @@ PassportLoginService::~PassportLoginService() void PassportLoginService::login( const QString ¶meters ) { #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Logging in..."; + kmDebug() << "Logging in..."; #endif // Store the account and login data @@ -113,6 +113,10 @@ void PassportLoginService::login( const QString ¶meters ) KMESS_ASSERT( ! password_.isEmpty() ); #endif + // The Live platform doesn't accept passwords longer than 16 characters. + // Great security measure, good job Microsoft! + password_.truncate( 16 ); + // Send the login request requestMultipleSecurityTokens(); } @@ -201,7 +205,7 @@ void PassportLoginService::parseSecureResult( SoapMessage *message ) { const QString resultType( message->getBody().firstChildElement().nodeName() ); - kWarning() << "Could not parse response type" << resultType + kmWarning() << "Could not parse response type" << resultType << "from endpoint" << message->getEndPoint(); emit soapError( i18nc( "Error message (sytem-generated description)", @@ -283,7 +287,7 @@ void PassportLoginService::parseSoapFault( SoapMessage *message ) // Should never happen if( ! message->isFaultMessage() ) { - kWarning() << "Incorrect fault detected on incoming message"; + kmWarning() << "Incorrect fault detected on incoming message"; return; } @@ -294,7 +298,7 @@ void PassportLoginService::parseSoapFault( SoapMessage *message ) if( faultCode == "wsse:FailedAuthentication" ) { #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Authentication failed!"; + kmDebug() << "Authentication failed!"; #endif emit loginIncorrect(); @@ -436,8 +440,8 @@ void PassportLoginService::parseSoapResult( SoapMessage *message ) } #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Current date:" << QDateTime::currentDateTime(); - kDebug() << "Obtaining security tokens.."; + kmDebug() << "Current date:" << QDateTime::currentDateTime(); + kmDebug() << "Obtaining security tokens.."; #endif const QDomNodeList authTokens( body.childNodes() ); @@ -450,7 +454,7 @@ void PassportLoginService::parseSoapResult( SoapMessage *message ) const QDateTime &now = QDateTime::currentDateTime(); #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Current date and time:" << now; + kmDebug() << "Current date and time:" << now; #endif // Set the token and proof for hotmail live services (mail, spaces etc..) @@ -490,7 +494,7 @@ void PassportLoginService::parseSoapResult( SoapMessage *message ) if( ! creationDate.isValid() || ! expirationDate.isValid() ) { #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Invalid token creation/expiration dates. Defaulting to 8 hours duration for token on next line:"; + kmDebug() << "Invalid token creation/expiration dates. Defaulting to 8 hours duration for token on next line:"; #endif ticketDuration = 3600 * 8; } @@ -502,11 +506,11 @@ void PassportLoginService::parseSoapResult( SoapMessage *message ) const QDateTime &localExpirationDate = now.addSecs( ticketDuration ); #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "--"; - kDebug() << "Found token for endpoint:" << referenceEndPoint << "with a duration of" << ticketDuration << "seconds."; - kDebug() << "Created:" << creationString + kmDebug() << "--"; + kmDebug() << "Found token for endpoint:" << referenceEndPoint << "with a duration of" << ticketDuration << "seconds."; + kmDebug() << "Created:" << creationString << "Expires:" << expirationString; - kDebug() << "Expires at local time:" << localExpirationDate; + kmDebug() << "Expires at local time:" << localExpirationDate; #endif if( referenceEndPoint == "http://Passport.NET/tb" ) @@ -560,7 +564,7 @@ void PassportLoginService::parseSoapResult( SoapMessage *message ) } #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Obtained" << tokens.count() << "security tokens:" << tokens.keys(); + kmDebug() << "Obtained" << tokens.count() << "security tokens:" << tokens.keys(); #endif // Save the tokens @@ -576,7 +580,7 @@ void PassportLoginService::parseSoapResult( SoapMessage *message ) sendSecureRequest( it.key(), it.value() ); } #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Sent" << queuedRequests_.count() << "queued messages."; + kmDebug() << "Sent" << queuedRequests_.count() << "queued messages."; #endif @@ -644,7 +648,7 @@ void PassportLoginService::parseSoapResult( SoapMessage *message ) void PassportLoginService::requestMultipleSecurityTokens() { #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Requesting security tokens"; + kmDebug() << "Requesting security tokens"; #endif const QString authParams( KMessShared::htmlEscape( QUrl::fromPercentEncoding( authenticationParameters_.toUtf8() ) @@ -775,7 +779,7 @@ void PassportLoginService::sendSecureRequest( SoapMessage *message, const QStrin } #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Sending secure request with token:" << requiredTokenName; + kmDebug() << "Sending secure request with token:" << requiredTokenName; #endif const QString tokenValue( currentAccount_->getToken( requiredTokenName ) ); @@ -784,16 +788,16 @@ void PassportLoginService::sendSecureRequest( SoapMessage *message, const QStrin int timeDifference = QDateTime::currentDateTime().secsTo( tokenExpiration ); #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Token has a value?" << (!tokenValue.isEmpty()); - kDebug() << "Current time:" << QDateTime::currentDateTime(); - kDebug() << "Token expires on:" << tokenExpiration << ", that is within seconds:" << timeDifference; + kmDebug() << "Token has a value?" << (!tokenValue.isEmpty()); + kmDebug() << "Current time:" << QDateTime::currentDateTime(); + kmDebug() << "Token expires on:" << tokenExpiration << ", that is within seconds:" << timeDifference; #endif // If there is no value for this token, or the token is about to expire, ask a new one if( tokenValue.isEmpty() || timeDifference < 10 ) { #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Token is expired or invalid."; + kmDebug() << "Token is expired or invalid."; #endif // Queue the message @@ -806,13 +810,13 @@ void PassportLoginService::sendSecureRequest( SoapMessage *message, const QStrin if( isWaitingForNewTokens_ ) { #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Already requesting new tokens."; + kmDebug() << "Already requesting new tokens."; #endif return; } #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Asking for new tokens."; + kmDebug() << "Asking for new tokens."; #endif // Ask for new tokens, altogether instead of just one at a time, @@ -822,7 +826,7 @@ void PassportLoginService::sendSecureRequest( SoapMessage *message, const QStrin } #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Token is valid, adding it to the request."; + kmDebug() << "Token is valid, adding it to the request."; #endif // Insert the token value within the SOAP message header @@ -840,7 +844,7 @@ void PassportLoginService::sendSecureRequest( SoapMessage *message, const QStrin // None of the ticket token tags were found, send the message as is if( list.isEmpty() ) { - kWarning() << "Token tag not found! Sending the request as is."; + kmWarning() << "Token tag not found! Sending the request as is."; sendRequest( message ); return; @@ -854,7 +858,7 @@ void PassportLoginService::sendSecureRequest( SoapMessage *message, const QStrin if( item.tagName() == "TicketToken" ) { #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "TicketToken tag found!"; + kmDebug() << "TicketToken tag found!"; #endif // If there is a child text node, simply replace its text @@ -874,7 +878,7 @@ void PassportLoginService::sendSecureRequest( SoapMessage *message, const QStrin if( item.tagName() == "Ticket" ) { #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Ticket tag found!"; + kmDebug() << "Ticket tag found!"; #endif item.setAttribute( "passport", tokenValue ); break; @@ -889,7 +893,7 @@ void PassportLoginService::sendSecureRequest( SoapMessage *message, const QStrin inProgressRequests_.insert( message, requiredTokenName ); #ifdef KMESSDEBUG_PASSPORTLOGINSERVICE - kDebug() << "Sending authenticated request."; + kmDebug() << "Sending authenticated request."; #endif // Send the changed message diff --git a/src/network/soap/roamingservice.cpp b/src/network/soap/roamingservice.cpp index ff65c61..f1eb803 100644 --- a/src/network/soap/roamingservice.cpp +++ b/src/network/soap/roamingservice.cpp @@ -138,7 +138,7 @@ void RoamingService::updateProfile() if( profileResourceId_.isEmpty() ) { - kWarning() << "Missing profileResourceId, not updating profile"; + kmWarning() << "Missing profileResourceId, not updating profile"; return; } @@ -146,7 +146,7 @@ void RoamingService::updateProfile() currentAccount->getFriendlyName( STRING_ORIGINAL ) == lastKnownFriendlyName_ ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Personal message and friendly name are same as on server; not uploading changes."; + kmDebug() << "Personal message and friendly name are same as on server; not uploading changes."; #endif return; } @@ -157,7 +157,7 @@ void RoamingService::updateProfile() lastKnownFriendlyName_ = currentAccount->getFriendlyName( STRING_ORIGINAL ); #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Uploading personal message, profile ID:" << profileResourceId_; + kmDebug() << "Uploading personal message, profile ID:" << profileResourceId_; #endif QString body( "\n" "\n" @@ -194,7 +194,7 @@ void RoamingService::updateDisplayPicture() if( profileResourceId_.isEmpty() ) { - kWarning() << "Missing profileResourceId, not updating display picture"; + kmWarning() << "Missing profileResourceId, not updating display picture"; return; } @@ -202,7 +202,7 @@ void RoamingService::updateDisplayPicture() if( path == lastKnownDisplayPicturePath_ ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Not updating display picture, already the same as on the server."; + kmDebug() << "Not updating display picture, already the same as on the server."; #endif return; } @@ -212,7 +212,7 @@ void RoamingService::updateDisplayPicture() if( ! displayPictureResourceId_.isEmpty() ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Deleting the previous display picture on the server."; + kmDebug() << "Deleting the previous display picture on the server."; #endif deleteRelationships( "", displayPictureResourceId_ ); deleteRelationships( profileResourceId_, displayPictureResourceId_ ); @@ -220,7 +220,7 @@ void RoamingService::updateDisplayPicture() // upload new picture #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Uploading new display picture."; + kmDebug() << "Uploading new display picture."; #endif QFile file( currentAccount->getPicturePath() ); if( file.open( QIODevice::ReadOnly ) ) @@ -236,7 +236,7 @@ void RoamingService::updateDisplayPicture() } else { - kWarning() << "Failed to read display picture from file" << currentAccount->getPicturePath(); + kmWarning() << "Failed to read display picture from file" << currentAccount->getPicturePath(); } } @@ -248,7 +248,7 @@ void RoamingService::parseSecureFault( SoapMessage *message ) // Should never happen if( ! message->isFaultMessage() ) { - kWarning() << "Incorrect fault detected on incoming message"; + kmWarning() << "Incorrect fault detected on incoming message"; return; } @@ -263,19 +263,19 @@ void RoamingService::parseSecureFault( SoapMessage *message ) if( errorCode == "ItemDoesNotExist" ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "The profile of the user does not exist: creating one."; + kmDebug() << "The profile of the user does not exist: creating one."; #endif createProfile(); return; } else if( errorCode == "ItemAlreadyExists" ) { - kWarning() << "The profile of the user already exists"; + kmWarning() << "The profile of the user already exists"; } } else { - kWarning() << "Invalid web service request:" << message->getFaultDescription(); + kmWarning() << "Invalid web service request:" << message->getFaultDescription(); } } @@ -290,14 +290,14 @@ void RoamingService::parseSecureResult( SoapMessage *message ) if( resultName == "GetProfileResponse" ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Getting profile response:" << profileResourceId_; + kmDebug() << "Getting profile response:" << profileResourceId_; #endif processProfileResult( body ); } else if( resultName == "UpdateProfileResponse" ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Updated profile:" << profileResourceId_; + kmDebug() << "Updated profile:" << profileResourceId_; #endif return; } @@ -306,7 +306,7 @@ void RoamingService::parseSecureResult( SoapMessage *message ) profileResourceId_ = XmlFunctions::getNodeValue( body, "CreateProfileResponse/CreateProfileResult" ); #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Created profile:" << profileResourceId_; + kmDebug() << "Created profile:" << profileResourceId_; #endif // Empty profile was created, update it updateProfile(); @@ -314,7 +314,7 @@ void RoamingService::parseSecureResult( SoapMessage *message ) else if( resultName == "DeleteRelationshipsResponse" ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Relationship deleted"; + kmDebug() << "Relationship deleted"; #endif return; @@ -322,7 +322,7 @@ void RoamingService::parseSecureResult( SoapMessage *message ) else if( resultName == "CreateDocumentResponse" ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Document created"; + kmDebug() << "Document created"; #endif displayPictureResourceId_ = XmlFunctions::getNodeValue( body, "CreateDocumentResponse/CreateDocumentResult" ); @@ -332,13 +332,13 @@ void RoamingService::parseSecureResult( SoapMessage *message ) else if( resultName == "CreateRelationshipsResponse" ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Relationship created"; + kmDebug() << "Relationship created"; #endif return; } else { - kWarning() << "Unknown response type" << resultName << "received from endpoint" << message->getEndPoint(); + kmWarning() << "Unknown response type" << resultName << "received from endpoint" << message->getEndPoint(); } } @@ -366,13 +366,13 @@ void RoamingService::processProfileResult( const QDomElement &body ) lastKnownPersonalMessage_ = QString::fromUtf8( lastKnownPersonalMessage_.toAscii() ); #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Got profile result:" << profileResourceId_; + kmDebug() << "Got profile result:" << profileResourceId_; #endif #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Received friendly name from Storage:" << lastKnownFriendlyName_; - kDebug() << "Received personalMessage from Storage:" << lastKnownPersonalMessage_; - kDebug() << "Received displayPicture location from server:" << fullPictureUrl; + kmDebug() << "Received friendly name from Storage:" << lastKnownFriendlyName_; + kmDebug() << "Received personalMessage from Storage:" << lastKnownPersonalMessage_; + kmDebug() << "Received displayPicture location from server:" << fullPictureUrl; #endif // Don't update the details if they're not valid @@ -389,7 +389,7 @@ void RoamingService::processProfileResult( const QDomElement &body ) if( fullPictureUrl.isEmpty() || ! currentAccount->getShowPicture() ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Display picture disabled, not using received picture:" << fullPictureUrl; + kmDebug() << "Display picture disabled, not using received picture:" << fullPictureUrl; #endif return; } @@ -401,7 +401,7 @@ void RoamingService::processProfileResult( const QDomElement &body ) if( QFile::exists( localPicture ) ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Have a local picture with the same name (" << localPicture << "), not downloading display picture"; + kmDebug() << "Have a local picture with the same name (" << localPicture << "), not downloading display picture"; #endif lastKnownDisplayPicturePath_ = localPicture; currentAccount->setPicturePath( localPicture ); @@ -418,7 +418,7 @@ void RoamingService::processProfileResult( const QDomElement &body ) || info.lastModified() < KDateTime::fromString( pictureLastModified, KDateTime::ISODate ).toClockTime().dateTime() ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Downloading display picture from storage"; + kmDebug() << "Downloading display picture from storage"; #endif // Download the picture from the server into a temporary file QNetworkAccessManager *manager = new QNetworkAccessManager( this ); @@ -431,13 +431,13 @@ void RoamingService::processProfileResult( const QDomElement &body ) else { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "DP path:" << displayPicturePath << " Last modification date:" << info.lastModified() + kmDebug() << "DP path:" << displayPicturePath << " Last modification date:" << info.lastModified() << "vs. server dp's date:" << KDateTime::fromString( pictureLastModified, KDateTime::ISODate ).toClockTime().dateTime(); #endif } #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Done."; + kmDebug() << "Done."; #endif } @@ -449,13 +449,13 @@ void RoamingService::receivedDisplayPicture( QNetworkReply *reply ) CurrentAccount *currentAccount = CurrentAccount::instance(); #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Saving received display picture of size" << reply->size(); + kmDebug() << "Saving received display picture of size" << reply->size(); #endif if( reply->size() == 0 ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Received empty content, ignoring response."; + kmDebug() << "Received empty content, ignoring response."; #endif return; } @@ -463,8 +463,8 @@ void RoamingService::receivedDisplayPicture( QNetworkReply *reply ) if( ! reply->header( QNetworkRequest::LocationHeader ).toString().isEmpty() ) { #ifdef KMESSDEBUG_ROAMINGSERVICE - kDebug() << "Received Location: header, ignoring response."; - kDebug() << "Location:" << reply->header( QNetworkRequest::LocationHeader ).toString(); + kmDebug() << "Received Location: header, ignoring response."; + kmDebug() << "Location:" << reply->header( QNetworkRequest::LocationHeader ).toString(); #endif return; } @@ -526,12 +526,12 @@ void RoamingService::receivedDisplayPicture( QNetworkReply *reply ) if( ! pictureFolder.exists( pictureName ) && ! pictureFolder.rename( tempPicturePath, pictureName ) ) { - kWarning() << "The display picture file could not be renamed from" << tempPicturePath << "to" << pictureName << "."; + kmWarning() << "The display picture file could not be renamed from" << tempPicturePath << "to" << pictureName << "."; } #ifdef KMESSDEBUG_ROAMINGSERVICE else { - kDebug() << "Saved display picture as" << ( pictureDir + pictureName ); + kmDebug() << "Saved display picture as" << ( pictureDir + pictureName ); } #endif diff --git a/src/network/soap/soapmessage.cpp b/src/network/soap/soapmessage.cpp index 47261f1..1a7f9ad 100644 --- a/src/network/soap/soapmessage.cpp +++ b/src/network/soap/soapmessage.cpp @@ -233,7 +233,7 @@ void SoapMessage::setMessage( const QString &message ) fault_ = QDomNode(); header_ = QDomNode(); - kWarning() << "XML parsing failed (code" << faultCode_ << "):" << faultDescription_ << "."; + kmWarning() << "XML parsing failed (code" << faultCode_ << "):" << faultDescription_ << "."; return; } @@ -270,7 +270,7 @@ void SoapMessage::setMessage( const QString &message ) faultCode_ = "missingBody"; faultDescription_ = "message body is not present"; - kWarning() << "XML parsing failed (code" << faultCode_ << "):" << faultDescription_ << "."; + kmWarning() << "XML parsing failed (code" << faultCode_ << "):" << faultDescription_ << "."; return; } } diff --git a/src/notification/addressbooknotifications.cpp b/src/notification/addressbooknotifications.cpp new file mode 100644 index 0000000..d9a6ba5 --- /dev/null +++ b/src/notification/addressbooknotifications.cpp @@ -0,0 +1,146 @@ +/*************************************************************************** + addcontactnotification.cpp - AddressBookService notifications + ------------------- + begin : Saturday August 7 2010 + copyright : (C) 2010 by Timo Tambet + email : ttambet@gmail.com + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 "addressbooknotifications.h" +#include "../kmessdebug.h" +#include "notificationmanager.h" +#include "../network/soap/addressbookservice.h" + + +#include +#include + +// Class constructor +AddressBookNotifications::AddressBookNotifications( NotificationManager* manager ) +: manager_(manager) +{ + // Connect the activation signal to process notification actions + connect( manager_, SIGNAL( eventActivated(NotificationManager::EventSettings, NotificationManager::Buttons) ), + this, SLOT ( activate(NotificationManager::EventSettings, NotificationManager::Buttons) ) ); +} + + + +// Execute the action triggered in a notification +void AddressBookNotifications::activate( NotificationManager::EventSettings settings, NotificationManager::Buttons button ) +{ + // The signal wasn't meant for us + if( settings.sender != this ) + { + return; + } + + switch( button ) + { + case NotificationManager::BUTTON_HIDE: +#ifdef KMESSDEBUG_ADDRESSBOOKNOTIFICATIONS + kmDebug() << "Hiding added contact notification"; +#endif + break; + default: +#ifdef KMESSDEBUG_ADDRESSBOOKNOTIFICATIONS + kmDebug() << "Invalid button" << button; +#endif + return; + } +} + + + +// Notify the user about this event (a new contact adding success) +void AddressBookNotifications::notify( const QString& id, AddressBookService::AddressBookUpdate updateType ) +{ + QString text; + QString notifyName; + + switch( updateType ) + { + case AddressBookService::ContactAdded: + case AddressBookService::ContactDeleted: + case AddressBookService::ContactDeletedFromGroup: + case AddressBookService::ContactAddedToGroup: + case AddressBookService::ContactBlocked: + case AddressBookService::ContactUnblock: + notifyName = "contact changed"; + break; + + case AddressBookService::GroupAdded: + case AddressBookService::GroupDeleted: + case AddressBookService::GroupRenamed: + notifyName = "group changed"; + break; + + default: + kmWarning() << "Unknown AB change type:" << updateType; + break; + } + + if ( updateType == AddressBookService::ContactAdded ) + { + // id holds the new contact's handle + text = i18n( "Contact %1 added successfully.", id ); + } + else if ( updateType == AddressBookService::ContactDeleted ) + { + // FIXME: Add Contact name in addressbookservice.cpp + text = i18n( "Contact deleted successfully" ); + } + else if ( updateType == AddressBookService::GroupAdded ) + { + // FIXME: Add group name in addressbookservice.cpp + text = i18n( "Group added successfully." ); + } + else if ( updateType == AddressBookService::GroupDeleted ) + { + // FIXME: Add group name in addressbookservice.cpp + text = i18n( "Group deleted successfully." ); + } + else if ( updateType == AddressBookService::GroupRenamed ) + { + text = i18n( "Group %1 successfully renamed.", id ); + } + else if ( updateType == AddressBookService::ContactUnblock ) + { + text = i18n( "Contact %1 has been unblocked.", id ); + } + else if ( updateType == AddressBookService::ContactBlocked ) + { + text = i18n( "Contact %1 has been blocked.", id ); + } + else if ( updateType == AddressBookService::ContactAddedToGroup ) + { + // FIXME: Add contact name in addressbookservice.cpp + text = i18n( "Contact added to group." ); + } + else if ( updateType == AddressBookService::ContactDeletedFromGroup ) + { + // FIXME: Add contact name in addressbookservice.cpp + text = i18n( "Contact removed from group." ); + } + + NotificationManager::EventSettings settings; + settings.sender = this; + settings.widget = 0; + settings.contact = 0; + settings.buttons = NotificationManager::BUTTON_HIDE; + + manager_->notify( notifyName, text, settings ); +} + + + +#include "addressbooknotifications.moc" diff --git a/src/notification/addressbooknotifications.h b/src/notification/addressbooknotifications.h new file mode 100644 index 0000000..2649d11 --- /dev/null +++ b/src/notification/addressbooknotifications.h @@ -0,0 +1,42 @@ +#ifndef ADDRESSBOOKNOTIFICATIONS_H +#define ADDRESSBOOKNOTIFICATIONS_H + +#include "notificationmanager.h" +#include "../network/msnnotificationconnection.h" + +// Forward declarations +class NotificationManager; +class AddressBookService; + + +/** + * @brief All notifications that relate to AddressBookService (contact/group added/deleted) + * + * Notification is made via a popup balloon and a sound (which can be customized) + * + * @author Timo Tambet + * @ingroup Notification + */ +class AddressBookNotifications : public QObject +{ + Q_OBJECT + + public: // Public methods + // Class constructor + AddressBookNotifications( NotificationManager* manager ); + + public slots: + // Notify the user about this event (a contact has contacted the user) + void notify( const QString& id, AddressBookService::AddressBookUpdate updateType ); + + private slots: + // Execute the action triggered in a notification + void activate( NotificationManager::EventSettings settings, NotificationManager::Buttons button ); + + private: // Private properties + // The notification manager instance + NotificationManager *manager_; + +}; + +#endif diff --git a/src/notification/chatnotification.cpp b/src/notification/chatnotification.cpp index 5412c4a..5860f4e 100644 --- a/src/notification/chatnotification.cpp +++ b/src/notification/chatnotification.cpp @@ -63,21 +63,21 @@ void ChatNotification::activate( NotificationManager::EventSettings settings, No { case NotificationManager::BUTTON_VIEW_MESSAGE: #ifdef KMESSDEBUG_CHATNOTIFICATION - kDebug() << "Raising chat with" << settings.contact->getHandle(); + kmDebug() << "Raising chat with" << settings.contact->getHandle(); #endif emit raiseChat( static_cast( settings.widget ), true ); break; case NotificationManager::BUTTON_HIDE: #ifdef KMESSDEBUG_CHATNOTIFICATION - kDebug() << "Hiding chat notification"; + kmDebug() << "Hiding chat notification"; #endif // Do nothing break; default: #ifdef KMESSDEBUG_CHATNOTIFICATION - kDebug() << "Invalid button" << button; + kmDebug() << "Invalid button" << button; #endif return; } @@ -92,7 +92,7 @@ void ChatNotification::notify( const ChatMessage &message, Chat *chat ) if( ! message.isIncoming() ) { #ifdef KMESSDEBUG_CHATNOTIFICATION - kDebug() << "Not displaying a popup for an outgoing message."; + kmDebug() << "Not displaying a popup for an outgoing message."; #endif return; } @@ -101,7 +101,7 @@ void ChatNotification::notify( const ChatMessage &message, Chat *chat ) if( ! chat ) { #ifdef KMESSDEBUG_CHATNOTIFICATION - kDebug() << "Invalid pointer to chat window."; + kmDebug() << "Invalid pointer to chat window."; #endif return; } @@ -111,7 +111,7 @@ void ChatNotification::notify( const ChatMessage &message, Chat *chat ) && chat == chat->getChatWindow()->getCurrentChat() ) { #ifdef KMESSDEBUG_CHATNOTIFICATION - kDebug() << "Window is active, skipping."; + kmDebug() << "Window is active, skipping."; #endif return; } @@ -129,7 +129,7 @@ void ChatNotification::notify( const ChatMessage &message, Chat *chat ) { if( contactDetail->getExtension()->getDisableNotifications() ) { - kDebug() << "The contact: " << handle << " has the notification disabled, skip it"; + kmDebug() << "The contact: " << handle << " has the notification disabled, skip it"; return; } contact = static_cast (contactDetail); @@ -145,10 +145,12 @@ void ChatNotification::notify( const ChatMessage &message, Chat *chat ) contact = currentAccount->addInvitedContact( handle ); } - const QString& friendlyName = contact->getFriendlyName( STRING_LIST_SETTING_ESCAPED ); + // KNotify kills formatting by cropping strings in the middle of HTML codes. Remove it. + const QString& friendlyName = contact->getFriendlyName( STRING_CLEANED_ESCAPED ); + RichTextParser::getCleanString( body ); #ifdef KMESSDEBUG_CHATNOTIFICATION - kDebug() << "Contact" << handle; + kmDebug() << "Contact" << handle; #endif // Truncate the message so it doesn't make the balloon too big @@ -158,12 +160,6 @@ void ChatNotification::notify( const ChatMessage &message, Chat *chat ) body += " ..."; } - // Parse the emoticons in the message - if( ! message.hasHtmlBody() ) - { - RichTextParser::parseMsnString( body, true, true, false, false ); - } - // Set the balloon text to a generic message, which will be overridden with more useful messages, if available switch( messageType ) { diff --git a/src/notification/contactstatusnotification.cpp b/src/notification/contactstatusnotification.cpp index 9243970..efb6c26 100644 --- a/src/notification/contactstatusnotification.cpp +++ b/src/notification/contactstatusnotification.cpp @@ -61,21 +61,21 @@ void ContactStatusNotification::activate( NotificationManager::EventSettings set case NotificationManager::BUTTON_OPEN_CHAT: case NotificationManager::BUTTON_OPEN_OFFLINE_CHAT: #ifdef KMESSDEBUG_CONTACTSTATUSNOTIFICATION - kDebug() << "Opening a chat with" << settings.contact->getHandle(); + kmDebug() << "Opening a chat with" << settings.contact->getHandle(); #endif emit startChat( settings.contact->getHandle() ); break; case NotificationManager::BUTTON_HIDE: #ifdef KMESSDEBUG_CONTACTSTATUSNOTIFICATION - kDebug() << "Hiding status notification"; + kmDebug() << "Hiding status notification"; #endif // Do nothing break; default: #ifdef KMESSDEBUG_CONTACTSTATUSNOTIFICATION - kDebug() << "Invalid button" << button; + kmDebug() << "Invalid button" << button; #endif return; } @@ -98,7 +98,7 @@ const QString ContactStatusNotification::getStatusString( const Status status, c case STATUS_ON_THE_PHONE: return i18n( "%1
is on the phone", friendlyName ); case STATUS_OUT_TO_LUNCH: return i18n( "%1
is out for lunch", friendlyName ); default: - kWarning() << "Invalid status" << status << "!"; + kmWarning() << "Invalid status" << status << "!"; return getStatusString( STATUS_ONLINE, friendlyName ); } } @@ -110,7 +110,7 @@ void ContactStatusNotification::notify( Contact *contact, bool isNeeded ) { if( contact == 0 ) { - kWarning() << "Contact is null!"; + kmWarning() << "Contact is null!"; return; } @@ -120,19 +120,20 @@ void ContactStatusNotification::notify( Contact *contact, bool isNeeded ) if( ! isNeeded || contact->getExtension()->getDisableNotifications() ) { #ifdef KMESSDEBUG_CONTACTSTATUSNOTIFICATION - kDebug() << "Not needed, skipping."; + kmDebug() << "Not needed, skipping."; #endif return; } + // KNotify kills formatting by cropping strings in the middle of HTML codes. Remove it. + const QString& friendlyName = contact->getFriendlyName( STRING_CLEANED_ESCAPED ); - const QString& friendlyName = contact->getFriendlyName( STRING_LIST_SETTING_ESCAPED ); QString text; Status status = contact->getStatus(); Status lastStatus = contact->getLastStatus(); #ifdef KMESSDEBUG_CONTACTSTATUSNOTIFICATION - kDebug() << "Contact:" << contact->getHandle() + kmDebug() << "Contact:" << contact->getHandle() << "Status:" << MsnStatus::getCode( lastStatus ) << "->" << MsnStatus::getCode( status ); #endif @@ -156,7 +157,7 @@ void ContactStatusNotification::notify( Contact *contact, bool isNeeded ) if ( soundFile.exists() ) { #ifdef KMESSDEBUG_CONTACTSTATUSNOTIFICATION - kDebug() << "Play sound " << soundPath; + kmDebug() << "Play sound " << soundPath; #endif // Play the custom sound instead of the generic sound diff --git a/src/notification/newemailnotification.cpp b/src/notification/newemailnotification.cpp index 1e165f0..3abfed8 100644 --- a/src/notification/newemailnotification.cpp +++ b/src/notification/newemailnotification.cpp @@ -53,21 +53,21 @@ void NewEmailNotification::activate( NotificationManager::EventSettings settings { case NotificationManager::BUTTON_OPEN_MAILBOX: #ifdef KMESSDEBUG_NEWEMAILNOTIFICATION - kDebug() << "Opening mailbox on folder" << settings.data.toString(); + kmDebug() << "Opening mailbox on folder" << settings.data.toString(); #endif CurrentAccount::instance()->openMail( settings.data.toString() ); break; case NotificationManager::BUTTON_HIDE: #ifdef KMESSDEBUG_NEWEMAILNOTIFICATION - kDebug() << "Hiding email notification"; + kmDebug() << "Hiding email notification"; #endif // Do nothing break; default: #ifdef KMESSDEBUG_NEWEMAILNOTIFICATION - kDebug() << "Invalid button" << button; + kmDebug() << "Invalid button" << button; #endif return; } @@ -83,7 +83,7 @@ void NewEmailNotification::notify( QString sender, QString subject, bool inInbox Q_UNUSED( command ); #ifdef KMESSDEBUG_NEWEMAILNOTIFICATION - kDebug() << "New email from" << sender << "- Is in inbox?" << inInbox; + kmDebug() << "New email from" << sender << "- Is in inbox?" << inInbox; #else Q_UNUSED( inInbox ); #endif diff --git a/src/notification/newsystemtraywidget.cpp b/src/notification/newsystemtraywidget.cpp index 321578b..c7f31b1 100644 --- a/src/notification/newsystemtraywidget.cpp +++ b/src/notification/newsystemtraywidget.cpp @@ -97,7 +97,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) "Use 'Quit' from the 'Connect' menu to quit the application.

" ) ); #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "Displaying close-to-tray dialog."; + kmDebug() << "Displaying close-to-tray dialog."; #endif // Make the icon to blink to help the user find it @@ -118,7 +118,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) SystemTrayWidget::~SystemTrayWidget() { #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -154,7 +154,7 @@ void SystemTrayWidget::statusChanged() if ( status != STATUS_OFFLINE ) { #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "Updating icon status to" << MsnStatus::getCode( status ); + kmDebug() << "Updating icon status to" << MsnStatus::getCode( status ); #endif if( ! account->isVerified() ) @@ -179,7 +179,7 @@ void SystemTrayWidget::statusChanged() else { #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "Updating icon"; + kmDebug() << "Updating icon"; #endif } diff --git a/src/notification/notificationmanager.cpp b/src/notification/notificationmanager.cpp index 9125ce1..ada467e 100644 --- a/src/notification/notificationmanager.cpp +++ b/src/notification/notificationmanager.cpp @@ -160,7 +160,7 @@ void NotificationManager::notify( const QString &event, const QString &text, Eve if( autoLock_->isScreenSaverActive() ) { #ifdef KMESSDEBUG_NOTIFICATIONMANAGER - kDebug() << "Screen saver/locker is active, not showing notifications."; + kmDebug() << "Screen saver/locker is active, not showing notifications."; #endif return; } @@ -172,7 +172,7 @@ void NotificationManager::notify( const QString &event, const QString &text, Eve && currentAccount->getHideNotificationsWhenBusy() ) { #ifdef KMESSDEBUG_NOTIFICATIONMANAGER - kDebug() << "User is busy, not showing notifications."; + kmDebug() << "User is busy, not showing notifications."; #endif return; } @@ -208,13 +208,13 @@ void NotificationManager::notify( const QString &event, const QString &text, Eve if( isFullscreen ) { - kDebug() << "Active window is full screen, not showing notifications."; + kmDebug() << "Active window is full screen, not showing notifications."; return; } #ifdef KMESSDEBUG_NOTIFICATIONMANAGER #ifdef Q_WS_X11 - kDebug() << "Active window was valid?" << info.valid() <<". If so, it is not fullscreen, showing notifications."; + kmDebug() << "Active window was valid?" << info.valid() <<". If so, it is not fullscreen, showing notifications."; #endif #endif @@ -225,7 +225,7 @@ void NotificationManager::notify( const QString &event, const QString &text, Eve if( notification ) { #ifdef KMESSDEBUG_NOTIFICATIONMANAGER - kDebug() << "Updating existing notification" << notification; + kmDebug() << "Updating existing notification" << notification; #endif notification->setText ( text ); notification->setActions( getButtonsLabels( settings.buttons ) ); @@ -248,7 +248,7 @@ void NotificationManager::notify( const QString &event, const QString &text, Eve notification = new KNotification( event ); #ifdef KMESSDEBUG_NOTIFICATIONMANAGER - kDebug() << "Showing notification" << notification << "for event" << event; + kmDebug() << "Showing notification" << notification << "for event" << event; #endif // Add it to our lists to be able to find it later @@ -301,12 +301,12 @@ void NotificationManager::relayActivation( unsigned int action ) KNotification *notification = static_cast( sender() ); if( ! notification || ! eventSettings_.contains( notification ) ) { - kWarning() << "Cannot relay notification activation, pointer" << notification << "not found!"; + kmWarning() << "Cannot relay notification activation, pointer" << notification << "not found!"; return; } #ifdef KMESSDEBUG_NOTIFICATIONMANAGER - kDebug() << "Relaying activation for notification" << notification; + kmDebug() << "Relaying activation for notification" << notification; #endif EventSettings settings = eventSettings_[ notification ]; @@ -329,7 +329,7 @@ void NotificationManager::remove( QObject *object ) if( notification == 0 ) { #ifdef KMESSDEBUG_NOTIFICATIONMANAGER - kDebug() << "Cannot remove notification, pointer" << notification << "not found!"; + kmDebug() << "Cannot remove notification, pointer" << notification << "not found!"; #endif return; } @@ -339,7 +339,7 @@ void NotificationManager::remove( QObject *object ) eventSettings_.remove( notification ); #ifdef KMESSDEBUG_NOTIFICATIONMANAGER - kDebug() << "Deleted notification" << notification << "from the stack"; + kmDebug() << "Deleted notification" << notification << "from the stack"; #endif #endif /* !Q_WS_MAC */ } diff --git a/src/notification/systemtraywidget.cpp b/src/notification/systemtraywidget.cpp index 6bc0cd9..775ecbf 100644 --- a/src/notification/systemtraywidget.cpp +++ b/src/notification/systemtraywidget.cpp @@ -89,7 +89,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) if( ! QSystemTrayIcon::isSystemTrayAvailable() || ! isVisible() ) { #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "Displaying simple dialog with no screenshot."; + kmDebug() << "Displaying simple dialog with no screenshot."; #endif KMessageBox::information( kapp->activeWindow(), message, @@ -99,7 +99,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) } #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "Displaying dialog with tray icon screenshot: generating image..."; + kmDebug() << "Displaying dialog with tray icon screenshot: generating image..."; #endif // Get initial position of the tray icon and the the screen size @@ -121,7 +121,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "Creating screenshot from area" << pictureArea << "using a desktop size of" << desktopArea << "and geometry" << pictureGeometry; + kmDebug() << "Creating screenshot from area" << pictureArea << "using a desktop size of" << desktopArea << "and geometry" << pictureGeometry; #endif // Grab an image of the screen which contains the tray icon @@ -137,7 +137,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) #ifdef KMESSDEBUG_SYSTEMTRAY else { - kDebug() << "Looks like the systray is invisible, not displaying the screenshot in the dialog."; + kmDebug() << "Looks like the systray is invisible, not displaying the screenshot in the dialog."; } #endif @@ -154,7 +154,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) circleArea.adjust( -CIRCLE_MARGINS, -CIRCLE_MARGINS, CIRCLE_MARGINS, CIRCLE_MARGINS ); #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "Picture geometry is" << pictureGeometry << "and circle area is" << circleArea; + kmDebug() << "Picture geometry is" << pictureGeometry << "and circle area is" << circleArea; #endif // Draw the circle with a dark shadow @@ -181,7 +181,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) finalShot.save( tempFile.fileName() ); #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "Temp file info" + kmDebug() << "Temp file info" << "- Name:" << tempFile.fileName() << "- Exists?" << tempFile.exists(); #endif @@ -206,7 +206,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) } #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "Dialog closed."; + kmDebug() << "Dialog closed."; #endif } @@ -216,7 +216,7 @@ void SystemTrayWidget::displayCloseMessage( QString /*fileMenu*/ ) SystemTrayWidget::~SystemTrayWidget() { #ifdef KMESSDEBUG_SYSTEMTRAY - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } diff --git a/src/settings/accountpage.cpp b/src/settings/accountpage.cpp index 2dd9c3c..51e47e8 100644 --- a/src/settings/accountpage.cpp +++ b/src/settings/accountpage.cpp @@ -337,7 +337,7 @@ void AccountPage::saveSettings( Account *account ) } else { - kWarning() << "The display picture file could not be renamed from" << tempPictureFile_ << "to" << pictureName << "."; + kmWarning() << "The display picture file could not be renamed from" << tempPictureFile_ << "to" << pictureName << "."; } } } @@ -539,7 +539,7 @@ void AccountPage::selectPicture( bool resize, QString picturePath ) if( ! dir.mkpath( file.absolutePath() ) ) { - kWarning() << "Making the account folder failed! Path was" << file.absolutePath(); + kmWarning() << "Making the account folder failed! Path was" << file.absolutePath(); } if( pictureData.save( tempPictureFile_, "PNG" ) ) @@ -595,7 +595,7 @@ void AccountPage::switchToTab( int tabIndex ) { if( ( tabIndex < 0 ) || tabIndex > tabWidget_->count() ) { - kWarning() << "Invalid tab index" << tabIndex << "selected!"; + kmWarning() << "Invalid tab index" << tabIndex << "selected!"; return; } diff --git a/src/settings/accountsettingsdialog.cpp b/src/settings/accountsettingsdialog.cpp index 611edb2..08a83e7 100644 --- a/src/settings/accountsettingsdialog.cpp +++ b/src/settings/accountsettingsdialog.cpp @@ -118,7 +118,7 @@ AccountSettingsDialog::~AccountSettingsDialog() instance_ = 0; #ifdef KMESSDEBUG_ACCOUNTSETTINGSDIALOG - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -131,7 +131,7 @@ void AccountSettingsDialog::loadSettings( Account *account, bool isCurrentAccoun if( account == 0 ) { - kWarning() << "Invalid account given!"; + kmWarning() << "Invalid account given!"; return; } diff --git a/src/settings/accountsmanagerpage.cpp b/src/settings/accountsmanagerpage.cpp index e3ece73..5e50928 100644 --- a/src/settings/accountsmanagerpage.cpp +++ b/src/settings/accountsmanagerpage.cpp @@ -117,7 +117,7 @@ void AccountsManagerPage::configureAccount() const QString accountHandle( selection->data( Qt::UserRole ).toString() ); #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "Opening Account Settings for account" << accountHandle << "."; + kmDebug() << "Opening Account Settings for account" << accountHandle << "."; #endif Account *account = accountsManager_->getAccountByHandle( accountHandle ); @@ -133,7 +133,7 @@ void AccountsManagerPage::deleteAccount() { if( accountsList_->selectedItems().isEmpty() ) { - kWarning() << "No account was selected for deletion!"; + kmWarning() << "No account was selected for deletion!"; return; } @@ -145,7 +145,7 @@ void AccountsManagerPage::deleteAccount() if( kmessApp->getContactListWindow()->isConnected() && CurrentAccount::instance()->getHandle() == handle ) { - kWarning() << "Cannot delete the current account!"; + kmWarning() << "Cannot delete the current account!"; return; } diff --git a/src/settings/chatstylepage.cpp b/src/settings/chatstylepage.cpp index 55f63e7..32fabcc 100644 --- a/src/settings/chatstylepage.cpp +++ b/src/settings/chatstylepage.cpp @@ -255,7 +255,7 @@ void ChatStylePage::loadSettings( const Account *account ) int item = chatStyle_->findText( account->getChatStyle(), Qt::MatchExactly | Qt::MatchCaseSensitive ); if( item == -1 ) { - kWarning() << "Current chat style was not found, attempting to revert to the default setting."; + kmWarning() << "Current chat style was not found, attempting to revert to the default setting."; item = chatStyle_->findText( "Default", Qt::MatchExactly | Qt::MatchCaseSensitive ); } @@ -337,7 +337,7 @@ void ChatStylePage::switchToTab( int tabIndex ) { if( ( tabIndex < 0 ) || tabIndex > tabWidget_->count() ) { - kWarning() << "Invalid tab index" << tabIndex << "selected!"; + kmWarning() << "Invalid tab index" << tabIndex << "selected!"; return; } diff --git a/src/settings/emoticonspage.cpp b/src/settings/emoticonspage.cpp index 275f7e3..4cff278 100644 --- a/src/settings/emoticonspage.cpp +++ b/src/settings/emoticonspage.cpp @@ -81,7 +81,7 @@ EmoticonsPage::~EmoticonsPage() if( emoticonTheme_ != 0 ) { #ifdef KMESSDEBUG_EMOTICONS_SETTINGS - kDebug() << "Deleting temporary theme."; + kmDebug() << "Deleting temporary theme."; #endif delete emoticonTheme_; } @@ -157,7 +157,7 @@ void EmoticonsPage::loadSettings( const Account *account ) accountHandle_ = account->getHandle(); #ifdef KMESSDEBUG_EMOTICONS_SETTINGS - kDebug() << "Loading emoticon settings for account " << accountHandle_ << " - Current is " << accountHandle_ << " ."; + kmDebug() << "Loading emoticon settings for account " << accountHandle_ << " - Current is " << accountHandle_ << " ."; #endif // Read the settings and set current emoticons @@ -173,7 +173,7 @@ void EmoticonsPage::loadSettings( const Account *account ) updateCustomEmoticonView(); #ifdef KMESSDEBUG_EMOTICONS_SETTINGS - kDebug() << "Done!"; + kmDebug() << "Done!"; #endif } @@ -288,7 +288,7 @@ void EmoticonsPage::switchToTab( int tabIndex ) { if( ( tabIndex < 0 ) || tabIndex > tabWidget_->count() ) { - kWarning() << "Invalid tab index" << tabIndex << "selected!"; + kmWarning() << "Invalid tab index" << tabIndex << "selected!"; return; } @@ -337,7 +337,7 @@ void EmoticonsPage::updateThemesList() const QStringList themesDirs( KGlobal::dirs()->findDirs("emoticons", "") ); #ifdef KMESSDEBUG_EMOTICONS_SETTINGS - kDebug() << "Theme dirs: " << themesDirs; + kmDebug() << "Theme dirs: " << themesDirs; #endif QDir themesDir; @@ -352,7 +352,7 @@ void EmoticonsPage::updateThemesList() foreach( const QString& themePath, themes ) { #ifdef KMESSDEBUG_EMOTICONS_SETTINGS - kDebug() << "Folder: " << themesPath << " - Theme: " << themePath; + kmDebug() << "Folder: " << themesPath << " - Theme: " << themePath; #endif // Add the theme to the list, using the directory name; its first valid emoticon is used as a preview const QPixmap previewPixmap( EmoticonTheme::getThemeIcon( themesPath + themePath ) ); @@ -366,7 +366,7 @@ void EmoticonsPage::updateThemesList() if( items.isEmpty() ) { - kWarning() << "Current emoticon style was not found, attempting to revert to the default setting."; + kmWarning() << "Current emoticon style was not found, attempting to revert to the default setting."; items = emoticonThemesList_->findItems( "KMess-new", Qt::MatchExactly | Qt::MatchCaseSensitive ); } else diff --git a/src/settings/globalsettingsdialog.cpp b/src/settings/globalsettingsdialog.cpp index 13feaf5..ccaee7c 100644 --- a/src/settings/globalsettingsdialog.cpp +++ b/src/settings/globalsettingsdialog.cpp @@ -85,7 +85,7 @@ GlobalSettingsDialog::~GlobalSettingsDialog() instance_ = 0; #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } diff --git a/src/settings/miscellaneouspage.cpp b/src/settings/miscellaneouspage.cpp index c37c998..c9f5071 100644 --- a/src/settings/miscellaneouspage.cpp +++ b/src/settings/miscellaneouspage.cpp @@ -62,7 +62,7 @@ MiscellaneousPage::MiscellaneousPage( QWidget *parent ) } #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "Adding browser to list:" << service->name() << " -> " << service->exec(); + kmDebug() << "Adding browser to list:" << service->name() << " -> " << service->exec(); #endif browsersCombo_->addItem( KIcon( service->icon() ), service->name(), QVariant( service->exec() ) ); } @@ -89,7 +89,7 @@ MiscellaneousPage::MiscellaneousPage( QWidget *parent ) } #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "Adding mail client to list:" << service->name() << " -> " << service->exec(); + kmDebug() << "Adding mail client to list:" << service->name() << " -> " << service->exec(); #endif mailClientsCombo_->addItem( KIcon( service->icon() ), service->name(), QVariant( service->exec() ) ); } @@ -193,7 +193,7 @@ void MiscellaneousPage::loadSettings( const KConfigGroup &group ) if( pos > -1 ) { #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "Browser setting - Changing current index to" << pos; + kmDebug() << "Browser setting - Changing current index to" << pos; #endif browsersCombo_->setCurrentIndex( pos ); } @@ -210,21 +210,21 @@ void MiscellaneousPage::loadSettings( const KConfigGroup &group ) if( pos > -1 ) { #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "Setting system preferred browser to" << pos; + kmDebug() << "Setting system preferred browser to" << pos; #endif browsersCombo_->setCurrentIndex( pos ); } else { #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "Not setting any browser"; + kmDebug() << "Not setting any browser"; #endif } } #ifdef KMESSDEBUG_SETTINGSDIALOG else { - kDebug() << "No service found: not setting any browser"; + kmDebug() << "No service found: not setting any browser"; } #endif } @@ -234,7 +234,7 @@ void MiscellaneousPage::loadSettings( const KConfigGroup &group ) if( pos > -1 ) { #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "Mail Client setting - Changing current index to" << pos; + kmDebug() << "Mail Client setting - Changing current index to" << pos; #endif mailClientsCombo_->setCurrentIndex( pos ); } @@ -251,21 +251,21 @@ void MiscellaneousPage::loadSettings( const KConfigGroup &group ) if( pos > -1 ) { #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "Setting system preferred mail client to" << pos; + kmDebug() << "Setting system preferred mail client to" << pos; #endif mailClientsCombo_->setCurrentIndex( pos ); } else { #ifdef KMESSDEBUG_SETTINGSDIALOG - kDebug() << "Not setting any mail client"; + kmDebug() << "Not setting any mail client"; #endif } } #ifdef KMESSDEBUG_SETTINGSDIALOG else { - kDebug() << "No service found: not setting any mail client"; + kmDebug() << "No service found: not setting any mail client"; } #endif } diff --git a/src/utils/crashhandler.cpp b/src/utils/crashhandler.cpp index f6a8fb8..5a22082 100644 --- a/src/utils/crashhandler.cpp +++ b/src/utils/crashhandler.cpp @@ -51,9 +51,9 @@ void CrashHandler::activate() #ifdef KMESSDEBUG_CRASHHANDLER #ifdef Q_WS_X11 - kDebug() << "Enabled custom crash handler"; + kmDebug() << "Enabled custom crash handler"; #else - kDebug() << "NOTICE: Crash handler is not enabled for this platform!"; + kmDebug() << "NOTICE: Crash handler is not enabled for this platform!"; #endif #endif } @@ -71,7 +71,7 @@ void CrashHandler::activate() */ void CrashHandler::kmessCrashed( int signal ) { - // We cannot use kDebug() here, it requires a KApplication! + // We cannot use kmDebug() here, it requires a KApplication! // Crashes when closing go even more wrong with it. Q_UNUSED( signal ); diff --git a/src/utils/idletimer.cpp b/src/utils/idletimer.cpp index ab1ab38..6497441 100644 --- a/src/utils/idletimer.cpp +++ b/src/utils/idletimer.cpp @@ -46,7 +46,7 @@ IdleTimer::~IdleTimer() { delete watcher_; #ifdef KMESSDEBUG_IDLETIMER - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -72,26 +72,26 @@ void IdleTimer::slotActivity() void IdleTimer::updateWatcher() { #ifdef KMESSDEBUG_IDLETIMER - kDebug(); + kmDebug(); #endif Account *account = CurrentAccount::instance(); watcher_->setTimeOut( account->getIdleTime() * 60 ); if ( account->getUseIdleTimer() ) { #ifdef KMESSDEBUG_IDLETIMER - kDebug() << "Start the timer."; + kmDebug() << "Start the timer."; #endif watcher_->startTimer(); } else { #ifdef KMESSDEBUG_IDLETIMER - kDebug() << "Stop the timer."; + kmDebug() << "Stop the timer."; #endif watcher_->stopTimer(); } #ifdef KMESSDEBUG_IDLETIMER - kDebug() << "Done updateWatcher()."; + kmDebug() << "Done updateWatcher()."; #endif } diff --git a/src/utils/kmess-send/CMakeLists.txt b/src/utils/kmess-send/CMakeLists.txt index 51f59ea..8d4a482 100644 --- a/src/utils/kmess-send/CMakeLists.txt +++ b/src/utils/kmess-send/CMakeLists.txt @@ -10,6 +10,7 @@ ADD_DEFINITIONS(-fPIC) ADD_LIBRARY( kmesssendpluginlib ../kmessdbusdatatypes.cpp ../../contact/msnstatus.cpp + ../../kmessdebug.cpp ) diff --git a/src/utils/kmess-send/kmesssendmenuitem.cpp b/src/utils/kmess-send/kmesssendmenuitem.cpp index 26ec424..1924fc3 100644 --- a/src/utils/kmess-send/kmesssendmenuitem.cpp +++ b/src/utils/kmess-send/kmesssendmenuitem.cpp @@ -32,7 +32,7 @@ KMessSendMenuItem::KMessSendMenuItem( DBusContact contact, QDBusInterface *dbusI dbusInterface_( dbusInterface ) { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Creating menuitem for" << contact.friendlyName << "with status" << contact.status; + kmDebug() << "Creating menuitem for" << contact.friendlyName << "with status" << contact.status; #endif } @@ -42,6 +42,6 @@ KMessSendMenuItem::KMessSendMenuItem( DBusContact contact, QDBusInterface *dbusI KMessSendMenuItem::~KMessSendMenuItem() { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } diff --git a/src/utils/kmess-send/kmesssendplugin.cpp b/src/utils/kmess-send/kmesssendplugin.cpp index 242e029..5a9ea6b 100644 --- a/src/utils/kmess-send/kmesssendplugin.cpp +++ b/src/utils/kmess-send/kmesssendplugin.cpp @@ -68,7 +68,7 @@ KMessSendPlugin::KMessSendPlugin( KonqPopupMenu *popupMenu, const QStringList & void KMessSendPlugin::setup( KActionCollection *actionCollection, const KonqPopupMenuInformation& popupMenuInfo, QMenu *menu ) { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Setting up plugin"; + kmDebug() << "Setting up plugin"; #endif // Remember currently selected files @@ -84,7 +84,7 @@ void KMessSendPlugin::setup( KActionCollection *actionCollection, const KonqPopu // Search for a running KMess instance #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Searching for KMess instances on DBus"; + kmDebug() << "Searching for KMess instances on DBus"; #endif const QStringList serviceNames = bus.interface()->registeredServiceNames(); @@ -96,7 +96,7 @@ void KMessSendPlugin::setup( KActionCollection *actionCollection, const KonqPopu if( service.startsWith( "org.kmess.kmess" ) ) { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << service; + kmDebug() << service; #endif instances << service; } @@ -106,7 +106,7 @@ void KMessSendPlugin::setup( KActionCollection *actionCollection, const KonqPopu if( instances.isEmpty() ) { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "No running KMess instance found, aborting"; + kmDebug() << "No running KMess instance found, aborting"; #endif return; @@ -127,7 +127,7 @@ void KMessSendPlugin::setup( KActionCollection *actionCollection, const KonqPopu foreach( service, instances ) { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Connecting to " + service; + kmDebug() << "Connecting to " + service; #endif // Open the found DBus interface QDBusInterface *dbusInterface = new QDBusInterface( service, "/remoteControl", "org.kmess.remoteControl", bus, this); @@ -137,7 +137,7 @@ void KMessSendPlugin::setup( KActionCollection *actionCollection, const KonqPopu if( !reply.isValid() ) { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Invalid reply when getting contactlist: " << reply.error(); + kmDebug() << "Invalid reply when getting contactlist: " << reply.error(); #endif sendMenu->setEnabled( false ); return; @@ -151,14 +151,14 @@ void KMessSendPlugin::setup( KActionCollection *actionCollection, const KonqPopu if( !nickName.isValid() ) { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Invalid reply when getting friendly name: " << reply.error(); + kmDebug() << "Invalid reply when getting friendly name: " << reply.error(); #endif sendMenu->setEnabled( false ); return; } #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Creating submenu for account " << nickName; + kmDebug() << "Creating submenu for account " << nickName; #endif subMenu = new KActionMenu( KIcon("kmess"), nickName, actionCollection); sendMenu->addAction( subMenu ); @@ -188,7 +188,7 @@ void KMessSendPlugin::setup( KActionCollection *actionCollection, const KonqPopu #ifdef KMESSDEBUG_KMESSSENDPLUGIN if( !contactsToShow ) { - kDebug() << "No contacts to show"; + kmDebug() << "No contacts to show"; } #endif subMenu->setEnabled( contactsToShow ); @@ -201,7 +201,7 @@ void KMessSendPlugin::setup( KActionCollection *actionCollection, const KonqPopu KMessSendPlugin::~KMessSendPlugin() { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -213,7 +213,7 @@ void KMessSendPlugin::slotSendFile() const KMessSendMenuItem *menuItem = dynamic_cast( sender() ); #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Sending Files to " << menuItem->contact_.handle << " via " << menuItem->dbusInterface_; + kmDebug() << "Sending Files to " << menuItem->contact_.handle << " via " << menuItem->dbusInterface_; #endif QStringListIterator i( itemList_ ); @@ -224,7 +224,7 @@ void KMessSendPlugin::slotSendFile() fileName = i.next(); #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Sending file" << fileName; + kmDebug() << "Sending file" << fileName; #endif QList args; @@ -236,7 +236,7 @@ void KMessSendPlugin::slotSendFile() if( !reply.isValid() ) { #ifdef KMESSDEBUG_KMESSSENDPLUGIN - kDebug() << "Failed to send files:" << reply.error(); + kmDebug() << "Failed to send files:" << reply.error(); #endif } } diff --git a/src/utils/kmessconfig.cpp b/src/utils/kmessconfig.cpp index 1f5e674..e2c6b48 100644 --- a/src/utils/kmessconfig.cpp +++ b/src/utils/kmessconfig.cpp @@ -62,7 +62,7 @@ KMessConfig::~KMessConfig() delete tempConfigFile_; - kDebug() << "DESTROYED"; + kmDebug() << "DESTROYED"; } @@ -88,7 +88,7 @@ bool KMessConfig::destroyConfigDir( const QString &fullDirPath ) { if( ! destroyConfigDir( entryPath ) ) { - kWarning() << "Cannot remove directory entry" << entryPath << "!"; + kmWarning() << "Cannot remove directory entry" << entryPath << "!"; } } else @@ -100,7 +100,7 @@ bool KMessConfig::destroyConfigDir( const QString &fullDirPath ) dir.cdUp(); if( ! dir.rmdir( fullDirPath ) ) { - kWarning() << "Cannot remove processed directory" << fullDirPath << "!"; + kmWarning() << "Cannot remove processed directory" << fullDirPath << "!"; return false; } @@ -313,7 +313,7 @@ KConfigGroup KMessConfig::getGlobalConfig( const QString &groupName ) KConfigGroup KMessConfig::getInvalidConfig() { #ifdef KMESSDEBUG_SHAREDMETHODS - kDebug() << "Switching to a temporary config file..."; + kmDebug() << "Switching to a temporary config file..."; #endif if( tempConfigFile_ == 0 ) diff --git a/src/utils/kmessdbus.cpp b/src/utils/kmessdbus.cpp index cbdd9e6..9d385c3 100644 --- a/src/utils/kmessdbus.cpp +++ b/src/utils/kmessdbus.cpp @@ -46,7 +46,7 @@ KMessDBus::KMessDBus( KMess *parent ) KMessDBus::~KMessDBus() { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -56,7 +56,7 @@ KMessDBus::~KMessDBus() void KMessDBus::connect() { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "Connect() called"; + kmDebug() << "Connect() called"; #endif if( ! kmess_->isConnected() ) @@ -71,7 +71,7 @@ void KMessDBus::connect() void KMessDBus::disconnect() { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "Disconnect() called"; + kmDebug() << "Disconnect() called"; #endif if( kmess_->isConnected() ) @@ -86,7 +86,7 @@ void KMessDBus::disconnect() bool KMessDBus::isConnected() { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "isConnected() called"; + kmDebug() << "isConnected() called"; #endif return kmess_->isConnected(); @@ -98,7 +98,7 @@ bool KMessDBus::isConnected() void KMessDBus::setStatus( int status ) { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "setStatus( int ) called"; + kmDebug() << "setStatus( int ) called"; #endif if( kmess_->isConnected() ) @@ -113,7 +113,7 @@ void KMessDBus::setStatus( int status ) int KMessDBus::getStatus() { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "getStatus() called"; + kmDebug() << "getStatus() called"; #endif return kmess_->currentAccount_->getStatus(); @@ -125,7 +125,7 @@ int KMessDBus::getStatus() void KMessDBus::setPersonalMessage( QString message ) { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "setPersonalMessage( QString message ) called"; + kmDebug() << "setPersonalMessage( QString message ) called"; #endif if( kmess_->isConnected() ) @@ -141,7 +141,7 @@ void KMessDBus::setPersonalMessage( QString message ) QString KMessDBus::getPersonalMessage() { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "getPersonalMessage() called"; + kmDebug() << "getPersonalMessage() called"; #endif //return kmess_->currentAccount_->getStatus(); @@ -158,13 +158,13 @@ QString KMessDBus::getPersonalMessage() QString KMessDBus::getFriendlyName( int formattingMode ) { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "getFriendlyname( int ) called"; + kmDebug() << "getFriendlyname( int ) called"; #endif if(formattingMode < 0 || formattingMode > 2 ) { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "Unknown formattingMode supplied (" << formattingMode << "), defaulting"; + kmDebug() << "Unknown formattingMode supplied (" << formattingMode << "), defaulting"; #endif return kmess_->currentAccount_->getFriendlyName(); @@ -186,7 +186,7 @@ static bool _compareDBusContact( const DBusContact &contact1, const DBusContact DBusContactList KMessDBus::getList() { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "getList() called"; + kmDebug() << "getList() called"; #endif QList list; @@ -219,7 +219,7 @@ DBusContactList KMessDBus::getList() void KMessDBus::requestChat( QString handle ) { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "startChat() called"; + kmDebug() << "startChat() called"; #endif kmess_->chatMaster_->requestChat( handle ); @@ -231,8 +231,8 @@ void KMessDBus::requestChat( QString handle ) void KMessDBus::startFileTransfer( QString handle, QString filename ) { #ifdef KMESSDEBUG_KMESSDBUS - kDebug() << "startFileTransfer() called"; - kDebug() << "sending file " << filename << " to " << handle; + kmDebug() << "startFileTransfer() called"; + kmDebug() << "sending file " << filename << " to " << handle; #endif kmess_->chatMaster_->startChatAndFileTransfer( handle, filename ); diff --git a/src/utils/kmessshared.cpp b/src/utils/kmessshared.cpp index ca4aa21..1c8e29e 100644 --- a/src/utils/kmessshared.cpp +++ b/src/utils/kmessshared.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -44,8 +45,47 @@ +/** + * Sorting helper, to compare two filenames using natural sorting. + * + * Usage of this method: + * @code + qSort( list.first(), list.last(), KMessShared::compareFileNames ); + * @endcode + * + * The names are compared naturally: 1 comes before 2, 10 and 20. + * For example, log file names always come in this form: "[.number].xml" + * and thus natural sorting keeps them in the right temporal order. + * + * @param name1 First filename + * @param name1 Second filename + * @return bool whether the first is lesser than the second + */ +bool KMessShared::compareFileNames( const QString& name1, const QString& name2 ) +{ + // Compare the raw filename size first: names with less characters naturally come first + if( name1.size() < name2.size() ) + { + return true; + } + + // Remove the .xml from the filenames: -4 characters to strip from the end of file + const int name1Size = name1.size(); + const int name2Size = name2.size(); + QString fileName1( name1Size > 4 ? name1.left( name1Size - 4 ) : name1 ); + QString fileName2( name2Size > 4 ? name2.left( name2Size - 4 ) : name2 ); + + // Compare the numbers with a natural sorting by extracting the number from the end of the filename + QString num1( fileName1.mid( fileName1.lastIndexOf( '.' ) + 1 ) ); + QString num2( fileName2.mid( fileName2.lastIndexOf( '.' ) + 1 ) ); + + return ( num1.toInt() < num2.toInt() ); +} + + + // Create a HMACSha1 hash -QByteArray KMessShared::createHMACSha1 ( const QByteArray &keyForHash , const QByteArray &secret ) +QByteArray KMessShared::createHMACSha1( const QByteArray &keyForHash , const QByteArray &secret ) { // The algorithm is definited into RFC 2104 int blocksize = 64; @@ -405,7 +445,7 @@ void KMessShared::openBrowser( const KUrl &url ) QString browserChoice( group.readEntry( "useBrowser", "KDE" ) ); #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "Opening URL" << url << "- The setting is" << browserChoice; + kmDebug() << "Opening URL" << url << "- The setting is" << browserChoice; #endif // If the preference had an invalid choice, use the KDE default browser. @@ -413,7 +453,7 @@ void KMessShared::openBrowser( const KUrl &url ) && browserChoice != "listed" && browserChoice != "KDE" ) { - kWarning() << "Invalid browser choice:" << browserChoice << ", using KDE default."; + kmWarning() << "Invalid browser choice:" << browserChoice << ", using KDE default."; browserChoice = "KDE"; } @@ -423,14 +463,14 @@ void KMessShared::openBrowser( const KUrl &url ) { browser = group.readEntry( "customBrowser", fallbackBrowser ); #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "Custom browser selected:" << browser; + kmDebug() << "Custom browser selected:" << browser; #endif } else if( browserChoice == "listed" ) { browser = group.readEntry( "listedBrowser", fallbackBrowser ); #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "Listed browser selected:" << browser; + kmDebug() << "Listed browser selected:" << browser; #endif } @@ -438,7 +478,7 @@ void KMessShared::openBrowser( const KUrl &url ) if( browser.isEmpty() ) { #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "Invalid browser option, using KDE default."; + kmDebug() << "Invalid browser option, using KDE default."; #endif browserChoice = "KDE"; } @@ -446,7 +486,7 @@ void KMessShared::openBrowser( const KUrl &url ) if( browserChoice == "KDE" ) { #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "KDE default browser selected."; + kmDebug() << "KDE default browser selected."; #endif KToolInvocation::invokeBrowser( url.url() ); return; @@ -498,7 +538,7 @@ void KMessShared::openEmailClient( const QString &mailto, const QString &folder, QString mailClientChoice( group.readEntry( "useMailClient", "KDE" ) ); #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "Opening mail at" << folder << "- The setting is" << mailClientChoice; + kmDebug() << "Opening mail at" << folder << "- The setting is" << mailClientChoice; #endif // If the preference had an invalid choice, use the KDE default mail client. @@ -506,7 +546,7 @@ void KMessShared::openEmailClient( const QString &mailto, const QString &folder, && mailClientChoice != "listed" && mailClientChoice != "KDE" ) { - kWarning() << "Invalid mail client choice:" << mailClientChoice << ", using KDE default."; + kmWarning() << "Invalid mail client choice:" << mailClientChoice << ", using KDE default."; mailClientChoice = "KDE"; } @@ -516,14 +556,14 @@ void KMessShared::openEmailClient( const QString &mailto, const QString &folder, { mailClient = group.readEntry( "customMailClient", fallbackMailClient ); #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "Custom mail client selected:" << mailClient; + kmDebug() << "Custom mail client selected:" << mailClient; #endif } else if( mailClientChoice == "listed" ) { mailClient = group.readEntry( "listedMailClient", fallbackMailClient ); #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "Listed mail client selected:" << mailClient; + kmDebug() << "Listed mail client selected:" << mailClient; #endif } @@ -531,7 +571,7 @@ void KMessShared::openEmailClient( const QString &mailto, const QString &folder, if( mailClient.isEmpty() ) { #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "Invalid mail client option, using KDE default."; + kmDebug() << "Invalid mail client option, using KDE default."; #endif mailClientChoice = "KDE"; } @@ -540,7 +580,7 @@ void KMessShared::openEmailClient( const QString &mailto, const QString &folder, if( mailClientChoice == "KDE" ) { #ifdef KMESSDEBUG_SHARED_OPENEXTERNAL - kDebug() << "KDE default mail client selected."; + kmDebug() << "KDE default mail client selected."; #endif KToolInvocation::invokeMailer( KUrl( "mailto:" + mailto ) ); return; @@ -617,7 +657,7 @@ bool KMessShared::selectNextFile( const QString &directory, const QString &baseN while( QFile::exists( path + QString::number( ++startingNumber ) + "." + extension ) ) ; #ifdef KMESSDEBUG_SHAREDMETHODS - kDebug() << "Base file " << ( baseName + "." + extension) << "does not exist. Next sequential file is: " << ( baseName + "." + QString::number( startingNumber ) + "." + extension ); + kmDebug() << "Base file " << ( baseName + "." + extension) << "does not exist. Next sequential file is: " << ( baseName + "." + QString::number( startingNumber ) + "." + extension ); #endif suffix = ""; @@ -625,7 +665,7 @@ bool KMessShared::selectNextFile( const QString &directory, const QString &baseN } #ifdef KMESSDEBUG_SHAREDMETHODS - kDebug() << "Base file" << ( baseName + "." + extension ) << "exists, finding the last existing numbered file"; + kmDebug() << "Base file" << ( baseName + "." + extension ) << "exists, finding the last existing numbered file"; #endif // Start the search sequence number from 1 @@ -652,7 +692,7 @@ bool KMessShared::selectNextFile( const QString &directory, const QString &baseN { suffix = ".1"; #ifdef KMESSDEBUG_SHAREDMETHODS - kDebug() << "Called with nonzero startingNumber, so I'm not allowed to return the base file!" + kmDebug() << "Called with nonzero startingNumber, so I'm not allowed to return the base file!" << "Returning " << ( baseName + suffix + "." + extension ) << " which doesn't exist."; #endif return false; @@ -665,7 +705,7 @@ bool KMessShared::selectNextFile( const QString &directory, const QString &baseN } #ifdef KMESSDEBUG_SHAREDMETHODS - kDebug() << "Last existing file name:" << ( baseName + suffix + "." + extension ); + kmDebug() << "Last existing file name:" << ( baseName + suffix + "." + extension ); #endif return true; @@ -673,6 +713,85 @@ bool KMessShared::selectNextFile( const QString &directory, const QString &baseN +/** + * Given a base directory and filename, returns the full path to the next non-existing sequentially + * numbered file. The parameter previousSequentialFile is set to the full path of the file immediately + * previous to this in the sequence. + * + * Take the following examples: + * + * @code + QString lastFile; + QString nextFile = nextSequentialFile( "./", "foo@bar.com", "xml", lastFile ); + * @endcode + * + * Assume that only the base file, foo@bar.com.xml exists. Then: + * + * @code + lastFile = "./foo@bar.com.xml" + nextFile = "./foo@bar.com.1.xml" + * @endcode + * + * Assume that the files foo@bar.com.xml, foo@bar.com.1.xml and foo@bar.com.2.xml exist. Then: + * + * @code + previousFile = "./foo@bar.com.2.xml" + nextFile = "./foo@bar.com.3.xml" + * @endcode + * + * etc. + * + * @param baseDir The full path to the base directory. + * @param baseFileName The base file name, minus the extension or numbering. + * @param extension The extension of the file. + * @param lastFile [out] Set to the full path of the last existing file in the sequence, or an empty string if none exists. + * @return The full path to the next unused sequential file. + */ +QString KMessShared::nextSequentialFile( const QString &baseDirPath, const QString &baseFileName, const QString &extension, QString &lastFile ) +{ + QDir baseDir( baseDirPath ); + + baseDir.setFilter( QDir::Files ); + baseDir.setNameFilters( QStringList() << ( baseFileName + "*." + extension ) ); + + // Get the list of all .1, .2, etc log files. + // See KMessShared::compareFileNames() + + QStringList numberedFiles( baseDir.entryList() ); + qSort( numberedFiles.begin(), numberedFiles.end(), KMessShared::compareFileNames ); + + // There are no matching files + if( numberedFiles.size() == 0 ) + { + lastFile = QString(); + return baseDir.absoluteFilePath( baseFileName + "." + extension ); + } + + QString nextFile; + lastFile = baseDir.absoluteFilePath( numberedFiles.last() ); + + // one or more numbered files exist. grab the number of the most recent, increment it. + // that becomes the number of the next numbered file. + + int pos = lastFile.indexOf( baseFileName ) + baseFileName.length() + 1; + QString numberPart( lastFile.mid( pos, lastFile.lastIndexOf( extension ) - pos - 1 ) ); + bool ok = false; + int number = numberPart.toInt( &ok ); + + // The file is in form: baseFileName.extension + if( numberPart == extension || ! ok ) + { + return baseDir.absoluteFilePath( baseFileName + ".1." + extension ); + } + // The file is in form: baseFileName.number.extension + else + { + return baseDir.absoluteFilePath( baseFileName + "." + QString::number( number + 1 ) + "." + extension ); + } +} + + + // Truncate an UTF-8 multibyte string to a fixed byte size QString KMessShared::fixStringToByteSize( const QString &string, quint32 size ) diff --git a/src/utils/kmessshared.h b/src/utils/kmessshared.h index 4229a33..df43497 100644 --- a/src/utils/kmessshared.h +++ b/src/utils/kmessshared.h @@ -41,6 +41,8 @@ class KMessShared { public: // Public static methods + // Sorting helper, to compare two filenames using natural sorting + static bool compareFileNames( const QString& name1, const QString& name2 ); // Create a HMACSha1 hash static QByteArray createHMACSha1( const QByteArray &keyForHash, const QByteArray &secret ); // Return a derived key with HMACSha1 algorithm @@ -65,6 +67,8 @@ class KMessShared static void openEmailClient( const QString &mailto, const QString &folder, bool isHotmailAvailable = true ); // Select the next available file static bool selectNextFile( const QString &directory, const QString &baseName, QString &suffix, const QString &extension, int &startingNumber ); + // Returns the full path to the next non-existing sequentially mumbered file + static QString nextSequentialFile( const QString &baseDirPath, const QString &baseFileName, const QString &extension, QString &lastFile ); // Draws an icon with an overlay from two pixmaps (width and height -1, the defaults, mean take the width and height from the icon itself) static QPixmap drawIconOverlay( const QPixmap icon, const QPixmap overlay, int width = -1, int height = -1, float sizeFactor = 0.5, float iconSizeFactor = 1.0 ); // Truncate an UTF-8 multibyte string to a fixed byte size diff --git a/src/utils/likeback/likeback.cpp b/src/utils/likeback/likeback.cpp index b1fda77..85b9861 100644 --- a/src/utils/likeback/likeback.cpp +++ b/src/utils/likeback/likeback.cpp @@ -168,7 +168,7 @@ void LikeBack::enableBar() #ifdef KMESSDEBUG_LIKEBACK if( d->disabledCount < 0 ) { - kError() << "Enabled more times than it was disabled. Please refer to the disableBar() documentation for more information and hints."; + kmError() << "Enabled more times than it was disabled. Please refer to the disableBar() documentation for more information and hints."; } #endif diff --git a/src/utils/likeback/likebackbar.cpp b/src/utils/likeback/likebackbar.cpp index 00c1506..c6dbead 100644 --- a/src/utils/likeback/likebackbar.cpp +++ b/src/utils/likeback/likebackbar.cpp @@ -55,7 +55,7 @@ LikeBackBar::LikeBackBar( LikeBack *likeBack ) m_featureButton->setShown( buttons & LikeBack::Feature ); #ifdef DEBUG_LIKEBACK - kDebug() << "CREATED."; + kmDebug() << "CREATED."; #endif } @@ -65,7 +65,7 @@ LikeBackBar::LikeBackBar( LikeBack *likeBack ) LikeBackBar::~LikeBackBar() { #ifdef DEBUG_LIKEBACK - kDebug() << "DESTROYED."; + kmDebug() << "DESTROYED."; #endif } @@ -93,14 +93,14 @@ void LikeBackBar::changeWindow( QWidget *oldWidget, QWidget *newWidget ) QWidget *newWindow = ( newWidget ? newWidget->window() : 0 ); #ifdef DEBUG_LIKEBACK - kDebug() << "Focus change:" << oldWindow << "->" << newWindow; + kmDebug() << "Focus change:" << oldWindow << "->" << newWindow; #endif if( oldWindow == newWindow || ( oldWindow == 0 && newWindow == 0 ) ) { #ifdef DEBUG_LIKEBACK - kDebug() << "Invalid/unchanged windows."; + kmDebug() << "Invalid/unchanged windows."; #endif return; } @@ -111,7 +111,7 @@ void LikeBackBar::changeWindow( QWidget *oldWidget, QWidget *newWidget ) || oldWindow->windowType() == Qt::Dialog ) ) { #ifdef DEBUG_LIKEBACK - kDebug() << "Removing from old window:" << oldWindow; + kmDebug() << "Removing from old window:" << oldWindow; #endif oldWindow->removeEventFilter( this ); // Reparenting allows the bar to not be destroyed if the window which @@ -128,7 +128,7 @@ void LikeBackBar::changeWindow( QWidget *oldWidget, QWidget *newWidget ) || newWindow->windowType() == Qt::Dialog ) ) { #ifdef DEBUG_LIKEBACK - kDebug() << "Adding to new window:" << newWindow; + kmDebug() << "Adding to new window:" << newWindow; #endif setParent( newWindow ); newWindow->installEventFilter( this ); @@ -153,7 +153,7 @@ bool LikeBackBar::eventFilter(QObject *obj, QEvent *event) if( obj != parent() ) { #ifdef DEBUG_LIKEBACK - kDebug() << "Incorrect event source"; + kmDebug() << "Incorrect event source"; #endif return false; } @@ -172,7 +172,7 @@ bool LikeBackBar::eventFilter(QObject *obj, QEvent *event) QResizeEvent *resizeEvent = static_cast( event ); #ifdef DEBUG_LIKEBACK - kDebug() << "Resize event:" << resizeEvent->oldSize() << "->" << resizeEvent->size() << "my size:" << size(); + kmDebug() << "Resize event:" << resizeEvent->oldSize() << "->" << resizeEvent->size() << "my size:" << size(); #endif // Move the feedback bar to the top right corner of the window @@ -204,7 +204,7 @@ void LikeBackBar::setBarVisible( bool visible ) if( visible && ! isVisible() ) { #ifdef DEBUG_LIKEBACK - kDebug() << "Setting visible, connected?" << connected_; + kmDebug() << "Setting visible, connected?" << connected_; #endif // Avoid duplicated connections @@ -220,7 +220,7 @@ void LikeBackBar::setBarVisible( bool visible ) else if( ! visible && isVisible() ) { #ifdef DEBUG_LIKEBACK - kDebug() << "Setting hidden, connected?" << connected_; + kmDebug() << "Setting hidden, connected?" << connected_; #endif hide(); @@ -240,7 +240,7 @@ void LikeBackBar::setBarVisible( bool visible ) #ifdef DEBUG_LIKEBACK else { - kDebug() << "Not changing status, connected?" << connected_; + kmDebug() << "Not changing status, connected?" << connected_; } #endif } diff --git a/src/utils/likeback/likebackdialog.cpp b/src/utils/likeback/likebackdialog.cpp index 5e60009..005a452 100644 --- a/src/utils/likeback/likebackdialog.cpp +++ b/src/utils/likeback/likebackdialog.cpp @@ -254,8 +254,8 @@ void LikeBackDialog::slotButtonClicked( int buttonId ) #ifdef KMESSDEBUG_LIKEBACK - kDebug() << "http://" << m_likeBack->hostName() << ":" << m_likeBack->hostPort() << m_likeBack->remotePath(); - kDebug() << data; + kmDebug() << "http://" << m_likeBack->hostName() << ":" << m_likeBack->hostPort() << m_likeBack->remotePath(); + kmDebug() << data; #endif // Create the HTTP sending object and the actual request @@ -281,13 +281,13 @@ void LikeBackDialog::requestFinished( int id, bool error ) if( id != m_requestNumber_ ) { #ifdef KMESSDEBUG_LIKEBACK - kDebug() << "Ignoring request" << id; + kmDebug() << "Ignoring request" << id; #endif return; } #ifdef KMESSDEBUG_LIKEBACK - kDebug() << "Request has" << (error?"failed":"succeeded"); + kmDebug() << "Request has" << (error?"failed":"succeeded"); #endif m_likeBack->disableBar(); diff --git a/src/utils/nowlisteningclient.cpp b/src/utils/nowlisteningclient.cpp index eff972a..835bbd2 100644 --- a/src/utils/nowlisteningclient.cpp +++ b/src/utils/nowlisteningclient.cpp @@ -146,7 +146,7 @@ void NowListeningClient::slotUpdate() else { #ifdef KMESSDEBUG_NOWLISTENINGCLIENT - kDebug() << "Queried" << player_ << "and found new song: " << artist_ << "-" << track_ << "(extra info: album=" << album_ << ", playing=" << playing_ << "); emitting changedSong()"; + kmDebug() << "Queried" << player_ << "and found new song: " << artist_ << "-" << track_ << "(extra info: album=" << album_ << ", playing=" << playing_ << "); emitting changedSong()"; #endif emit changedSong( artist_, album_, track_, playing_ ); } @@ -157,7 +157,7 @@ void NowListeningClient::slotUpdate() if( prevPlaying && ! playing_ ) { #ifdef KMESSDEBUG_NOWLISTENINGCLIENT - kDebug() << "player was stopped, emitting changedSong()."; + kmDebug() << "player was stopped, emitting changedSong()."; #endif emit changedSong( QString(), QString(), QString(), false ); } @@ -275,9 +275,9 @@ bool NowListeningClient::queryMprisPlayers() if( ! isPlaying.isValid() || ! metadata.isValid() ) { #ifdef KMESSDEBUG_NOWLISTENINGCLIENT - kDebug() << "Invalid response from " << player << "!"; - kDebug() << "GetStatus Error: " << isPlaying.error().message(); - kDebug() << "GetMetadata Error: " << metadata.error().message(); + kmDebug() << "Invalid response from " << player << "!"; + kmDebug() << "GetStatus Error: " << isPlaying.error().message(); + kmDebug() << "GetMetadata Error: " << metadata.error().message(); #endif mutex_.unlock(); @@ -318,7 +318,7 @@ bool NowListeningClient::queryKsCD() } #ifdef KMESSDEBUG_NOWLISTENINGCLIENT - kDebug() << "querying KsCD for now listening information..."; + kmDebug() << "querying KsCD for now listening information..."; #endif // Call KsCD to know whether it's playing, and what @@ -330,7 +330,7 @@ bool NowListeningClient::queryKsCD() if( ! isPlaying.isValid() || ! album.isValid() || ! track.isValid() || ! artist.isValid() ) { #ifdef KMESSDEBUG_NOWLISTENINGCLIENT - kDebug() << "Invalid response from KsCD!"; + kmDebug() << "Invalid response from KsCD!"; #endif mutex_.unlock(); @@ -376,7 +376,7 @@ bool NowListeningClient::queryJuk() if( ! isPlaying.isValid() || ! album.isValid() || ! track.isValid() || ! artist.isValid() ) { #ifdef KMESSDEBUG_NOWLISTENINGCLIENT - kDebug() << "Invalid response from Juk!"; + kmDebug() << "Invalid response from Juk!"; #endif mutex_.unlock(); diff --git a/src/utils/richtextparser.cpp b/src/utils/richtextparser.cpp index 43b3c3f..b4e622b 100644 --- a/src/utils/richtextparser.cpp +++ b/src/utils/richtextparser.cpp @@ -19,11 +19,11 @@ #include "richtextparser.h" +#include "../kmessdebug.h" #include "../contact/contactbase.h" #include "../utils/kmessshared.h" #include "../currentaccount.h" #include "../emoticonmanager.h" -#include "../kmessdebug.h" #include @@ -102,8 +102,8 @@ void RichTextParser::getCleanString( QString &string ) string.replace( QRegExp( "\\[/?(c|a)(=#?[0-9a-z,]+)?\\]", Qt::CaseInsensitive ), "" ); #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Original:" << originalString; - kDebug() << "Parsed:" << string; + kmDebug() << "Original:" << originalString; + kmDebug() << "Parsed:" << string; #endif // Add this to the cache @@ -178,8 +178,8 @@ void RichTextParser::getFormattedString( QString &string ) string = "" + string + ""; #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Original:" << originalString; - kDebug() << "Parsed:" << string; + kmDebug() << "Original:" << originalString; + kmDebug() << "Parsed:" << string; #endif // Add this to the cache @@ -279,7 +279,7 @@ QString RichTextParser::getHtmlGradient( const QString& text, const QString& sta QRegExp looseTagsMatch( "<[^>]+>|&[a-z]+;|&#[0-9]+;|\\[/?[ca](=#?[0-9a-z]+)?\\]", Qt::CaseInsensitive ); #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Text to gradient:" << text; + kmDebug() << "Text to gradient:" << text; #endif // Search in the text all the tags to skip, and store their positions for faster parsing @@ -289,7 +289,7 @@ QString RichTextParser::getHtmlGradient( const QString& text, const QString& sta int len = looseTagsMatch.matchedLength(); #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Adding tag to skip at pos" << pos << "(len" << len << "):" << looseTagsMatch.cap( 0 ); + kmDebug() << "Adding tag to skip at pos" << pos << "(len" << len << "):" << looseTagsMatch.cap( 0 ); #endif // Add position and length of the tag to allow skipping it later @@ -309,7 +309,7 @@ QString RichTextParser::getHtmlGradient( const QString& text, const QString& sta differenceBlue = (int)floor( (float)( start.blue () - end.blue () ) / (float)levels ); #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Size is" << text.length() <<"(" << levels << "stripped) -" + kmDebug() << "Size is" << text.length() <<"(" << levels << "stripped) -" << "Colored from" << start.name() << "to" << end.name() << ", difference: (" << differenceRed << "," << differenceGreen << "," << differenceBlue << ")"; #endif @@ -318,7 +318,7 @@ QString RichTextParser::getHtmlGradient( const QString& text, const QString& sta if( differenceRed == 0 && differenceGreen == 0 && differenceBlue == 0 ) { #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "The gradient colors are equal, converting it to solid color."; + kmDebug() << "The gradient colors are equal, converting it to solid color."; #endif return "" + text + ""; @@ -349,7 +349,7 @@ QString RichTextParser::getHtmlGradient( const QString& text, const QString& sta outputText += "" + text.mid( indexFullString, matchLength ) + ""; #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Outputting whole tag:" << text.mid( indexFullString, matchLength ); + kmDebug() << "Outputting whole tag:" << text.mid( indexFullString, matchLength ); #endif // Move the index on to the tag end @@ -522,7 +522,7 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho // Avoid problems if no list of pending emoticons has been given if( &pendingEmoticonTags == 0 ) { - kWarning() << "The given pending emoticons list is not valid!"; + kmWarning() << "The given pending emoticons list is not valid!"; pendingEmoticonTags = QStringList(); } @@ -553,7 +553,7 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho // initialize them *once*! QRegExp linkRegExp; linkRegExp.setPattern( "\\b((?:http://|https://|ftp://|sftp://|www\\.)" - "\\S+)" + "\\S+)" // match protocol string followed by the host/path "[.,;!?]?(?:<|\\s|$)" // ending with <, \s or $, not counting .,;?!"' before @@ -605,7 +605,7 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho // Set the filename of the placeholder image for pending emoticons static QString pendingEmoticonPlaceholder( Qt::escape( KGlobal::dirs()->findResource( "appdata", "pics/empty.png" ) ) ); - + // Set up the emoticon replacement list QHash emoticonReplacementList; QHash::const_iterator ei; @@ -627,7 +627,7 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho if( customEmoticonsBlacklist.contains( ei.key() ) ) { #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Ignoring blacklisted emoticon" << ei.key(); + kmDebug() << "Ignoring blacklisted emoticon" << ei.key(); #endif ++ei; continue; @@ -636,7 +636,7 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho if( allowAddingEmoticons && ! emoticonManager_->emoticonIsAdded( customHashes.value( ei.key() ) ) ) { #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Inserting emoticon additional link for " << ei.key() << " with hash " << customHashes.value( ei.key() ); + kmDebug() << "Inserting emoticon additional link for " << ei.key() << " with hash " << customHashes.value( ei.key() ); #endif QString imagePath( ei.value() ); QString urlCode( QUrl::toPercentEncoding( ei.key() ) ); @@ -663,7 +663,7 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho else { #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Not inserting emoticon additional link for " << ei.key() << ". allowAddingEmoticons=" << allowAddingEmoticons + kmDebug() << "Not inserting emoticon additional link for " << ei.key() << ". allowAddingEmoticons=" << allowAddingEmoticons << "; customHashes.value( ei.key() ) = " << customHashes.value( ei.key() ) << "; emoticonIsAdded=" << emoticonManager_->emoticonIsAdded( customHashes.value( ei.key() ) ); #endif emoticonReplacementList.insert( ei.key(), ei.value() ); @@ -712,7 +712,7 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho { parseString = output.at( j ); #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "applying regexp" << i << "to string" << parseString; + kmDebug() << "applying regexp" << i << "to string" << parseString; #endif // Don't parse this piece, it's HTML @@ -730,7 +730,7 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho if( index != -1 ) { #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "Regexp" << i << "matches at character" << index << "in string" << j << ": " << parseString; + kmDebug() << "Regexp" << i << "matches at character" << index << "in string" << j << ": " << parseString; #endif // Match, turn this piece into HTML (split string up into 3 strings) @@ -859,13 +859,13 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho case 5: matched = regexp->cap( 0 ); - // note that a regexp match starting with a html entity (such as a custom emoticon "&)" or the + // note that a regexp match starting with a html entity (such as a custom emoticon "&)" or the // MSN emoticon "('.')" ) will appear as for example '&)' in the regexp; this will not collide // with the emoticon ;) because it appears in the regexp as ;). So no worries, no hacks, no fixes needed. if( ! emoticonReplacementList.contains( matched ) ) { - kWarning() << "Emoticon replacement list does not contain matched emoticon" + kmWarning() << "Emoticon replacement list does not contain matched emoticon" << matched; replacement = matched; break; @@ -882,15 +882,15 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho default: - kWarning() << "Warning: Unhandled regexp"; + kmWarning() << "Warning: Unhandled regexp"; replacement.clear(); break; } if( matched.isEmpty() ) { - kError() << "Zero-length regexp match in regexp" << i << "- string:" << parseString; - kError() << "Regexp at this point: " << regexp->pattern(); + kmError() << "Zero-length regexp match in regexp" << i << "- string:" << parseString; + kmError() << "Regexp at this point: " << regexp->pattern(); #ifdef KMESSTEST KMESS_ASSERT( regexp->pattern() == regexps[i]->pattern() ); #endif @@ -900,9 +900,9 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho } #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << j << ":" << parseString.left( index ); - kDebug() << j + 1 << ":" << replacement; - kDebug() << j + 2 << ":" << parseString.mid( index + matched.length() ); + kmDebug() << j << ":" << parseString.left( index ); + kmDebug() << j + 1 << ":" << replacement; + kmDebug() << j + 2 << ":" << parseString.mid( index + matched.length() ); #endif output.replace( j, parseString.left( index ) ); output.insert( j + 1, replacement); @@ -913,7 +913,7 @@ void RichTextParser::parseMsnString( QString &text, bool showEmoticons, bool sho j++; #ifdef KMESSDEBUG_RICHTEXTPARSER - kDebug() << "j is now:" << j; + kmDebug() << "j is now:" << j; #endif } } diff --git a/src/utils/thumbnailprovider.cpp b/src/utils/thumbnailprovider.cpp index 1d02f5f..6b1553f 100644 --- a/src/utils/thumbnailprovider.cpp +++ b/src/utils/thumbnailprovider.cpp @@ -48,7 +48,7 @@ ThumbnailProvider::ThumbnailProvider( const QString &fileName, int size ) , size_( size ) { #ifdef KMESSDEBUG_THUMBNAILPROVIDER - kDebug() << "requesting thumbnail for" << fileName; + kmDebug() << "requesting thumbnail for" << fileName; #endif // The quick method (also displays a transfer dialog): @@ -68,14 +68,14 @@ ThumbnailProvider::ThumbnailProvider( const QString &fileName, int size ) enabledPlugins_.removeAll( "textthumbnail" ); #ifdef KMESSDEBUG_THUMBNAILPROVIDER - kDebug() << "enabled preview plugins: " << enabledPlugins_; + kmDebug() << "enabled preview plugins: " << enabledPlugins_; #endif // Get file type KMimeType::Ptr type = KMimeType::findByUrl( url ); #ifdef KMESSDEBUG_THUMBNAILPROVIDER - kDebug() << "file mime type '" << type->name() << "'"; + kmDebug() << "file mime type '" << type->name() << "'"; #endif // For some file types, don't generate a preview @@ -83,7 +83,7 @@ ThumbnailProvider::ThumbnailProvider( const QString &fileName, int size ) if( type->name() == "text/plain" ) { #ifdef KMESSDEBUG_THUMBNAILPROVIDER - kDebug() << "not creating previews for this file type."; + kmDebug() << "not creating previews for this file type."; #endif // Make slot call delayed, so clients can still connect to signals first. QTimer::singleShot( 0, this, SLOT(slotFailed()) ); @@ -179,7 +179,7 @@ QString ThumbnailProvider::getImageTag( const QString &altText ) const void ThumbnailProvider::slotGotPreview( const KFileItem& /*fileItem*/, const QPixmap &preview ) { #ifdef KMESSDEBUG_THUMBNAILPROVIDER - kDebug() << "thumbnail generated."; + kmDebug() << "thumbnail generated."; #endif // The KFileItem already gets deleted by KIO @@ -239,7 +239,7 @@ void ThumbnailProvider::slotGotPreview( const KFileItem& /*fileItem*/, const QPi void ThumbnailProvider::slotFailed() { #ifdef KMESSDEBUG_THUMBNAILPROVIDER - kDebug() << "thumbnail won't not be generated."; + kmDebug() << "thumbnail won't not be generated."; #endif resultError_ = true; @@ -254,7 +254,7 @@ void ThumbnailProvider::slotFailed() void ThumbnailProvider::slotFailed( const KFileItem &/*fileItem*/ ) { #ifdef KMESSDEBUG_THUMBNAILPROVIDER - kDebug() << "thumbnail could not be generated."; + kmDebug() << "thumbnail could not be generated."; #endif // The KFileItem already gets deleted by KIO. diff --git a/src/utils/xautolock.cpp b/src/utils/xautolock.cpp index 186e7bd..48e80ce 100644 --- a/src/utils/xautolock.cpp +++ b/src/utils/xautolock.cpp @@ -190,7 +190,7 @@ bool XAutoLock::isMitScreenSaverActive() bool XAutoLock::isScreenSaverActive() { #ifdef KMESSDEBUG_AUTOLOCK_DBUS_QUERYING - kDebug() << "Calling D-Bus for screensaver status..."; + kmDebug() << "Calling D-Bus for screensaver status..."; #endif // Get on the bus @@ -199,7 +199,7 @@ bool XAutoLock::isScreenSaverActive() if( ! dbus.isConnected() ) { #ifdef KMESSDEBUG_AUTOLOCK_DBUS_QUERYING - kDebug() << "D-Bus is not connected! Falling back to the X screensaver extension."; + kmDebug() << "D-Bus is not connected! Falling back to the X screensaver extension."; #endif return isMitScreenSaverActive(); } @@ -214,13 +214,13 @@ bool XAutoLock::isScreenSaverActive() if( reply.isValid() ) { #ifdef KMESSDEBUG_AUTOLOCK_DBUS_QUERYING - kDebug() << "Screensaver is" << ( reply ? "" : "not" ) << "active"; + kmDebug() << "Screensaver is" << ( reply ? "" : "not" ) << "active"; #endif return reply; } #ifdef KMESSDEBUG_AUTOLOCK_DBUS_QUERYING - kDebug() << "Got error screensaver response:" << reply.error() << ". Falling back to the X screensaver extension."; + kmDebug() << "Got error screensaver response:" << reply.error() << ". Falling back to the X screensaver extension."; #endif // As a fallback, when the DCOP call fails, ask the MIT-SCREEN-SAVER extension. diff --git a/src/utils/xmlfunctions.cpp b/src/utils/xmlfunctions.cpp index 4c1da0b..202ef03 100644 --- a/src/utils/xmlfunctions.cpp +++ b/src/utils/xmlfunctions.cpp @@ -44,13 +44,13 @@ QDomNode XmlFunctions::getNode( const QDomNode &rootNode, const QString &path ) } childNode = childNode.namedItem( pathItems[ i ] ); - i++; // not using for loop so i is always correct for kDebug() below. + i++; // not using for loop so i is always correct for kmDebug() below. } #ifdef KMESSDEBUG_XMLFUNCTIONS QString message( "reading node \"" + rootNode.nodeName() + "/" + pathItems.join("/") + "\": " + ( ! childNode.isNull() ? "found" : "not found: " + pathItems[ i - 1 ] ) ); - kDebug() << message.toLatin1().data(); + kmDebug() << message.toLatin1().data(); #endif return childNode; @@ -83,7 +83,7 @@ QDomNode XmlFunctions::getNodeChildByKey( const QDomNodeList &childNodes, const for( int i = 0; i < childNodes.count(); i++ ) { -// kDebug() << "node " << childNodes.item(i).nodeName() << "/" << keyTagName +// kmDebug() << "node " << childNodes.item(i).nodeName() << "/" << keyTagName // << "=" << childNodes.item(i).namedItem(keyTagName).toElement().text() << " == " << keyValue << "?" << endl; // If the node has an childname with a certain value... e.g. value .. @@ -110,7 +110,7 @@ QString XmlFunctions::getNodeValue( const QDomNode &rootNode, const QString &pat // Added code to avoid more assertion errors, and trace the cause. if( rootNode.isNull() ) { - kWarning() << "Attempted to request '" << path << "' on null root node."; + kmWarning() << "Attempted to request '" << path << "' on null root node."; return QString::null; } #endif