aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2007-01-26 03:54:22 +0000
committerGravatar Szymon Tomasz Stefanek2007-01-26 03:54:22 +0000
commit1a8a7e6f145613c34ff0604b95370995fc625ef2 (patch)
tree79b63ab083ae2eecfbf98170e9d50731f6bb4d67 /src
parentfix win compilation and update win projects (diff)
downloadKVIrc-1a8a7e6f145613c34ff0604b95370995fc625ef2.tar.gz
KVIrc-1a8a7e6f145613c34ff0604b95370995fc625ef2.tar.bz2
KVIrc-1a8a7e6f145613c34ff0604b95370995fc625ef2.zip
More Qt 4.x port and the torrent module by Alexander Stillich
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@255 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
-rw-r--r--src/config.h.in18
-rw-r--r--src/kvi_configstatus.h38
-rw-r--r--src/kvilib/build/Makefile.am25
-rw-r--r--src/kvilib/ext/kvi_dcophelper.cpp303
-rw-r--r--src/kvilib/ext/kvi_dcophelper.h80
-rw-r--r--src/kvilib/ext/kvi_regusersdb.cpp6
-rw-r--r--src/kvilib/file/kvi_packagefile.cpp10
-rw-r--r--src/kvilib/tal/kvi_tal_iconview.cpp215
-rw-r--r--src/kvilib/tal/kvi_tal_iconview.h36
-rw-r--r--src/kvilib/tal/kvi_tal_iconview_qt3.h100
-rw-r--r--src/kvilib/tal/kvi_tal_iconview_qt4.h99
-rw-r--r--src/kvilib/tal/kvi_tal_listbox.cpp513
-rw-r--r--src/kvilib/tal/kvi_tal_listbox.h50
-rw-r--r--src/kvilib/tal/kvi_tal_listbox_qt3.h153
-rw-r--r--src/kvilib/tal/kvi_tal_listbox_qt4.h149
-rw-r--r--src/kvilib/tal/kvi_tal_listview.cpp1493
-rw-r--r--src/kvilib/tal/kvi_tal_listview.h51
-rw-r--r--src/kvilib/tal/kvi_tal_listview_qt3.h190
-rw-r--r--src/kvilib/tal/kvi_tal_listview_qt4.h199
-rw-r--r--src/kvilib/tal/kvi_tal_popupmenu_qt4.h27
-rw-r--r--src/kvilib/tal/kvi_tal_scrollview.cpp33
-rw-r--r--src/kvilib/tal/kvi_tal_scrollview.h36
-rw-r--r--src/kvilib/tal/kvi_tal_scrollview_qt3.h41
-rw-r--r--src/kvilib/tal/kvi_tal_scrollview_qt4.h41
-rw-r--r--src/kvilib/tal/kvi_tal_tooltip.cpp4
-rw-r--r--src/kvilib/tal/kvi_tal_tooltip.h1
-rw-r--r--src/kvirc/kernel/kvi_app.cpp18
-rw-r--r--src/kvirc/kernel/kvi_app.h2
-rw-r--r--src/kvirc/kernel/kvi_app_fs.cpp1
-rw-r--r--src/kvirc/kernel/kvi_coreactions.cpp3
-rw-r--r--src/kvirc/kernel/kvi_filetransfer.cpp2
-rw-r--r--src/kvirc/kernel/kvi_filetransfer.h7
-rw-r--r--src/kvirc/kernel/kvi_iconmanager.cpp18
-rw-r--r--src/kvirc/kernel/kvi_ipc.cpp40
-rw-r--r--src/kvirc/kernel/kvi_ipc.h11
-rw-r--r--src/kvirc/kernel/kvi_ircconnection.cpp12
-rw-r--r--src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp27
-rw-r--r--src/kvirc/kernel/kvi_ircconnectionserverinfo.h20
-rw-r--r--src/kvirc/kernel/kvi_irccontext.cpp3
-rw-r--r--src/kvirc/kernel/kvi_lagmeter.cpp2
-rw-r--r--src/kvirc/kernel/kvi_notifylist.cpp11
-rw-r--r--src/kvirc/kernel/kvi_options.cpp8
-rw-r--r--src/kvirc/kernel/kvi_options.h2
-rw-r--r--src/kvirc/kernel/kvi_out.h1
-rw-r--r--src/kvirc/kernel/kvi_theme.cpp14
-rw-r--r--src/kvirc/kernel/kvi_userinput.cpp2
-rw-r--r--src/kvirc/kernel/kvi_userinput.h6
-rw-r--r--src/kvirc/kvs/kvi_kvs_corecallbackcommands.cpp2
-rw-r--r--src/kvirc/kvs/kvi_kvs_corefunctions_gl.cpp2
-rw-r--r--src/kvirc/kvs/kvi_kvs_coresimplecommands.cpp12
-rw-r--r--src/kvirc/kvs/kvi_kvs_coresimplecommands_af.cpp24
-rw-r--r--src/kvirc/kvs/kvi_kvs_coresimplecommands_gl.cpp20
-rw-r--r--src/kvirc/kvs/kvi_kvs_coresimplecommands_mr.cpp24
-rw-r--r--src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp8
-rw-r--r--src/kvirc/kvs/kvi_kvs_object.cpp60
-rw-r--r--src/kvirc/kvs/kvi_kvs_parameterprocessor.cpp16
-rw-r--r--src/kvirc/kvs/kvi_kvs_popupmenu.cpp3
-rw-r--r--src/kvirc/kvs/kvi_kvs_timermanager.cpp4
-rw-r--r--src/kvirc/kvs/kvi_kvs_timermanager.h4
-rw-r--r--src/kvirc/kvs/kvi_kvs_treenode_switchlist.cpp6
-rw-r--r--src/kvirc/kvs/kvi_kvs_treenode_switchlist.h4
-rw-r--r--src/kvirc/ui/kvi_actiondrawer.cpp8
-rw-r--r--src/kvirc/ui/kvi_actiondrawer.h6
-rw-r--r--src/kvirc/ui/kvi_cryptcontroller.cpp12
-rw-r--r--src/kvirc/ui/kvi_cryptcontroller.h10
-rw-r--r--src/kvirc/ui/kvi_historywin.cpp10
-rw-r--r--src/kvirc/ui/kvi_historywin.h4
-rw-r--r--src/kvirc/ui/kvi_imagedialog.cpp20
-rw-r--r--src/kvirc/ui/kvi_imagedialog.h16
-rw-r--r--src/kvirc/ui/kvi_input.cpp13
-rw-r--r--src/kvirc/ui/kvi_input.h3
-rw-r--r--src/kvirc/ui/kvi_ircview.cpp17
-rw-r--r--src/kvirc/ui/kvi_ircviewtools.cpp4
-rw-r--r--src/kvirc/ui/kvi_ircviewtools.h6
-rw-r--r--src/kvirc/ui/kvi_listview.cpp24
-rw-r--r--src/kvirc/ui/kvi_listview.h6
-rw-r--r--src/kvirc/ui/kvi_maskeditor.cpp14
-rw-r--r--src/kvirc/ui/kvi_maskeditor.h12
-rw-r--r--src/kvirc/ui/kvi_mdimanager.cpp2
-rw-r--r--src/kvirc/ui/kvi_mdimanager.h5
-rw-r--r--src/kvirc/ui/kvi_selectors.cpp20
-rw-r--r--src/kvirc/ui/kvi_selectors.h12
-rw-r--r--src/kvirc/ui/kvi_styled_controls.cpp3
-rw-r--r--src/kvirc/ui/kvi_styled_controls.h5
-rw-r--r--src/kvirc/ui/kvi_taskbar.cpp24
-rw-r--r--src/kvirc/ui/kvi_taskbar.h18
-rw-r--r--src/kvirc/ui/kvi_texticonwin.cpp24
-rw-r--r--src/kvirc/ui/kvi_texticonwin.h6
-rw-r--r--src/kvirc/ui/kvi_topicw.cpp14
-rw-r--r--src/kvirc/ui/kvi_topicw.h12
-rw-r--r--src/kvirc/ui/kvi_userlistview.cpp11
-rw-r--r--src/modules/Makefile.am1
-rw-r--r--src/modules/actioneditor/actioneditor.cpp14
-rw-r--r--src/modules/actioneditor/actioneditor.h12
-rw-r--r--src/modules/addon/managementdialog.cpp12
-rw-r--r--src/modules/addon/managementdialog.h10
-rw-r--r--src/modules/aliaseditor/aliaseditor.cpp38
-rw-r--r--src/modules/aliaseditor/aliaseditor.h26
-rw-r--r--src/modules/channelsjoin/channelsjoinwindow.cpp26
-rw-r--r--src/modules/channelsjoin/channelsjoinwindow.h10
-rw-r--r--src/modules/editor/scripteditor.cpp10
-rw-r--r--src/modules/editor/scripteditor.h6
-rw-r--r--src/modules/eventeditor/eventeditor.cpp22
-rw-r--r--src/modules/eventeditor/eventeditor.h20
-rw-r--r--src/modules/filetransferwindow/filetransferwindow.cpp26
-rw-r--r--src/modules/filetransferwindow/filetransferwindow.h12
-rw-r--r--src/modules/help/helpwindow.cpp6
-rw-r--r--src/modules/help/helpwindow.h6
-rw-r--r--src/modules/links/linkswindow.cpp32
-rw-r--r--src/modules/links/linkswindow.h10
-rw-r--r--src/modules/list/listwindow.cpp14
-rw-r--r--src/modules/list/listwindow.h12
-rw-r--r--src/modules/logview/logviewmdiwindow.cpp14
-rw-r--r--src/modules/logview/logviewmdiwindow.h10
-rw-r--r--src/modules/logview/logviewwidget.h16
-rw-r--r--src/modules/mediaplayer/mp_amarokinterface.cpp42
-rw-r--r--src/modules/mediaplayer/mp_amarokinterface.h5
-rw-r--r--src/modules/mediaplayer/mp_jukinterface.cpp32
-rw-r--r--src/modules/mediaplayer/mp_jukinterface.h5
-rw-r--r--src/modules/objects/class_listbox.cpp68
-rw-r--r--src/modules/objects/class_listbox.h8
-rw-r--r--src/modules/objects/class_listview.cpp82
-rw-r--r--src/modules/objects/class_listview.h26
-rw-r--r--src/modules/objects/class_listviewitem.cpp32
-rw-r--r--src/modules/objects/class_listviewitem.h18
-rw-r--r--src/modules/objects/libkviobjects.cpp2
-rw-r--r--src/modules/options/dialog.cpp22
-rw-r--r--src/modules/options/dialog.h16
-rw-r--r--src/modules/options/optw_ircoutput.h2
-rw-r--r--src/modules/options/optw_mediatypes.cpp10
-rw-r--r--src/modules/options/optw_mediatypes.h10
-rw-r--r--src/modules/options/optw_messages.cpp52
-rw-r--r--src/modules/options/optw_messages.h26
-rw-r--r--src/modules/options/optw_nickserv.cpp16
-rw-r--r--src/modules/options/optw_nickserv.h4
-rw-r--r--src/modules/options/optw_proxy.cpp22
-rw-r--r--src/modules/options/optw_proxy.h12
-rw-r--r--src/modules/options/optw_servers.cpp50
-rw-r--r--src/modules/options/optw_servers.h16
-rw-r--r--src/modules/options/optw_transport.h2
-rw-r--r--src/modules/popupeditor/popupeditor.cpp38
-rw-r--r--src/modules/popupeditor/popupeditor.h22
-rw-r--r--src/modules/raweditor/raweditor.cpp26
-rw-r--r--src/modules/raweditor/raweditor.h18
-rw-r--r--src/modules/reguser/edituser.cpp36
-rw-r--r--src/modules/reguser/edituser.h30
-rw-r--r--src/modules/sharedfileswindow/sharedfileswindow.cpp20
-rw-r--r--src/modules/sharedfileswindow/sharedfileswindow.h8
-rw-r--r--src/modules/theme/managementdialog.cpp26
-rw-r--r--src/modules/theme/managementdialog.h14
-rw-r--r--src/modules/torrent/.svnignore10
-rw-r--r--src/modules/torrent/Makefile.am27
-rw-r--r--src/modules/torrent/libkvitorrent.cpp832
-rw-r--r--src/modules/torrent/tc_interface.cpp30
-rw-r--r--src/modules/torrent/tc_interface.h160
-rw-r--r--src/modules/torrent/tc_ktorrentdcopinterface.cpp508
-rw-r--r--src/modules/torrent/tc_ktorrentdcopinterface.h126
-rw-r--r--src/modules/url/libkviurl.cpp16
-rw-r--r--src/modules/url/libkviurl.h12
159 files changed, 6642 insertions, 913 deletions
diff --git a/src/config.h.in b/src/config.h.in
index e79ea040e..0608196e3 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -190,31 +190,31 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* The size of `int', as computed by sizeof. */
+/* The size of a `int', as computed by sizeof. */
#undef SIZEOF_INT
-/* The size of `long int', as computed by sizeof. */
+/* The size of a `long int', as computed by sizeof. */
#undef SIZEOF_LONG_INT
-/* The size of `long long int', as computed by sizeof. */
+/* The size of a `long long int', as computed by sizeof. */
#undef SIZEOF_LONG_LONG_INT
-/* The size of `short int', as computed by sizeof. */
+/* The size of a `short int', as computed by sizeof. */
#undef SIZEOF_SHORT_INT
-/* The size of `unsigned int', as computed by sizeof. */
+/* The size of a `unsigned int', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_INT
-/* The size of `unsigned long int', as computed by sizeof. */
+/* The size of a `unsigned long int', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG_INT
-/* The size of `unsigned long long int', as computed by sizeof. */
+/* The size of a `unsigned long long int', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG_LONG_INT
-/* The size of `unsigned short int', as computed by sizeof. */
+/* The size of a `unsigned short int', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_SHORT_INT
-/* The size of `void *', as computed by sizeof. */
+/* The size of a `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* Define to 1 if you have the ANSI C header files. */
diff --git a/src/kvi_configstatus.h b/src/kvi_configstatus.h
index 56498a6a9..d7d1880eb 100644
--- a/src/kvi_configstatus.h
+++ b/src/kvi_configstatus.h
@@ -1,20 +1,20 @@
-/* src/config.h. Generated from config.h.in by configure. */
+/* src/config.h. Generated by configure. */
/* src/config.h.in. Generated from configure.in by autoheader. */
/* define this to the number of average channel users */
-#define AVERAGE_CHANNEL_USERS 349
+#define AVERAGE_CHANNEL_USERS 101
/* define this if you are on a big endian machine */
/* #undef BIG_ENDIAN_MACHINE_BYTE_ORDER */
/* this is the build date (configure date rather) */
-#define BUILD_DATE "Wed Jan 24 14:03:22 UTC 2007"
+#define BUILD_DATE "Fri Jan 26 00:54:07 UTC 2007"
/* these are the build flags */
-#define BUILD_FLAGS "i686-bcefikoprsAGTZ"
+#define BUILD_FLAGS "x86_64-cefgikopsAGTZ"
/* define if you want to enable the Arts daemon support */
-#define COMPILE_ARTS_SUPPORT 1
+/* #undef COMPILE_ARTS_SUPPORT */
/* define if you want to enable the Audiofile library support */
#define COMPILE_AUDIOFILE_SUPPORT 1
@@ -69,7 +69,7 @@
#define COMPILE_OSS_SUPPORT 1
/* define if you have perl and want the perl scripting support in kvirc */
-/* #undef COMPILE_PERL_SUPPORT */
+#define COMPILE_PERL_SUPPORT 1
/* define if you have the KDE support and want the pseudo transparency */
#define COMPILE_PSEUDO_TRANSPARENCY 1
@@ -96,7 +96,7 @@
#define COMPILE_WITH_SYSTEM_MEMMOVE 1
/* define if you want to enable the ZLib library support */
-/* #undef COMPILE_XSS_SUPPORT */
+#define COMPILE_XSS_SUPPORT 1
/* define if you want to enable the ZLib library support */
#define COMPILE_ZLIB_SUPPORT 1
@@ -191,32 +191,32 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
-/* The size of `int', as computed by sizeof. */
+/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
-/* The size of `long int', as computed by sizeof. */
-#define SIZEOF_LONG_INT 4
+/* The size of a `long int', as computed by sizeof. */
+#define SIZEOF_LONG_INT 8
-/* The size of `long long int', as computed by sizeof. */
+/* The size of a `long long int', as computed by sizeof. */
#define SIZEOF_LONG_LONG_INT 8
-/* The size of `short int', as computed by sizeof. */
+/* The size of a `short int', as computed by sizeof. */
#define SIZEOF_SHORT_INT 2
-/* The size of `unsigned int', as computed by sizeof. */
+/* The size of a `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4
-/* The size of `unsigned long int', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_LONG_INT 4
+/* The size of a `unsigned long int', as computed by sizeof. */
+#define SIZEOF_UNSIGNED_LONG_INT 8
-/* The size of `unsigned long long int', as computed by sizeof. */
+/* The size of a `unsigned long long int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_LONG_LONG_INT 8
-/* The size of `unsigned short int', as computed by sizeof. */
+/* The size of a `unsigned short int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_SHORT_INT 2
-/* The size of `void *', as computed by sizeof. */
-#define SIZEOF_VOID_P 4
+/* The size of a `void *', as computed by sizeof. */
+#define SIZEOF_VOID_P 8
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
diff --git a/src/kvilib/build/Makefile.am b/src/kvilib/build/Makefile.am
index 36132f4c0..7cd16ae65 100644
--- a/src/kvilib/build/Makefile.am
+++ b/src/kvilib/build/Makefile.am
@@ -41,6 +41,7 @@ libkvilib_la_SOURCES = \
../ext/kvi_config.cpp \
../ext/kvi_crypt.cpp \
../ext/kvi_databuffer.cpp \
+ ../ext/kvi_dcophelper.cpp \
../ext/kvi_doublebuffer.cpp \
../ext/kvi_garbage.cpp \
../ext/kvi_osinfo.cpp \
@@ -82,9 +83,13 @@ libkvilib_la_SOURCES = \
../tal/kvi_tal_filedialog.cpp \
../tal/kvi_tal_grid.cpp \
../tal/kvi_tal_hbox.cpp \
+ ../tal/kvi_tal_iconview.cpp \
+ ../tal/kvi_tal_listbox.cpp \
+ ../tal/kvi_tal_listview.cpp \
../tal/kvi_tal_mainwindow.cpp \
../tal/kvi_tal_menubar.cpp \
../tal/kvi_tal_popupmenu.cpp \
+ ../tal/kvi_tal_scrollview.cpp \
../tal/kvi_tal_toolbar.cpp \
../tal/kvi_tal_tooltip.cpp \
../tal/kvi_tal_vbox.cpp \
@@ -181,6 +186,15 @@ headers_HEADERS = \
../tal/kvi_tal_hbox.h \
../tal/kvi_tal_hbox_qt3.h \
../tal/kvi_tal_hbox_qt4.h \
+ ../tal/kvi_tal_iconview.h \
+ ../tal/kvi_tal_iconview_qt3.h \
+ ../tal/kvi_tal_iconview_qt4.h \
+ ../tal/kvi_tal_listbox.h \
+ ../tal/kvi_tal_listbox_qt3.h \
+ ../tal/kvi_tal_listbox_qt4.h \
+ ../tal/kvi_tal_listview.h \
+ ../tal/kvi_tal_listview_qt3.h \
+ ../tal/kvi_tal_listview_qt4.h \
../tal/kvi_tal_mainwindow.h \
../tal/kvi_tal_mainwindow_kde.h \
../tal/kvi_tal_mainwindow_qt.h \
@@ -190,6 +204,9 @@ headers_HEADERS = \
../tal/kvi_tal_popupmenu.h \
../tal/kvi_tal_popupmenu_qt3.h \
../tal/kvi_tal_popupmenu_qt4.h \
+ ../tal/kvi_tal_scrollview.h \
+ ../tal/kvi_tal_scrollview_qt3.h \
+ ../tal/kvi_tal_scrollview_qt4.h \
../tal/kvi_tal_toolbar.h \
../tal/kvi_tal_toolbar_kde.h \
../tal/kvi_tal_toolbar_qt.h \
@@ -255,6 +272,14 @@ headers_HEADERS = \
../tal/kvi_tal_widgetstack.cpp: ../tal/kvi_tal_widgetstack_qt4.moc
../tal/kvi_tal_popupmenu.cpp: ../tal/kvi_tal_popupmenu_qt3.moc
../tal/kvi_tal_popupmenu.cpp: ../tal/kvi_tal_popupmenu_qt4.moc
+../tal/kvi_tal_listview.cpp: ../tal/kvi_tal_listview_qt3.moc
+../tal/kvi_tal_listview.cpp: ../tal/kvi_tal_listview_qt4.moc
+../tal/kvi_tal_listbox.cpp: ../tal/kvi_tal_listbox_qt3.moc
+../tal/kvi_tal_listbox.cpp: ../tal/kvi_tal_listbox_qt4.moc
+../tal/kvi_tal_iconview.cpp: ../tal/kvi_tal_iconview_qt3.moc
+../tal/kvi_tal_iconview.cpp: ../tal/kvi_tal_iconview_qt4.moc
+../tal/kvi_tal_scrollview.cpp: ../tal/kvi_tal_scrollview_qt3.moc
+../tal/kvi_tal_scrollview.cpp: ../tal/kvi_tal_scrollview_qt4.moc
#
diff --git a/src/kvilib/ext/kvi_dcophelper.cpp b/src/kvilib/ext/kvi_dcophelper.cpp
new file mode 100644
index 000000000..e6cf375d6
--- /dev/null
+++ b/src/kvilib/ext/kvi_dcophelper.cpp
@@ -0,0 +1,303 @@
+//=============================================================================
+//
+// File : kvi_dcophelper.cpp
+// Created on Sat 20 Jan 2007 12:35:21 by Alexander Stillich
+//
+// This file is part of the KVIrc IRC client distribution
+// Copyright (C) 2005 Szymon Stefanek <pragma at kvirc dot net>
+// Copyright (C) 2007 Alexander Stillich <torque at pltn dot 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_dcophelper.h"
+
+#ifdef COMPILE_KDE_SUPPORT
+
+#include "dcopclient.h"
+
+#include <qdatastream.h>
+#include <qvaluelist.h>
+
+// must be included this way, since kvilib is built
+// before kvirc and symlinks to headers aren't set yet
+#include "../../kvirc/kernel/kvi_app.h"
+#include "kvi_thread.h"
+
+KviDCOPHelper::KviDCOPHelper(bool bStartApp, const QCString &szAppId)
+{
+ m_szAppId = szAppId;
+}
+
+KviDCOPHelper::~KviDCOPHelper()
+{
+}
+
+bool KviDCOPHelper::ensureAppRunning(const QString &szApp)
+{
+ if (findRunningApp(m_szAppId))
+ return true;
+
+ if (m_bStartApp)
+ return startApp(m_szAppId,400);
+
+ return false;
+}
+
+
+bool KviDCOPHelper::voidRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc)
+{
+ if(!ensureAppRunning(m_szAppId))return false;
+ QByteArray data;
+ return g_pApp->dcopClient()->send(m_szAppId,szObj,szFunc,data);
+}
+
+bool KviDCOPHelper::voidRetBoolDCOPCall(const QCString &szObj,const QCString &szFunc,bool bVal)
+{
+ if(!ensureAppRunning(m_szAppId))return false;
+ QByteArray data;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << bVal;
+ return g_pApp->dcopClient()->send(m_szAppId,szObj,szFunc,data);
+}
+
+bool KviDCOPHelper::voidRetIntDCOPCall(const QCString &szObj,const QCString &szFunc,int iVal)
+{
+ if(!ensureAppRunning(m_szAppId))return false;
+ QByteArray data;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << iVal;
+ return g_pApp->dcopClient()->send(m_szAppId,szObj,szFunc,data);
+}
+
+bool KviDCOPHelper::voidRetIntBoolDCOPCall(const QCString &szObj,const QCString &szFunc,int iVal, bool bVal)
+{
+ if(!ensureAppRunning(m_szAppId))return false;
+ QByteArray data;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << iVal;
+ arg << bVal;
+ return g_pApp->dcopClient()->send(m_szAppId,szObj,szFunc,data);
+}
+
+bool KviDCOPHelper::voidRetFloatDCOPCall(const QCString &szObj,const QCString &szFunc,float fVal)
+{
+ if(!ensureAppRunning(m_szAppId))return false;
+ QByteArray data;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << fVal;
+ return g_pApp->dcopClient()->send(m_szAppId,szObj,szFunc,data);
+}
+
+bool KviDCOPHelper::voidRetStringDCOPCall(const QCString &szObj,const QCString &szFunc,const QString &szVal)
+{
+ if(!ensureAppRunning(m_szAppId))return false;
+ QByteArray data;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << szVal;
+ return g_pApp->dcopClient()->send(m_szAppId,szObj,szFunc,data);
+}
+
+bool KviDCOPHelper::stringRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc,QString &ret)
+{
+ if(!ensureAppRunning(m_szAppId))return false;
+ QByteArray data, replyData;
+ QCString replyType;
+ if(!g_pApp->dcopClient()->call(m_szAppId,szObj,szFunc,data,replyType,replyData))
+ return false;
+ QDataStream reply( replyData, IO_ReadOnly );
+ if(replyType == "QString")
+ {
+ reply >> ret;
+ return true;
+ }
+ return false;
+}
+
+bool KviDCOPHelper::intRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc,int &ret)
+{
+ if(!ensureAppRunning(m_szAppId))return false;
+ QByteArray data, replyData;
+ QCString replyType;
+ if(!g_pApp->dcopClient()->call(m_szAppId,szObj,szFunc,data,replyType,replyData))
+ return false;
+ QDataStream reply( replyData, IO_ReadOnly );
+ if(replyType == "int")
+ {
+ reply >> ret;
+ return true;
+ }
+ return false;
+}
+
+bool KviDCOPHelper::boolRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc,bool &ret)
+{
+ if(!ensureAppRunning(m_szAppId))return false;
+ QByteArray data, replyData;
+ QCString replyType;
+ if(!g_pApp->dcopClient()->call(m_szAppId,szObj,szFunc,data,replyType,replyData))
+ return false;
+ QDataStream reply( replyData, IO_ReadOnly );
+ if(replyType == "bool")
+ {
+ reply >> ret;
+ return true;
+ }
+ return false;
+}
+
+bool KviDCOPHelper::qvalueListIntRetIntDCOPCall(const QCString &szObj,const QCString &szFunc,KviValueList<int> &ret, int iVal)
+{
+ if(!ensureAppRunning(m_szAppId))
+ return false;
+
+ QByteArray data, replyData;
+ QCString replyType;
+ QDataStream arg(data, IO_WriteOnly);
+
+ arg << iVal;
+
+
+ if(!g_pApp->dcopClient()->call(m_szAppId,szObj,szFunc,data,replyType,replyData))
+ return false;
+
+ if(replyType != "QValueList<int>")
+ return false;
+
+ QDataStream replyStream(replyData, IO_ReadOnly);
+ replyStream >> ret;
+
+ return true;
+}
+
+bool KviDCOPHelper::qcstringListRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc,KviQCStringList &ret)
+{
+ QByteArray data, replyData;
+ QCString replyType;
+
+ if (!g_pApp->dcopClient()->call(m_szAppId,szObj,szFunc,data,replyType,replyData))
+ return false;
+
+ if (replyType != "QCStringList")
+ return false;
+
+ QDataStream replyStream(replyData, IO_ReadOnly);
+ replyStream >> ret;
+
+ return true;
+}
+
+bool KviDCOPHelper::qcstringListRetIntDCOPCall(const QCString &szObj,const QCString &szFunc,KviQCStringList &ret, int iVal)
+{
+ QByteArray data, replyData;
+ QCString replyType;
+
+ QDataStream arg(data, IO_WriteOnly);
+ arg << iVal;
+
+ if (!g_pApp->dcopClient()->call(m_szAppId,szObj,szFunc,data,replyType,replyData))
+ return false;
+
+ if (replyType != "QCStringList")
+ return false;
+
+ QDataStream replyStream(replyData, IO_ReadOnly);
+ replyStream >> ret;
+
+ return true;
+}
+
+bool KviDCOPHelper::findRunningApp(const QString &szApp)
+{
+ QValueList<QCString> allApps = g_pApp->dcopClient() ->registeredApplications();
+ QValueList<QCString>::iterator iterator;
+ QCString sz = szApp.local8Bit();
+ for (iterator = allApps.begin();iterator != allApps.end();iterator++)
+ {
+ if(*iterator == sz)
+ return true;
+ }
+ return false;
+}
+
+int KviDCOPHelper::detectApp(const QString &szApp,bool bStart,int iScoreWhenFound,int iScoreWhenStarted)
+{
+ // dcop available
+ if(!g_pApp->dcopClient())
+ return 0;
+
+ if(findRunningApp(szApp))
+ return 95; // found a running app, no need to run further
+
+ // no app found running
+ if(bStart)
+ {
+ // try to start it
+ if(!startApp(szApp,5000))
+ return 10; // very low possibility
+ return findRunningApp(szApp) ? 99 : 0; // try to find it again
+ }
+
+ return 30; // it still might be installed on the system but we're just unable to start it...
+}
+
+
+bool KviDCOPHelper::startApp(const QString &szApp,int iWaitMSecs)
+{
+ // we could use KApplication::startServiceByDesktopName here
+ // but we want to be able to wait a defined amount of time
+ QStringList tmp;
+ QByteArray data, replyData;
+ QCString replyType;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << szApp << tmp;
+ if(!g_pApp->dcopClient()->call(
+ "klauncher",
+ "klauncher",
+ "start_service_by_desktop_name(QString,QStringList)",
+ data,
+ replyType,
+ replyData))
+ {
+ return false;
+ } else {
+ QDataStream reply(replyData, IO_ReadOnly);
+ if(replyType != "serviceResult")return false;
+ int result;
+ QCString dcopName;
+ QString error;
+ reply >> result >> dcopName >> error;
+ if(result != 0)return false;
+ }
+ // ok , we seem to have started it.. but it might take some seconds
+ // for the app to get registered
+ // we wait up to five seconds
+ if(iWaitMSecs > 0)
+ {
+ int i = 0;
+ while(i < iWaitMSecs)
+ {
+ if(findRunningApp(szApp))return true;
+ KviThread::msleep(100);
+ i += 100;
+ }
+ return findRunningApp(szApp);
+ }
+ return true;
+}
+
+
+#endif //COMPILE_KDE_SUPPORT
diff --git a/src/kvilib/ext/kvi_dcophelper.h b/src/kvilib/ext/kvi_dcophelper.h
new file mode 100644
index 000000000..e5c8aac03
--- /dev/null
+++ b/src/kvilib/ext/kvi_dcophelper.h
@@ -0,0 +1,80 @@
+#ifndef _KVI_DCOPHELPER_H_
+#define _KVI_DCOPHELPER_H_
+//=============================================================================
+//
+// File : kvi_dcophelper.h
+// Created on Sat 20 Jan 2007 12:35:21 by Alexander Stillich
+//
+// This file is part of the KVIrc IRC client distribution
+// Copyright (C) 2005 Szymon Stefanek <pragma at kvirc dot net>
+// Copyright (C) 2007 Alexander Stillich <torque at pltn dot 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+#include "kvi_qstring.h"
+#include "kvi_valuelist.h"
+
+#ifdef COMPILE_KDE_SUPPORT
+
+typedef KviValueList<KviQCString> KviQCStringList;
+
+class KviDCOPHelper
+{
+
+public:
+
+ // Constructs a DCOP helper object.
+ // bStartApp: tries to start application when a dcop call is about to be made and the app is not already running
+ // szAppID: application name as seen by DCOP
+ KviDCOPHelper(bool bStartApp, const QCString &szAppId);
+ ~KviDCOPHelper();
+
+protected:
+
+ QCString m_szAppId;
+ bool m_bStartApp;
+
+protected:
+
+ bool ensureAppRunning(const QString &szApp);
+ bool findRunningApp(const QString &szApp);
+ bool startApp(const QString &szApp,int iWaitMSecs = 0);
+ int detectApp(const QString &szApp,bool bStart,int iScoreWhenFound,int iScoreWhenStarted);
+
+ // naming convention: [return value] Ret [argument type(s)] DCOPCall
+
+ bool voidRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc);
+ bool voidRetIntDCOPCall(const QCString &szObj,const QCString &szFunc,int iVal);
+ bool voidRetIntBoolDCOPCall(const QCString &szObj,const QCString &szFunc,int iVal, bool bVal);
+ bool voidRetIntIntIntDCOPCall(const QCString &szObj,const QCString &szFunc,int iVal1, int iVal2, int iVal3);
+ bool voidRetBoolDCOPCall(const QCString &szObj,const QCString &szFunc,bool bVal);
+ bool voidRetStringDCOPCall(const QCString &szObj,const QCString &szFunc,const QString &szVal);
+ bool voidRetFloatDCOPCall(const QCString &szObj,const QCString &szFunc,float fVal);
+ bool stringRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc,QString &ret);
+ bool intRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc,int &ret);
+ bool intRetIntDCOPCall(const QCString &szObj,const QCString &szFunc,int &ret, int iVal);
+ bool boolRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc,bool &ret);
+
+ bool qvalueListIntRetIntDCOPCall(const QCString &szObj,const QCString &szFunc,KviValueList<int> &ret, int iVal);
+ bool qcstringListRetIntDCOPCall(const QCString &szObj,const QCString &szFunc,KviQCStringList &ret, int iVal);
+ bool qcstringListRetVoidDCOPCall(const QCString &szObj,const QCString &szFunc,KviQCStringList &ret);
+};
+
+#endif //COMPILE_KDE_SUPPORT
+
+#endif // _KVI_DCOPHELPER_H_
diff --git a/src/kvilib/ext/kvi_regusersdb.cpp b/src/kvilib/ext/kvi_regusersdb.cpp
index 50998dce5..7e92432b4 100644
--- a/src/kvilib/ext/kvi_regusersdb.cpp
+++ b/src/kvilib/ext/kvi_regusersdb.cpp
@@ -247,11 +247,11 @@ bool KviRegisteredUser::getProperty(const QString & name,QString &value)
const QString & KviRegisteredUser::getProperty(const QString & name)
{
- if(!m_pPropertyDict)return QString::null;
- if(name.isEmpty())return QString::null;
+ if(!m_pPropertyDict)return KviQString::empty;
+ if(name.isEmpty())return KviQString::empty;
QString * pValue = m_pPropertyDict->find(name);
if(pValue)return *pValue;
- return QString::null;
+ return KviQString::empty;
}
bool KviRegisteredUser::getBoolProperty(const QString & name,bool def)
diff --git a/src/kvilib/file/kvi_packagefile.cpp b/src/kvilib/file/kvi_packagefile.cpp
index c489089b4..bf872be16 100644
--- a/src/kvilib/file/kvi_packagefile.cpp
+++ b/src/kvilib/file/kvi_packagefile.cpp
@@ -46,16 +46,24 @@
// Field Type Bytes Description
//-------------------------------------------------------------------------------
- // PackageHeader:
+// Package:
+// PackageHeader
+// PackageInfo
+// PackageData
+
+// PackageHeader:
// Magic Bytes 4 'KVPF': Signature for the Kvirc Package File
// Version uint32 4 0x00000001: Version of this package file
// Flags uint32 4 0x00000000: Flags, in version 1 is reserved and must be zero
+//
+
// PackageInfo:
// InfoFieldCount uint32 4 Number of package info fields
// InfoField InfoField Variable A list of informational name-value pairs
// InfoField InfoField Variable A list of informational name-value pairs
// InfoField InfoField Variable A list of informational name-value pairs
// .... .... ....
+
// PackageData:
// DataField DataField Variable A list of data fields with format defined below
// DataField DataField Variable A list of data fields with format defined below
diff --git a/src/kvilib/tal/kvi_tal_iconview.cpp b/src/kvilib/tal/kvi_tal_iconview.cpp
new file mode 100644
index 000000000..b045fe44b
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_iconview.cpp
@@ -0,0 +1,215 @@
+//=============================================================================
+//
+// File : kvi_tal_iconview.cpp
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#define __KVILIB__
+#include "kvi_tal_iconview.h"
+
+#ifdef COMPILE_USE_QT4
+
+ KviTalIconView::KviTalIconView(QWidget * pParent,Qt::WFlags f)
+ : Q3IconView(pParent,0,f)
+ {
+ connect(this,SIGNAL(selectionChanged(Q3IconViewItem *)),this,SLOT(redirect_selectionChanged(Q3IconViewItem *)));
+ connect(this,SIGNAL(currentChanged(Q3IconViewItem *)),this,SLOT(redirect_currentChanged(Q3IconViewItem *)));
+ connect(this,SIGNAL(clicked(Q3IconViewItem *)),this,SLOT(redirect_clicked(Q3IconViewItem *)));
+ connect(this,SIGNAL(clicked(Q3IconViewItem *,const QPoint &)),this,SLOT(redirect_clicked(Q3IconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(pressed(Q3IconViewItem *)),this,SLOT(redirect_pressed(Q3IconViewItem *)));
+ connect(this,SIGNAL(pressed(Q3IconViewItem *,const QPoint &)),this,SLOT(redirect_pressed(Q3IconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(doubleClicked(Q3IconViewItem *)),this,SLOT(redirect_doubleClicked(Q3IconViewItem *)));
+ connect(this,SIGNAL(returnPressed(Q3IconViewItem *)),this,SLOT(redirect_returnPressed(Q3IconViewItem *)));
+ connect(this,SIGNAL(rightButtonClicked(Q3IconViewItem *,const QPoint &)),this,SLOT(redirect_rightButtonClicked(Q3IconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(rightButtonPressed(Q3IconViewItem *,const QPoint &)),this,SLOT(redirect_rightButtonPressed(Q3IconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(mouseButtonClicked(int,Q3IconViewItem *,const QPoint &)),this,SLOT(redirect_mouseButtonClicked(int,Q3IconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(mouseButtonPressed(int,Q3IconViewItem *,const QPoint &)),this,SLOT(redirect_mouseButtonPressed(int,Q3IconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(contextMenuRequested(Q3IconViewItem *,const QPoint &)),this,SLOT(redirect_contextMenuRequested(Q3IconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(onItem(Q3IconViewItem *)),this,SLOT(redirect_onItem(Q3IconViewItem *)));
+ }
+
+ void KviTalIconView::redirect_selectionChanged(Q3IconViewItem * pItem)
+ {
+ emit selectionChanged((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_currentChanged(Q3IconViewItem * pItem)
+ {
+ emit currentChanged((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_clicked(Q3IconViewItem * pItem)
+ {
+ emit clicked((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_clicked(Q3IconViewItem * pItem,const QPoint &pnt)
+ {
+ emit clicked((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_pressed(Q3IconViewItem * pItem)
+ {
+ emit pressed((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_pressed(Q3IconViewItem * pItem,const QPoint &pnt)
+ {
+ emit pressed((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_doubleClicked(Q3IconViewItem * pItem)
+ {
+ emit doubleClicked((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_returnPressed(Q3IconViewItem * pItem)
+ {
+ emit returnPressed((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_rightButtonClicked(Q3IconViewItem * pItem,const QPoint &pnt)
+ {
+ emit rightButtonClicked((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_rightButtonPressed(Q3IconViewItem * pItem,const QPoint &pnt)
+ {
+ emit rightButtonPressed((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_mouseButtonClicked(int iButton,Q3IconViewItem * pItem,const QPoint &pnt)
+ {
+ emit mouseButtonClicked(iButton,(KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_mouseButtonPressed(int iButton,Q3IconViewItem * pItem,const QPoint &pnt)
+ {
+ emit mouseButtonPressed(iButton,(KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_contextMenuRequested(Q3IconViewItem * pItem,const QPoint &pnt)
+ {
+ emit contextMenuRequested((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_onItem(Q3IconViewItem * pItem)
+ {
+ emit onItem((KviTalIconViewItem *)pItem);
+ }
+
+
+ #include "kvi_tal_iconview_qt4.moc"
+#else
+
+ KviTalIconView::KviTalIconView(QWidget * pParent,Qt::WFlags f)
+ : QIconView(pParent,0,f)
+ {
+ connect(this,SIGNAL(selectionChanged(QIconViewItem *)),this,SLOT(redirect_selectionChanged(QIconViewItem *)));
+ connect(this,SIGNAL(currentChanged(QIconViewItem *)),this,SLOT(redirect_currentChanged(QIconViewItem *)));
+ connect(this,SIGNAL(clicked(QIconViewItem *)),this,SLOT(redirect_clicked(QIconViewItem *)));
+ connect(this,SIGNAL(clicked(QIconViewItem *,const QPoint &)),this,SLOT(redirect_clicked(QIconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(pressed(QIconViewItem *)),this,SLOT(redirect_pressed(QIconViewItem *)));
+ connect(this,SIGNAL(pressed(QIconViewItem *,const QPoint &)),this,SLOT(redirect_pressed(QIconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(doubleClicked(QIconViewItem *)),this,SLOT(redirect_doubleClicked(QIconViewItem *)));
+ connect(this,SIGNAL(returnPressed(QIconViewItem *)),this,SLOT(redirect_returnPressed(QIconViewItem *)));
+ connect(this,SIGNAL(rightButtonClicked(QIconViewItem *,const QPoint &)),this,SLOT(redirect_rightButtonClicked(QIconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(rightButtonPressed(QIconViewItem *,const QPoint &)),this,SLOT(redirect_rightButtonPressed(QIconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(mouseButtonClicked(int,QIconViewItem *,const QPoint &)),this,SLOT(redirect_mouseButtonClicked(int,QIconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(mouseButtonPressed(int,QIconViewItem *,const QPoint &)),this,SLOT(redirect_mouseButtonPressed(int,QIconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(contextMenuRequested(QIconViewItem *,const QPoint &)),this,SLOT(redirect_contextMenuRequested(QIconViewItem *,const QPoint &)));
+ connect(this,SIGNAL(onItem(QIconViewItem *)),this,SLOT(redirect_onItem(QIconViewItem *)));
+ }
+
+ void KviTalIconView::redirect_selectionChanged(QIconViewItem * pItem)
+ {
+ emit selectionChanged((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_currentChanged(QIconViewItem * pItem)
+ {
+ emit currentChanged((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_clicked(QIconViewItem * pItem)
+ {
+ emit clicked((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_clicked(QIconViewItem * pItem,const QPoint &pnt)
+ {
+ emit clicked((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_pressed(QIconViewItem * pItem)
+ {
+ emit pressed((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_pressed(QIconViewItem * pItem,const QPoint &pnt)
+ {
+ emit pressed((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_doubleClicked(QIconViewItem * pItem)
+ {
+ emit doubleClicked((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_returnPressed(QIconViewItem * pItem)
+ {
+ emit returnPressed((KviTalIconViewItem *)pItem);
+ }
+
+ void KviTalIconView::redirect_rightButtonClicked(QIconViewItem * pItem,const QPoint &pnt)
+ {
+ emit rightButtonClicked((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_rightButtonPressed(QIconViewItem * pItem,const QPoint &pnt)
+ {
+ emit rightButtonPressed((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_mouseButtonClicked(int iButton,QIconViewItem * pItem,const QPoint &pnt)
+ {
+ emit mouseButtonClicked(iButton,(KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_mouseButtonPressed(int iButton,QIconViewItem * pItem,const QPoint &pnt)
+ {
+ emit mouseButtonPressed(iButton,(KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_contextMenuRequested(QIconViewItem * pItem,const QPoint &pnt)
+ {
+ emit contextMenuRequested((KviTalIconViewItem *)pItem,pnt);
+ }
+
+ void KviTalIconView::redirect_onItem(QIconViewItem * pItem)
+ {
+ emit onItem((KviTalIconViewItem *)pItem);
+ }
+
+
+ #include "kvi_tal_iconview_qt3.moc"
+#endif
+
diff --git a/src/kvilib/tal/kvi_tal_iconview.h b/src/kvilib/tal/kvi_tal_iconview.h
new file mode 100644
index 000000000..1ef7ee8d1
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_iconview.h
@@ -0,0 +1,36 @@
+#ifndef _KVI_TAL_ICONVIEW_H_
+#define _KVI_TAL_ICONVIEW_H_
+
+//=============================================================================
+//
+// File : kvi_tal_iconview.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+
+#ifdef COMPILE_USE_QT4
+ #include "kvi_tal_iconview_qt4.h"
+#else
+ #include "kvi_tal_iconview_qt3.h"
+#endif
+
+#endif // _KVI_TAL_ICONVIEW_H_
diff --git a/src/kvilib/tal/kvi_tal_iconview_qt3.h b/src/kvilib/tal/kvi_tal_iconview_qt3.h
new file mode 100644
index 000000000..371a296d6
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_iconview_qt3.h
@@ -0,0 +1,100 @@
+#ifndef _KVI_TAL_ICONVIEW_QT3_H_
+#define _KVI_TAL_ICONVIEW_QT3_H_
+
+//=============================================================================
+//
+// File : kvi_tal_iconview_qt3.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+#include "kvi_qstring.h"
+
+#include <qiconview.h>
+
+class KviTalIconViewItem;
+
+
+class KVILIB_API KviTalIconView : public QIconView
+{
+ Q_OBJECT
+public:
+ KviTalIconView(QWidget * pParent,Qt::WFlags f = 0);
+ virtual ~KviTalIconView() {};
+signals:
+ void selectionChanged(KviTalIconViewItem * pItem);
+ void currentChanged(KviTalIconViewItem * pItem);
+ void clicked(KviTalIconViewItem * pItem);
+ void clicked(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void pressed(KviTalIconViewItem * pItem);
+ void pressed(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void doubleClicked(KviTalIconViewItem * pItem);
+ void returnPressed(KviTalIconViewItem * pItem);
+ void rightButtonClicked(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void rightButtonPressed(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void mouseButtonClicked(int iButton,KviTalIconViewItem * pItem,const QPoint &pnt);
+ void mouseButtonPressed(int iButton,KviTalIconViewItem * pItem,const QPoint &pnt);
+ void contextMenuRequested(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void onItem(KviTalIconViewItem * pItem);
+protected slots:
+ void redirect_selectionChanged(QIconViewItem * pItem);
+ void redirect_currentChanged(QIconViewItem * pItem);
+ void redirect_clicked(QIconViewItem * pItem);
+ void redirect_clicked(QIconViewItem * pItem,const QPoint &pnt);
+ void redirect_pressed(QIconViewItem * pItem);
+ void redirect_pressed(QIconViewItem * pItem,const QPoint &pnt);
+ void redirect_doubleClicked(QIconViewItem * pItem);
+ void redirect_returnPressed(QIconViewItem * pItem);
+ void redirect_rightButtonClicked(QIconViewItem * pItem,const QPoint &pnt);
+ void redirect_rightButtonPressed(QIconViewItem * pItem,const QPoint &pnt);
+ void redirect_mouseButtonClicked(int iButton,QIconViewItem * pItem,const QPoint &pnt);
+ void redirect_mouseButtonPressed(int iButton,QIconViewItem * pItem,const QPoint &pnt);
+ void redirect_contextMenuRequested(QIconViewItem * pItem,const QPoint &pnt);
+ void redirect_onItem(QIconViewItem * pItem);
+public:
+ KviTalIconViewItem * firstItem() const { return (KviTalIconViewItem *)QIconView::firstItem(); };
+ KviTalIconViewItem * lastItem() const { return (KviTalIconViewItem *)QIconView::lastItem(); };
+ KviTalIconViewItem * currentItem() const { return (KviTalIconViewItem *)QIconView::currentItem(); };
+};
+
+class KVILIB_API KviTalIconViewItem : public QIconViewItem
+{
+public:
+ KviTalIconViewItem(KviTalIconView * parent)
+ : QIconViewItem(parent) {};
+ KviTalIconViewItem(KviTalIconView * parent,KviTalIconViewItem * after)
+ : QIconViewItem(parent,after) {};
+ KviTalIconViewItem(KviTalIconView * parent, const QString & text)
+ : QIconViewItem(parent,text) {};
+ KviTalIconViewItem(KviTalIconView * parent, KviTalIconViewItem * after, const QString & text)
+ : QIconViewItem(parent,after,text) {};
+ KviTalIconViewItem(KviTalIconView * parent, const QString & text, const QPixmap & icon)
+ : QIconViewItem(parent,text,icon) {};
+ KviTalIconViewItem(KviTalIconView * parent, KviTalIconViewItem * after, const QString & text, const QPixmap & icon)
+ : QIconViewItem(parent,after,text,icon) {};
+public:
+ KviTalIconView * iconView() const { return (KviTalIconView *)QIconViewItem::iconView(); };
+ KviTalIconViewItem * prevItem() const { return (KviTalIconViewItem *)QIconViewItem::prevItem(); };
+ KviTalIconViewItem * nextItem() const { return (KviTalIconViewItem *)QIconViewItem::nextItem(); };
+};
+
+
+#endif // _KVI_TAL_ICONVIEW_QT3_H_
diff --git a/src/kvilib/tal/kvi_tal_iconview_qt4.h b/src/kvilib/tal/kvi_tal_iconview_qt4.h
new file mode 100644
index 000000000..899acaac2
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_iconview_qt4.h
@@ -0,0 +1,99 @@
+#ifndef _KVI_TAL_ICONVIEW_QT4_H_
+#define _KVI_TAL_ICONVIEW_QT4_H_
+
+//=============================================================================
+//
+// File : kvi_tal_iconview_qt4.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 440, Boston, MA 02111-1407, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+#include "kvi_qstring.h"
+
+#include <q3iconview.h>
+
+class KviTalIconViewItem;
+
+class KVILIB_API KviTalIconView : public Q3IconView
+{
+ Q_OBJECT
+public:
+ KviTalIconView(QWidget * pParent,Qt::WFlags f = 0);
+ virtual ~KviTalIconView() {};
+signals:
+ void selectionChanged(KviTalIconViewItem * pItem);
+ void currentChanged(KviTalIconViewItem * pItem);
+ void clicked(KviTalIconViewItem * pItem);
+ void clicked(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void pressed(KviTalIconViewItem * pItem);
+ void pressed(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void doubleClicked(KviTalIconViewItem * pItem);
+ void returnPressed(KviTalIconViewItem * pItem);
+ void rightButtonClicked(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void rightButtonPressed(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void mouseButtonClicked(int iButton,KviTalIconViewItem * pItem,const QPoint &pnt);
+ void mouseButtonPressed(int iButton,KviTalIconViewItem * pItem,const QPoint &pnt);
+ void contextMenuRequested(KviTalIconViewItem * pItem,const QPoint &pnt);
+ void onItem(KviTalIconViewItem * pItem);
+protected slots:
+ void redirect_selectionChanged(Q3IconViewItem * pItem);
+ void redirect_currentChanged(Q3IconViewItem * pItem);
+ void redirect_clicked(Q3IconViewItem * pItem);
+ void redirect_clicked(Q3IconViewItem * pItem,const QPoint &pnt);
+ void redirect_pressed(Q3IconViewItem * pItem);
+ void redirect_pressed(Q3IconViewItem * pItem,const QPoint &pnt);
+ void redirect_doubleClicked(Q3IconViewItem * pItem);
+ void redirect_returnPressed(Q3IconViewItem * pItem);
+ void redirect_rightButtonClicked(Q3IconViewItem * pItem,const QPoint &pnt);
+ void redirect_rightButtonPressed(Q3IconViewItem * pItem,const QPoint &pnt);
+ void redirect_mouseButtonClicked(int iButton,Q3IconViewItem * pItem,const QPoint &pnt);
+ void redirect_mouseButtonPressed(int iButton,Q3IconViewItem * pItem,const QPoint &pnt);
+ void redirect_contextMenuRequested(Q3IconViewItem * pItem,const QPoint &pnt);
+ void redirect_onItem(Q3IconViewItem * pItem);
+public:
+ KviTalIconViewItem * firstItem() const { return (KviTalIconViewItem *)Q3IconView::firstItem(); };
+ KviTalIconViewItem * lastItem() const { return (KviTalIconViewItem *)Q3IconView::lastItem(); };
+ KviTalIconViewItem * currentItem() const { return (KviTalIconViewItem *)Q3IconView::currentItem(); };
+};
+
+class KVILIB_API KviTalIconViewItem : public Q3IconViewItem
+{
+public:
+ KviTalIconViewItem(KviTalIconView * parent)
+ : Q3IconViewItem(parent) {};
+ KviTalIconViewItem(KviTalIconView * parent,KviTalIconViewItem * after)
+ : Q3IconViewItem(parent,after) {};
+ KviTalIconViewItem(KviTalIconView * parent, const QString & text)
+ : Q3IconViewItem(parent,text) {};
+ KviTalIconViewItem(KviTalIconView * parent, KviTalIconViewItem * after, const QString & text)
+ : Q3IconViewItem(parent,after,text) {};
+ KviTalIconViewItem(KviTalIconView * parent, const QString & text, const QPixmap & icon)
+ : Q3IconViewItem(parent,text,icon) {};
+ KviTalIconViewItem(KviTalIconView * parent, KviTalIconViewItem * after, const QString & text, const QPixmap & icon)
+ : Q3IconViewItem(parent,after,text,icon) {};
+public:
+ KviTalIconView * iconView() const { return (KviTalIconView *)Q3IconViewItem::iconView(); };
+ KviTalIconViewItem * prevItem() const { return (KviTalIconViewItem *)Q3IconViewItem::prevItem(); };
+ KviTalIconViewItem * nextItem() const { return (KviTalIconViewItem *)Q3IconViewItem::nextItem(); };
+};
+
+
+#endif // _KVI_TAL_ICONVIEW_QT4_H_
diff --git a/src/kvilib/tal/kvi_tal_listbox.cpp b/src/kvilib/tal/kvi_tal_listbox.cpp
new file mode 100644
index 000000000..c33eab8a1
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_listbox.cpp
@@ -0,0 +1,513 @@
+//=============================================================================
+//
+// File : kvi_tal_listbox.cpp
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#define __KVILIB__
+#include "kvi_tal_listbox.h"
+
+#ifdef COMPILE_USE_QT4
+ #include <qpainter.h>
+ #include <qstyle.h>
+ #include <qapplication.h>
+
+ KviTalListBox::KviTalListBox(QWidget * pParent,Qt::WFlags f = 0)
+ : Q3ListBox(pParent,0,f)
+ {
+ connect(this,SIGNAL(highlighted(Q3ListBoxItem *)),this,SLOT(redirect_highlighted(Q3ListBoxItem *)));
+ connect(this,SIGNAL(selected(Q3ListBoxItem *)),this,SLOT(redirect_selected(Q3ListBoxItem *)));
+ connect(this,SIGNAL(selectionChanged(Q3ListBoxItem *)),this,SLOT(redirect_selectionChanged(Q3ListBoxItem *)));
+ connect(this,SIGNAL(currentChanged(Q3ListBoxItem *)),this,SLOT(redirect_currentChanged(Q3ListBoxItem *)));
+ connect(this,SIGNAL(clicked(Q3ListBoxItem *)),this,SLOT(redirect_clicked(Q3ListBoxItem *)));
+ connect(this,SIGNAL(clicked(Q3ListBoxItem *,const QPoint &)),this,SLOT(redirect_clicked(Q3ListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(pressed(Q3ListBoxItem *)),this,SLOT(redirect_pressed(Q3ListBoxItem *)));
+ connect(this,SIGNAL(pressed(Q3ListBoxItem *,const QPoint &)),this,SLOT(redirect_pressed(Q3ListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(doubleClicked(Q3ListBoxItem *)),this,SLOT(redirect_doubleClicked(Q3ListBoxItem *)));
+ connect(this,SIGNAL(returnPressed(Q3ListBoxItem *)),this,SLOT(redirect_returnPressed(Q3ListBoxItem *)));
+ connect(this,SIGNAL(rightButtonClicked(Q3ListBoxItem *, const QPoint &)),this,SLOT(redirect_rightButtonClicked(Q3ListBoxItem *, const QPoint &)));
+ connect(this,SIGNAL(rightButtonPressed(Q3ListBoxItem *, const QPoint &)),this,SLOT(redirect_rightButtonPressed(Q3ListBoxItem *, const QPoint &)));
+ connect(this,SIGNAL(mouseButtonPressed(int,Q3ListBoxItem *,const QPoint &)),this,SLOT(redirect_mouseButtonPressed(int,Q3ListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(mouseButtonClicked(int,Q3ListBoxItem *,const QPoint &)),this,SLOT(redirect_mouseButtonClicked(int,Q3ListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(contextMenuRequested(Q3ListBoxItem *,const QPoint &)),this,SLOT(redirect_contextMenuRequested(Q3ListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(onItem(Q3ListBoxItem *)),this,SLOT(redirect_onItem(Q3ListBoxItem *)));
+ }
+
+ void KviTalListBox::redirect_highlighted(Q3ListBoxItem *item)
+ {
+ emit highlighted((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_selected(Q3ListBoxItem *item)
+ {
+ emit selected((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_selectionChanged(Q3ListBoxItem * item)
+ {
+ emit selectionChanged((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_currentChanged(Q3ListBoxItem * item)
+ {
+ emit currentChanged((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_clicked(Q3ListBoxItem * item)
+ {
+ emit clicked((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_clicked(Q3ListBoxItem * item,const QPoint & pnt)
+ {
+ emit clicked((KviTalListBoxItem *)item,pnt);
+ }
+
+ void KviTalListBox::redirect_pressed(Q3ListBoxItem * item)
+ {
+ emit pressed((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_pressed(Q3ListBoxItem * item,const QPoint & pnt)
+ {
+ emit pressed((KviTalListBoxItem *)item,pnt);
+ }
+
+ void KviTalListBox::redirect_doubleClicked(Q3ListBoxItem * item)
+ {
+ emit doubleClicked((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_returnPressed(Q3ListBoxItem * item)
+ {
+ emit returnPressed((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_rightButtonClicked(Q3ListBoxItem * item, const QPoint &pnt)
+ {
+ emit rightButtonClicked((KviTalListBoxItem *)item,pnt);
+ }
+
+ void KviTalListBox::redirect_rightButtonPressed(Q3ListBoxItem * item, const QPoint &pnt)
+ {
+ emit rightButtonPressed((KviTalListBoxItem *)item,pnt);
+ }
+
+ void KviTalListBox::redirect_mouseButtonPressed(int button,Q3ListBoxItem * item,const QPoint & pos)
+ {
+ emit mouseButtonPressed(button,(KviTalListBoxItem *)item,pos);
+ }
+
+ void KviTalListBox::redirect_mouseButtonClicked(int button,Q3ListBoxItem * item,const QPoint & pos)
+ {
+ emit mouseButtonClicked(button,(KviTalListBoxItem *)item,pos);
+ }
+
+ void KviTalListBox::redirect_contextMenuRequested(Q3ListBoxItem * item,const QPoint & pos)
+ {
+ emit contextMenuRequested((KviTalListBoxItem *)item,pos);
+ }
+
+ void KviTalListBox::redirect_onItem(Q3ListBoxItem * i)
+ {
+ emit onItem((KviTalListBoxItem *)i);
+ }
+
+ KviTalListBoxText::KviTalListBoxText(KviTalListBox *listbox, const QString &text)
+ :KviTalListBoxItem(listbox)
+ {
+ setText(text);
+ }
+
+ KviTalListBoxText::KviTalListBoxText(const QString &text)
+ :KviTalListBoxItem()
+ {
+ setText(text);
+ }
+
+ KviTalListBoxText::KviTalListBoxText(KviTalListBox* listbox, const QString &text, KviTalListBoxItem *after)
+ : KviTalListBoxItem(listbox, after)
+ {
+ setText(text);
+ }
+
+ KviTalListBoxText::~KviTalListBoxText()
+ {
+ }
+
+ void KviTalListBoxText::paint(QPainter *painter)
+ {
+ int itemHeight = height(listBox());
+ QFontMetrics fm = painter->fontMetrics();
+ int yPos = ((itemHeight - fm.height()) / 2) + fm.ascent();
+ painter->drawText(3, yPos, text());
+ }
+
+ int KviTalListBoxText::height(const KviTalListBox* lb) const
+ {
+ int h = lb ? lb->fontMetrics().lineSpacing() + 2 : 0;
+ return qMax(h, QApplication::globalStrut().height());
+ }
+
+ int KviTalListBoxText::width(const KviTalListBox* lb) const
+ {
+ int w = lb ? lb->fontMetrics().width(text()) + 6 : 0;
+ return qMax(w, QApplication::globalStrut().width());
+ }
+
+ int KviTalListBoxText::rtti() const
+ {
+ return RTTI;
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap(KviTalListBox* listbox, const QPixmap &pixmap)
+ : KviTalListBoxItem(listbox)
+ {
+ pm = pixmap;
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap(const QPixmap &pixmap)
+ : KviTalListBoxItem()
+ {
+ pm = pixmap;
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap(KviTalListBox* listbox, const QPixmap &pixmap, KviTalListBoxItem *after)
+ : KviTalListBoxItem(listbox, after)
+ {
+ pm = pixmap;
+ }
+
+ KviTalListBoxPixmap::~KviTalListBoxPixmap()
+ {
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap(KviTalListBox* listbox, const QPixmap &pix, const QString& text)
+ : KviTalListBoxItem(listbox)
+ {
+ pm = pix;
+ setText(text);
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap(const QPixmap & pix, const QString& text)
+ : KviTalListBoxItem()
+ {
+ pm = pix;
+ setText(text);
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap(KviTalListBox* listbox, const QPixmap & pix, const QString& text,
+ KviTalListBoxItem *after)
+ : KviTalListBoxItem(listbox, after)
+ {
+ pm = pix;
+ setText(text);
+ }
+
+ void KviTalListBoxPixmap::paint(QPainter *painter)
+ {
+ int itemHeight = height(listBox());
+ int yPos;
+
+ const QPixmap *pm = pixmap();
+ if (pm && ! pm->isNull()) {
+ yPos = (itemHeight - pm->height()) / 2;
+ painter->drawPixmap(3, yPos, *pm);
+ }
+
+ if (!text().isEmpty()) {
+ QFontMetrics fm = painter->fontMetrics();
+ yPos = ((itemHeight - fm.height()) / 2) + fm.ascent();
+ painter->drawText(pm->width() + 5, yPos, text());
+ }
+ }
+
+ int KviTalListBoxPixmap::height(const KviTalListBox* lb) const
+ {
+ int h;
+ if (text().isEmpty())
+ h = pm.height();
+ else
+ h = qMax(pm.height(), lb->fontMetrics().lineSpacing() + 2);
+ return qMax(h, QApplication::globalStrut().height());
+ }
+
+ int KviTalListBoxPixmap::width(const KviTalListBox* lb) const
+ {
+ if (text().isEmpty())
+ return qMax(pm.width() + 6, QApplication::globalStrut().width());
+ return qMax(pm.width() + lb->fontMetrics().width(text()) + 6,
+ QApplication::globalStrut().width());
+ }
+
+ int KviTalListBoxPixmap::rtti() const
+ {
+ return RTTI;
+ }
+
+
+ #include "kvi_tal_listbox_qt4.moc"
+#else
+ #include <qpainter.h>
+ #include <qstyle.h>
+ #include <qapplication.h>
+
+
+ KviTalListBox::KviTalListBox(QWidget * pParent,Qt::WFlags f)
+ : QListBox(pParent,0,f)
+ {
+ connect(this,SIGNAL(highlighted(QListBoxItem *)),this,SLOT(redirect_highlighted(QListBoxItem *)));
+ connect(this,SIGNAL(selected(QListBoxItem *)),this,SLOT(redirect_selected(QListBoxItem *)));
+ connect(this,SIGNAL(selectionChanged(QListBoxItem *)),this,SLOT(redirect_selectionChanged(QListBoxItem *)));
+ connect(this,SIGNAL(currentChanged(QListBoxItem *)),this,SLOT(redirect_currentChanged(QListBoxItem *)));
+ connect(this,SIGNAL(clicked(QListBoxItem *)),this,SLOT(redirect_clicked(QListBoxItem *)));
+ connect(this,SIGNAL(clicked(QListBoxItem *,const QPoint &)),this,SLOT(redirect_clicked(QListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(pressed(QListBoxItem *)),this,SLOT(redirect_pressed(QListBoxItem *)));
+ connect(this,SIGNAL(pressed(QListBoxItem *,const QPoint &)),this,SLOT(redirect_pressed(QListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(doubleClicked(QListBoxItem *)),this,SLOT(redirect_doubleClicked(QListBoxItem *)));
+ connect(this,SIGNAL(returnPressed(QListBoxItem *)),this,SLOT(redirect_returnPressed(QListBoxItem *)));
+ connect(this,SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)),this,SLOT(redirect_rightButtonClicked(QListBoxItem *, const QPoint &)));
+ connect(this,SIGNAL(rightButtonPressed(QListBoxItem *, const QPoint &)),this,SLOT(redirect_rightButtonPressed(QListBoxItem *, const QPoint &)));
+ connect(this,SIGNAL(mouseButtonPressed(int,QListBoxItem *,const QPoint &)),this,SLOT(redirect_mouseButtonPressed(int,QListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(mouseButtonClicked(int,QListBoxItem *,const QPoint &)),this,SLOT(redirect_mouseButtonClicked(int,QListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(contextMenuRequested(QListBoxItem *,const QPoint &)),this,SLOT(redirect_contextMenuRequested(QListBoxItem *,const QPoint &)));
+ connect(this,SIGNAL(onItem(QListBoxItem *)),this,SLOT(redirect_onItem(QListBoxItem *)));
+ }
+
+ void KviTalListBox::redirect_highlighted(QListBoxItem *item)
+ {
+ emit highlighted((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_selected(QListBoxItem *item)
+ {
+ emit selected((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_selectionChanged(QListBoxItem * item)
+ {
+ emit selectionChanged((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_currentChanged(QListBoxItem * item)
+ {
+ emit currentChanged((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_clicked(QListBoxItem * item)
+ {
+ emit clicked((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_clicked(QListBoxItem * item,const QPoint & pnt)
+ {
+ emit clicked((KviTalListBoxItem *)item,pnt);
+ }
+
+ void KviTalListBox::redirect_pressed(QListBoxItem * item)
+ {
+ emit pressed((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_pressed(QListBoxItem * item,const QPoint & pnt)
+ {
+ emit pressed((KviTalListBoxItem *)item,pnt);
+ }
+
+ void KviTalListBox::redirect_doubleClicked(QListBoxItem * item)
+ {
+ emit doubleClicked((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_returnPressed(QListBoxItem * item)
+ {
+ emit returnPressed((KviTalListBoxItem *)item);
+ }
+
+ void KviTalListBox::redirect_rightButtonClicked(QListBoxItem * item, const QPoint &pnt)
+ {
+ emit rightButtonClicked((KviTalListBoxItem *)item,pnt);
+ }
+
+ void KviTalListBox::redirect_rightButtonPressed(QListBoxItem * item, const QPoint &pnt)
+ {
+ emit rightButtonPressed((KviTalListBoxItem *)item,pnt);
+ }
+
+ void KviTalListBox::redirect_mouseButtonPressed(int button,QListBoxItem * item,const QPoint & pos)
+ {
+ emit mouseButtonPressed(button,(KviTalListBoxItem *)item,pos);
+ }
+
+ void KviTalListBox::redirect_mouseButtonClicked(int button,QListBoxItem * item,const QPoint & pos)
+ {
+ emit mouseButtonClicked(button,(KviTalListBoxItem *)item,pos);
+ }
+
+ void KviTalListBox::redirect_contextMenuRequested(QListBoxItem * item,const QPoint & pos)
+ {
+ emit contextMenuRequested((KviTalListBoxItem *)item,pos);
+ }
+
+ void KviTalListBox::redirect_onItem(QListBoxItem * i)
+ {
+ emit onItem((KviTalListBoxItem *)i);
+ }
+
+ KviTalListBoxText::KviTalListBoxText( KviTalListBox *listbox, const QString &text )
+ :KviTalListBoxItem( listbox )
+ {
+ setText( text );
+ }
+
+ KviTalListBoxText::KviTalListBoxText( const QString &text )
+ :KviTalListBoxItem()
+ {
+ setText( text );
+ }
+
+ KviTalListBoxText::KviTalListBoxText( KviTalListBox* listbox, const QString &text, KviTalListBoxItem *after )
+ : KviTalListBoxItem( listbox, after )
+ {
+ setText( text );
+ }
+
+ KviTalListBoxText::~KviTalListBoxText()
+ {
+ }
+
+ void KviTalListBoxText::paint( QPainter *painter )
+ {
+ int itemHeight = height( listBox() );
+ QFontMetrics fm = painter->fontMetrics();
+ int yPos = ( ( itemHeight - fm.height() ) / 2 ) + fm.ascent();
+ painter->drawText( 3, yPos, text() );
+ }
+
+ int KviTalListBoxText::height( const KviTalListBox* lb ) const
+ {
+ int h = lb ? lb->fontMetrics().lineSpacing() + 2 : 0;
+ return QMAX( h, QApplication::globalStrut().height() );
+ }
+
+ int KviTalListBoxText::width( const KviTalListBox* lb ) const
+ {
+ int w = lb ? lb->fontMetrics().width( text() ) + 6 : 0;
+ return QMAX( w, QApplication::globalStrut().width() );
+ }
+
+ int KviTalListBoxText::RTTI = 1;
+
+ int KviTalListBoxText::rtti() const
+ {
+ return RTTI;
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap( KviTalListBox* listbox, const QPixmap &pixmap )
+ : KviTalListBoxItem( listbox )
+ {
+ pm = pixmap;
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap( const QPixmap &pixmap )
+ : KviTalListBoxItem()
+ {
+ pm = pixmap;
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap( KviTalListBox* listbox, const QPixmap &pixmap, KviTalListBoxItem *after )
+ : KviTalListBoxItem( listbox, after )
+ {
+ pm = pixmap;
+ }
+
+ KviTalListBoxPixmap::~KviTalListBoxPixmap()
+ {
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap( KviTalListBox* listbox, const QPixmap &pix, const QString& text)
+ : KviTalListBoxItem( listbox )
+ {
+ pm = pix;
+ setText( text );
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap( const QPixmap & pix, const QString& text)
+ : KviTalListBoxItem()
+ {
+ pm = pix;
+ setText( text );
+ }
+
+ KviTalListBoxPixmap::KviTalListBoxPixmap( KviTalListBox* listbox, const QPixmap & pix, const QString& text,
+ KviTalListBoxItem *after )
+ : KviTalListBoxItem( listbox, after )
+ {
+ pm = pix;
+ setText( text );
+ }
+
+ void KviTalListBoxPixmap::paint( QPainter *painter )
+ {
+ int itemHeight = height( listBox() );
+ int yPos;
+
+ const QPixmap *pm = pixmap();
+ if ( pm && ! pm->isNull() ) {
+ yPos = ( itemHeight - pm->height() ) / 2;
+ painter->drawPixmap( 3, yPos, *pm);
+ }
+
+ if ( !text().isEmpty() ) {
+ QFontMetrics fm = painter->fontMetrics();
+ yPos = ( ( itemHeight - fm.height() ) / 2 ) + fm.ascent();
+ painter->drawText( pm->width() + 5, yPos, text() );
+ }
+ }
+
+ int KviTalListBoxPixmap::height( const KviTalListBox* lb ) const
+ {
+ int h;
+ if ( text().isEmpty() )
+ h = pm.height();
+ else
+ h = QMAX( pm.height(), lb->fontMetrics().lineSpacing() + 2 );
+ return QMAX( h, QApplication::globalStrut().height() );
+ }
+
+ int KviTalListBoxPixmap::width( const KviTalListBox* lb ) const
+ {
+ if ( text().isEmpty() )
+ return QMAX( pm.width() + 6, QApplication::globalStrut().width() );
+ return QMAX( pm.width() + lb->fontMetrics().width( text() ) + 6,
+ QApplication::globalStrut().width() );
+ }
+
+ int KviTalListBoxPixmap::RTTI = 2;
+
+ int KviTalListBoxPixmap::rtti() const
+ {
+ return RTTI;
+ }
+
+ #include "kvi_tal_listbox_qt3.moc"
+#endif
+
diff --git a/src/kvilib/tal/kvi_tal_listbox.h b/src/kvilib/tal/kvi_tal_listbox.h
new file mode 100644
index 000000000..89c4af14c
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_listbox.h
@@ -0,0 +1,50 @@
+#ifndef _KVI_TAL_LISTBOX_H_
+#define _KVI_TAL_LISTBOX_H_
+
+//=============================================================================
+//
+// File : kvi_tal_listbox.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+
+//
+// This is the only reasonable CROSS-QT3-QT4-COMPATIBLE implementation
+// of QListBox I've been able to find.
+// Note that using macros for the items will NOT work since moc
+// doesn't expand them. Note also that KviTalListBoxText must
+// be fully reimplemented and not be inherited from QListBoxText
+// to build up a consistent item object hierarchy. To complete
+// the obscenity, we need TWO COMPLETE implementations: one for Qt3
+// and one for Qt4... bleah :D
+//
+// The code for KviTalListBoxText is adapted from qlistbox.h/cpp
+// present in qt 3.3.6 AND in qt 4.1.2.
+//
+
+#ifdef COMPILE_USE_QT4
+ #include "kvi_tal_listbox_qt4.h"
+#else
+ #include "kvi_tal_listbox_qt3.h"
+#endif
+
+#endif // _KVI_TAL_LISTBOX_H_
diff --git a/src/kvilib/tal/kvi_tal_listbox_qt3.h b/src/kvilib/tal/kvi_tal_listbox_qt3.h
new file mode 100644
index 000000000..9aed91ae0
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_listbox_qt3.h
@@ -0,0 +1,153 @@
+#ifndef _KVI_TAL_LISTBOX_QT3_H_
+#define _KVI_TAL_LISTBOX_QT3_H_
+
+//=============================================================================
+//
+// File : kvi_tal_listbox_qt3.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+#include "kvi_qstring.h"
+#include <qlistbox.h>
+
+class KviTalListBoxItem;
+
+class KVILIB_API KviTalListBox : public QListBox
+{
+ Q_OBJECT
+public:
+ KviTalListBox(QWidget * pParent,Qt::WFlags f = 0);
+ virtual ~KviTalListBox() {};
+public:
+ KviTalListBoxItem * firstItem() const { return (KviTalListBoxItem *)QListBox::firstItem(); };
+ KviTalListBoxItem * selectedItem() const { return (KviTalListBoxItem *)QListBox::selectedItem(); };
+ KviTalListBoxItem * item(int iIndex) const { return (KviTalListBoxItem *)QListBox::item(iIndex); };
+signals:
+ void highlighted(KviTalListBoxItem *);
+ void selected(KviTalListBoxItem *);
+ void selectionChanged(KviTalListBoxItem * item);
+ void currentChanged(KviTalListBoxItem * item);
+ void clicked(KviTalListBoxItem * item);
+ void clicked(KviTalListBoxItem * item,const QPoint & pnt);
+ void pressed(KviTalListBoxItem * item);
+ void pressed(KviTalListBoxItem * item,const QPoint & pnt);
+ void doubleClicked(KviTalListBoxItem * item);
+ void returnPressed(KviTalListBoxItem * item);
+ void rightButtonClicked(KviTalListBoxItem *, const QPoint &);
+ void rightButtonPressed(KviTalListBoxItem *, const QPoint &);
+ void mouseButtonPressed(int button,KviTalListBoxItem * item,const QPoint & pos);
+ void mouseButtonClicked(int button,KviTalListBoxItem * item,const QPoint & pos);
+ void contextMenuRequested(KviTalListBoxItem * item,const QPoint & pos);
+ void onItem(KviTalListBoxItem * i);
+protected slots:
+ void redirect_highlighted(QListBoxItem *item);
+ void redirect_selected(QListBoxItem *item);
+ void redirect_selectionChanged(QListBoxItem * item);
+ void redirect_currentChanged(QListBoxItem * item);
+ void redirect_clicked(QListBoxItem * item);
+ void redirect_clicked(QListBoxItem * item,const QPoint & pnt);
+ void redirect_pressed(QListBoxItem * item);
+ void redirect_pressed(QListBoxItem * item,const QPoint & pnt);
+ void redirect_doubleClicked(QListBoxItem * item);
+ void redirect_returnPressed(QListBoxItem * item);
+ void redirect_rightButtonClicked(QListBoxItem * item, const QPoint &pnt);
+ void redirect_rightButtonPressed(QListBoxItem * item, const QPoint &pnt);
+ void redirect_mouseButtonPressed(int button,QListBoxItem * item,const QPoint & pos);
+ void redirect_mouseButtonClicked(int button,QListBoxItem * item,const QPoint & pos);
+ void redirect_contextMenuRequested(QListBoxItem * item,const QPoint & pos);
+ void redirect_onItem(QListBoxItem * i);
+};
+
+class KVILIB_API KviTalListBoxItem : public QListBoxItem
+{
+public:
+ KviTalListBoxItem()
+ : QListBoxItem() {};
+ KviTalListBoxItem(KviTalListBox * pParent)
+ : QListBoxItem(pParent) {};
+ KviTalListBoxItem(KviTalListBox * pParent,KviTalListBoxItem * pAfter)
+ : QListBoxItem(pParent,pAfter) {};
+ virtual ~KviTalListBoxItem() {};
+public:
+ KviTalListBoxItem * next() const { return (KviTalListBoxItem *)QListBoxItem::next(); };
+ KviTalListBoxItem * prev() const { return (KviTalListBoxItem *)QListBoxItem::prev(); };
+ KviTalListBox * listBox() const { return (KviTalListBox *)QListBoxItem::listBox(); };
+};
+
+class KVILIB_API KviTalListBoxText : public KviTalListBoxItem
+{
+public:
+ KviTalListBoxText( KviTalListBox* listbox, const QString & text=QString::null );
+ KviTalListBoxText( const QString & text=QString::null );
+ KviTalListBoxText( KviTalListBox* listbox, const QString & text, KviTalListBoxItem *after );
+ ~KviTalListBoxText();
+
+ int height( const KviTalListBox * ) const;
+ int width( const KviTalListBox * ) const;
+
+ int rtti() const;
+ static int RTTI;
+
+protected:
+ void paint( QPainter * );
+
+private: // Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+ KviTalListBoxText( const KviTalListBoxText & );
+ KviTalListBoxText &operator=( const KviTalListBoxText & );
+#endif
+};
+
+
+class KVILIB_API KviTalListBoxPixmap : public KviTalListBoxItem
+{
+public:
+ KviTalListBoxPixmap( KviTalListBox* listbox, const QPixmap & );
+ KviTalListBoxPixmap( const QPixmap & );
+ KviTalListBoxPixmap( KviTalListBox* listbox, const QPixmap & pix, KviTalListBoxItem *after );
+ KviTalListBoxPixmap( KviTalListBox* listbox, const QPixmap &, const QString& );
+ KviTalListBoxPixmap( const QPixmap &, const QString& );
+ KviTalListBoxPixmap( KviTalListBox* listbox, const QPixmap & pix, const QString&, KviTalListBoxItem *after );
+ ~KviTalListBoxPixmap();
+
+ const QPixmap *pixmap() const { return &pm; }
+
+ int height( const KviTalListBox * ) const;
+ int width( const KviTalListBox * ) const;
+
+ int rtti() const;
+ static int RTTI;
+
+protected:
+ void paint( QPainter * );
+
+private:
+ QPixmap pm;
+private: // Disabled copy constructor and operator=
+#if defined(Q_DISABLE_COPY)
+ KviTalListBoxPixmap( const KviTalListBoxPixmap & );
+ KviTalListBoxPixmap &operator=( const KviTalListBoxPixmap & );
+#endif
+};
+
+
+#endif // _KVI_TAL_LISTBOX_QT3_H_
diff --git a/src/kvilib/tal/kvi_tal_listbox_qt4.h b/src/kvilib/tal/kvi_tal_listbox_qt4.h
new file mode 100644
index 000000000..d4018f9cf
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_listbox_qt4.h
@@ -0,0 +1,149 @@
+#ifndef _KVI_TAL_LISTBOX_QT4_H_
+#define _KVI_TAL_LISTBOX_QT4_H_
+
+//=============================================================================
+//
+// File : kvi_tal_listbox_qt4.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+
+#include <q3listbox.h>
+
+class KviTalListBoxItem;
+
+
+class KVILIB_API KviTalListBox : public Q3ListBox
+{
+ Q_OBJECT
+public:
+ KviTalListBox(QWidget * pParent,Qt::WFlags f = 0);
+ virtual ~KviTalListBox() {};
+public:
+ KviTalListBoxItem * firstItem() const { return (KviTalListBoxItem *)Q3ListBox::firstItem(); };
+ KviTalListBoxItem * firstItem() const { return (KviTalListBoxItem *)Q3ListBox::firstItem(); };
+ KviTalListBoxItem * selectedItem() const { return (KviTalListBoxItem *)Q3ListBox::selectedItem(); };
+ KviTalListBoxItem * item(int iIndex) const { return (KviTalListBoxItem *)Q3ListBox::item(iIndex); };
+signals:
+ void highlighted(KviTalListBoxItem *);
+ void selected(KviTalListBoxItem *);
+ void selectionChanged(KviTalListBoxItem * item);
+ void currentChanged(KviTalListBoxItem * item);
+ void clicked(KviTalListBoxItem * item);
+ void clicked(KviTalListBoxItem * item,const QPoint & pnt);
+ void pressed(KviTalListBoxItem * item);
+ void pressed(KviTalListBoxItem * item,const QPoint & pnt);
+ void doubleClicked(KviTalListBoxItem * item);
+ void returnPressed(KviTalListBoxItem * item);
+ void rightButtonClicked(KviTalListBoxItem *, const QPoint &);
+ void rightButtonPressed(KviTalListBoxItem *, const QPoint &);
+ void mouseButtonPressed(int button,KviTalListBoxItem * item,const QPoint & pos);
+ void mouseButtonClicked(int button,KviTalListBoxItem * item,const QPoint & pos);
+ void contextMenuRequested(KviTalListBoxItem * item,const QPoint & pos);
+ void onItem(KviTalListBoxItem * i);
+protected slots:
+ void redirect_highlighted(Q3ListBoxItem *);
+ void redirect_selected(Q3ListBoxItem *);
+ void redirect_selectionChanged(Q3ListBoxItem * item);
+ void redirect_currentChanged(Q3ListBoxItem * item);
+ void redirect_clicked(Q3ListBoxItem * item);
+ void redirect_clicked(Q3ListBoxItem * item,const QPoint & pnt);
+ void redirect_pressed(Q3ListBoxItem * item);
+ void redirect_pressed(Q3ListBoxItem * item,const QPoint & pnt);
+ void redirect_doubleClicked(Q3ListBoxItem * item);
+ void redirect_returnPressed(Q3ListBoxItem *);
+ void redirect_rightButtonClicked(Q3ListBoxItem *, const QPoint &);
+ void redirect_rightButtonPressed(Q3ListBoxItem *, const QPoint &);
+ void redirect_mouseButtonPressed(int button,Q3ListBoxItem * item,const QPoint & pos);
+ void redirect_mouseButtonClicked(int button,Q3ListBoxItem * item,const QPoint & pos);
+ void redirect_contextMenuRequested(Q3ListBoxItem * item,const QPoint & pos);
+ void redirect_onItem(Q3ListBoxItem * i);
+};
+
+class KVILIB_API KviTalListBoxItem : public Q3ListBoxItem
+{
+public:
+ KviTalListBoxItem()
+ : Q3ListBoxItem() {};
+ KviTalListBoxItem(KviTalListBox * pParent)
+ : Q3ListBoxItem(pParent) {};
+ KviTalListBoxItem(KviTalListBox * pParent,KviTalListBoxItem * pAfter)
+ : Q3ListBoxItem(pParent,pAfter) {};
+ virtual ~KviTalListBoxItem() {};
+public:
+ KviTalListBoxItem * next() const { return (KviTalListBoxItem *)Q3ListBoxItem::next(); };
+ KviTalListBoxItem * prev() const { return (KviTalListBoxItem *)Q3ListBoxItem::prev(); };
+ KviTalListBox * listBox() const { return (KviTalListBox *)Q3ListBoxItem::listBox(); };
+};
+
+
+class KVILIB_API KviTalListBoxText : public KviTalListBoxItem
+{
+public:
+ KviTalListBoxText(KviTalListBox* listbox, const QString & text=QString());
+ KviTalListBoxText(const QString & text=QString());
+ KviTalListBoxText(KviTalListBox* listbox, const QString & text, KviTalListBoxItem *after);
+ ~KviTalListBoxText();
+
+ int height(const KviTalListBox *) const;
+ int width(const KviTalListBox *) const;
+
+ int rtti() const;
+ enum { RTTI = 1 };
+
+protected:
+ void paint(QPainter *);
+
+private:
+ Q_DISABLE_COPY(KviTalListBoxText)
+};
+
+
+class KVILIB_API KviTalListBoxPixmap : public KviTalListBoxItem
+{
+public:
+ KviTalListBoxPixmap(KviTalListBox* listbox, const QPixmap &);
+ KviTalListBoxPixmap(const QPixmap &);
+ KviTalListBoxPixmap(KviTalListBox* listbox, const QPixmap & pix, KviTalListBoxItem *after);
+ KviTalListBoxPixmap(KviTalListBox* listbox, const QPixmap &, const QString&);
+ KviTalListBoxPixmap(const QPixmap &, const QString&);
+ KviTalListBoxPixmap(KviTalListBox* listbox, const QPixmap & pix, const QString&, KviTalListBoxItem *after);
+ ~KviTalListBoxPixmap();
+
+ const QPixmap *pixmap() const { return &pm; }
+
+ int height(const KviTalListBox *) const;
+ int width(const KviTalListBox *) const;
+
+ int rtti() const;
+ enum { RTTI = 2 };
+
+protected:
+ void paint(QPainter *);
+
+private:
+ Q_DISABLE_COPY(KviTalListBoxPixmap)
+
+ QPixmap pm;
+};
+
+#endif // _KVI_TAL_LISTBOX_QT4_H_
diff --git a/src/kvilib/tal/kvi_tal_listview.cpp b/src/kvilib/tal/kvi_tal_listview.cpp
new file mode 100644
index 000000000..06937276e
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_listview.cpp
@@ -0,0 +1,1493 @@
+//=============================================================================
+//
+// File : kvi_tal_listview.cpp
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#define __KVILIB__
+#include "kvi_tal_listview.h"
+
+#include "kvi_ptrdict.h"
+
+
+#ifdef COMPILE_USE_QT4
+ #include <qpainter.h>
+ #include <qstyle.h>
+ #include <qheader.h>
+ #include <qapplication.h>
+
+ KviTalListView::KviTalListView(QWidget * pParent)
+ : Q3ListView(pParent)
+ {
+ connect(this,SIGNAL(selectionChanged(Q3ListViewItem *)),this,SLOT(redirect_selectionChanged(Q3ListViewItem *)));
+ connect(this,SIGNAL(currentChanged(Q3ListViewItem *)),this,SLOT(redirect_currentChanged(Q3ListViewItem *)));
+ connect(this,SIGNAL(clicked(Q3ListViewItem *)),this,SLOT(redirect_clicked(Q3ListViewItem *)));
+ connect(this,SIGNAL(clicked(Q3ListViewItem *,const QPoint &,int)),this,SLOT(redirect_clicked(Q3ListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(pressed(Q3ListViewItem *)),this,SLOT(redirect_pressed(Q3ListViewItem *)));
+ connect(this,SIGNAL(pressed(Q3ListViewItem *,const QPoint &,int)),this,SLOT(redirect_pressed(Q3ListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(doubleClicked(Q3ListViewItem *)),this,SLOT(redirect_doubleClicked(Q3ListViewItem *)));
+ connect(this,SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)),this,SLOT(redirect_doubleClicked(Q3ListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(returnPressed(Q3ListViewItem *)),this,SLOT(redirect_returnPressed(Q3ListViewItem *)));
+ connect(this,SIGNAL(spacePressed(Q3ListViewItem *)),this,SLOT(redirect_spacePressed(Q3ListViewItem *)));
+ connect(this,SIGNAL(rightButtonClicked(Q3ListViewItem *,const QPoint &,int)),this,SLOT(redirect_rightButtonClicked(Q3ListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(rightButtonPressed(Q3ListViewItem *,const QPoint &,int)),this,SLOT(redirect_rightButtonPressed(Q3ListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(mouseButtonClicked(int,Q3ListViewItem *,const QPoint &,int)),this,SLOT(redirect_mouseButtonClicked(int,Q3ListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(mouseButtonPressed(int,Q3ListViewItem *,const QPoint &,int)),this,SLOT(redirect_mouseButtonPressed(int,Q3ListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(contextMenuRequested(Q3ListViewItem *,const QPoint &,int)),this,SLOT(redirect_contextMenuRequested(Q3ListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(onItem(Q3ListViewItem *)),this,SLOT(redirect_onItem(Q3ListViewItem *)));
+ connect(this,SIGNAL(expanded(Q3ListViewItem *)),this,SLOT(redirect_expanded(Q3ListViewItem *)));
+ connect(this,SIGNAL(collapsed(Q3ListViewItem *)),this,SLOT(redirect_collapsed(Q3ListViewItem *)));
+ }
+
+ void KviTalListView::redirect_selectionChanged(Q3ListViewItem * pItem)
+ {
+ emit selectionChanged((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_currentChanged(Q3ListViewItem * pItem)
+ {
+ emit currentChanged((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_clicked(Q3ListViewItem * pItem)
+ {
+ emit clicked((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_clicked(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit clicked((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_pressed(Q3ListViewItem * pItem)
+ {
+ emit pressed((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_pressed(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit pressed((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_doubleClicked(Q3ListViewItem * pItem)
+ {
+ emit doubleClicked((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_doubleClicked(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit doubleClicked((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_returnPressed(Q3ListViewItem * pItem)
+ {
+ emit returnPressed((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_spacePressed(Q3ListViewItem * pItem)
+ {
+ emit spacePressed((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_rightButtonClicked(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit rightButtonClicked((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_rightButtonPressed(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit rightButtonPressed((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_mouseButtonClicked(int iButton,Q3ListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit mouseButtonClicked(iButton,(KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_mouseButtonPressed(int iButton,Q3ListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit mouseButtonPressed(iButton,(KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_contextMenuRequested(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit contextMenuRequested((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_onItem(Q3ListViewItem * pItem)
+ {
+ emit onItem((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_expanded(Q3ListViewItem * pItem)
+ {
+ emit expanded((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_collapsed(Q3ListViewItem * pItem)
+ {
+ emit collapsed((KviTalListViewItem *)pItem);
+ }
+
+
+ struct KviTalCheckListItemPrivate
+ {
+ KviTalCheckListItemPrivate():
+ exclusive(0),
+ currentState(KviTalCheckListItem::Off),
+ tristate(false) {}
+
+ KviTalCheckListItem *exclusive;
+ KviTalCheckListItem::ToggleState currentState;
+ QHash<KviTalCheckListItem *, KviTalCheckListItem::ToggleState> statesDict;
+ bool tristate;
+ };
+
+ KviTalCheckListItem::KviTalCheckListItem(KviTalCheckListItem *parent, const QString &text,
+ Type tt)
+ : KviTalListViewItem(parent, text, QString())
+ {
+ myType = tt;
+ init();
+ if (myType == RadioButton) {
+ if (parent->type() != RadioButtonController)
+ qWarning("KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a controller");
+ else
+ d->exclusive = parent;
+ }
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem(KviTalCheckListItem *parent, KviTalListViewItem *after,
+ const QString &text, Type tt)
+ : KviTalListViewItem(parent, after, text)
+ {
+ myType = tt;
+ init();
+ if (myType == RadioButton) {
+ if (parent->type() != RadioButtonController)
+ qWarning("KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a controller");
+ else
+ d->exclusive = parent;
+ }
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem(KviTalListViewItem *parent, const QString &text,
+ Type tt)
+ : KviTalListViewItem(parent, text, QString())
+ {
+ myType = tt;
+ if (myType == RadioButton) {
+ qWarning("KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a KviTalCheckListItem");
+ }
+ init();
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem(KviTalListViewItem *parent, KviTalListViewItem *after,
+ const QString &text, Type tt)
+ : KviTalListViewItem(parent, after, text)
+ {
+ myType = tt;
+ if (myType == RadioButton) {
+ qWarning("KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a KviTalCheckListItem");
+ }
+ init();
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem(KviTalListView *parent, const QString &text,
+ Type tt)
+ : KviTalListViewItem(parent, text)
+ {
+ myType = tt;
+ if (tt == RadioButton)
+ qWarning("KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a KviTalCheckListItem");
+ init();
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem(KviTalListView *parent, KviTalListViewItem *after,
+ const QString &text, Type tt)
+ : KviTalListViewItem(parent, after, text)
+ {
+ myType = tt;
+ if (tt == RadioButton)
+ qWarning("KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a KviTalCheckListItem");
+ init();
+ }
+
+ int KviTalCheckListItem::rtti() const
+ {
+ return RTTI;
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem(KviTalListView *parent, const QString &text,
+ const QPixmap & p)
+ : KviTalListViewItem(parent, text)
+ {
+ myType = RadioButtonController;
+ setPixmap(0, p);
+ init();
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem(KviTalListViewItem *parent, const QString &text,
+ const QPixmap & p)
+ : KviTalListViewItem(parent, text)
+ {
+ myType = RadioButtonController;
+ setPixmap(0, p);
+ init();
+ }
+
+ void KviTalCheckListItem::init()
+ {
+ d = new KviTalCheckListItemPrivate();
+ on = false; // ### remove on ver 4
+ // CheckBoxControllers by default have tristate set to true
+ if (myType == CheckBoxController)
+ setTristate(true);
+ }
+
+ KviTalCheckListItem::~KviTalCheckListItem()
+ {
+ if (myType == RadioButton
+ && d->exclusive && d->exclusive->d
+ && d->exclusive->d->exclusive == this)
+ d->exclusive->turnOffChild();
+ d->exclusive = 0; // so the children won't try to access us.
+ delete d;
+ d = 0;
+ }
+
+ void KviTalCheckListItem::setTristate(bool b)
+ {
+ if ((myType != CheckBoxController) && (myType != CheckBox)) {
+ qWarning("KviTalCheckListItem::setTristate(), has no effect on RadioButton "
+ "or RadioButtonController.");
+ return;
+ }
+ d->tristate = b;
+ }
+
+ bool KviTalCheckListItem::isTristate() const
+ {
+ return d->tristate;
+ }
+
+ KviTalCheckListItem::ToggleState KviTalCheckListItem::state() const
+ {
+ if (!isTristate() && internalState() == NoChange)
+ return Off;
+ else
+ return d->currentState;
+ }
+
+ KviTalCheckListItem::ToggleState KviTalCheckListItem::internalState() const
+ {
+ return d->currentState;
+ }
+
+ void KviTalCheckListItem::setState(ToggleState s)
+ {
+ if (myType == CheckBoxController && state() == NoChange)
+ updateStoredState(this);
+ setState(s, true, true);
+ }
+
+ void KviTalCheckListItem::setState(ToggleState s, bool update, bool store)
+ {
+
+ if (s == internalState())
+ return;
+
+ if (myType == CheckBox) {
+ setCurrentState(s);
+ stateChange(state());
+ if (update && parent() && parent()->rtti() == 1
+ && ((KviTalCheckListItem*)parent())->type() == CheckBoxController)
+ ((KviTalCheckListItem*)parent())->updateController(update, store);
+ } else if (myType == CheckBoxController) {
+ if (s == NoChange && childCount()) {
+ restoreState(this);
+ } else {
+ KviTalListViewItem *item = firstChild();
+ int childCount = 0;
+ while(item) {
+ if (item->rtti() == 1 &&
+ (((KviTalCheckListItem*)item)->type() == CheckBox ||
+ ((KviTalCheckListItem*)item)->type() == CheckBoxController)) {
+ KviTalCheckListItem *checkItem = (KviTalCheckListItem*)item;
+ checkItem->setState(s, false, false);
+ childCount++;
+ }
+ item = item->nextSibling();
+ }
+ if (update) {
+ if (childCount > 0) {
+ ToggleState oldState = internalState();
+ updateController(false, false);
+ if (oldState != internalState() &&
+ parent() && parent()->rtti() == 1 &&
+ ((KviTalCheckListItem*)parent())->type() == CheckBoxController)
+ ((KviTalCheckListItem*)parent())->updateController(update, store);
+
+ updateController(update, store);
+ } else {
+ // if there are no children we simply set the CheckBoxController and update its parent
+ setCurrentState(s);
+ stateChange(state());
+ if (parent() && parent()->rtti() == 1
+ && ((KviTalCheckListItem*)parent())->type() == CheckBoxController)
+ ((KviTalCheckListItem*)parent())->updateController(update, store);
+ }
+ } else {
+ setCurrentState(s);
+ stateChange(state());
+ }
+
+ }
+ } else if (myType == RadioButton) {
+ if (s == On) {
+ if (d->exclusive && d->exclusive->d->exclusive != this)
+ d->exclusive->turnOffChild();
+ setCurrentState(s);
+ if (d->exclusive)
+ d->exclusive->d->exclusive = this;
+ } else {
+ if (d->exclusive && d->exclusive->d->exclusive == this)
+ d->exclusive->d->exclusive = 0;
+ setCurrentState(Off);
+ }
+ stateChange(state());
+ }
+ repaint();
+ }
+
+ void KviTalCheckListItem::setCurrentState(ToggleState s)
+ {
+ ToggleState old = d->currentState;
+ d->currentState = s;
+ if (d->currentState == On)
+ on = true;
+ else
+ on = false;
+
+ #ifndef QT_NO_ACCESSIBILITY
+ if (old != d->currentState && listView())
+ QAccessible::updateAccessibility(listView()->viewport(), indexOfItem(this), QAccessible::StateChanged);
+ #else
+ Q_UNUSED(old);
+ #endif
+ }
+
+ void KviTalCheckListItem::setStoredState(ToggleState newState, KviTalCheckListItem *key)
+ {
+ if (myType == CheckBox || myType == CheckBoxController)
+ d->statesDict[key] = newState;
+ }
+
+ KviTalCheckListItem::ToggleState KviTalCheckListItem::storedState(KviTalCheckListItem *key) const
+ {
+ QHash<KviTalCheckListItem *, KviTalCheckListItem::ToggleState>::Iterator it = d->statesDict.find(key);
+ if (it != d->statesDict.end())
+ return it.value();
+ else
+ return Off;
+ }
+
+ void KviTalCheckListItem::turnOffChild()
+ {
+ if (myType == RadioButtonController && d->exclusive)
+ d->exclusive->setOn(false);
+ }
+
+ void KviTalCheckListItem::activate()
+ {
+ KviTalListView * lv = listView();
+
+ if (lv && !lv->isEnabled() || !isEnabled())
+ return;
+
+ QPoint pos;
+ int boxsize = lv->style()->pixelMetric(QStyle::PM_CheckListButtonSize, 0, lv);
+ if (activatedPos(pos)) {
+ bool parentControl = false;
+ if (parent() && parent()->rtti() == 1 &&
+ ((KviTalCheckListItem*) parent())->type() == RadioButtonController)
+ parentControl = true;
+
+ int x = parentControl ? 0 : 3;
+ int align = lv->columnAlignment(0);
+ int marg = lv->itemMargin();
+ int y = 0;
+
+ if (align & Qt::AlignVCenter)
+ y = ((height() - boxsize) / 2) + marg;
+ else
+ y = (lv->fontMetrics().height() + 2 + marg - boxsize) / 2;
+
+ QRect r(x, y, boxsize-3, boxsize-3);
+ // columns might have been swapped
+ r.moveBy(lv->header()->sectionPos(0), 0);
+ if (!r.contains(pos))
+ return;
+ }
+ if ((myType == CheckBox) || (myType == CheckBoxController)) {
+ lv->d->startEdit = FALSE;
+ switch (internalState()) {
+ case On:
+ setState(Off);
+ break;
+ case Off:
+ if (!isTristate() && myType == CheckBox) {
+ setState(On);
+ } else {
+ setState(NoChange);
+ if (myType == CheckBoxController && internalState() != NoChange)
+ setState(On);
+ }
+ break;
+ case NoChange:
+ setState(On);
+ break;
+ }
+ ignoreDoubleClick();
+ } else if (myType == RadioButton) {
+ setOn(true);
+ ignoreDoubleClick();
+ }
+ }
+
+ void KviTalCheckListItem::setOn(bool b )
+ {
+ if (b)
+ setState(On , true, true);
+ else
+ setState(Off , true, true);
+ }
+
+ void KviTalCheckListItem::stateChange(bool)
+ {
+ }
+
+ void KviTalCheckListItem::stateChange(ToggleState s)
+ {
+ stateChange(s == On);
+ }
+
+ void KviTalCheckListItem::restoreState(KviTalCheckListItem *key, int depth)
+ {
+ switch (type()) {
+ case CheckBox:
+ setCurrentState(storedState(key));
+ stateChange(state());
+ repaint();
+ break;
+ case CheckBoxController: {
+ KviTalListViewItem *item = firstChild();
+ int childCount = 0;
+ while (item) {
+ // recursively calling restoreState for children of type CheckBox and CheckBoxController
+ if (item->rtti() == 1 &&
+ (((KviTalCheckListItem*)item)->type() == CheckBox ||
+ ((KviTalCheckListItem*)item)->type() == CheckBoxController)) {
+ ((KviTalCheckListItem*)item)->restoreState(key , depth+1);
+ childCount++;
+ }
+ item = item->nextSibling();
+ }
+ if (childCount > 0) {
+ if (depth == 0)
+ updateController(true);
+ else
+ updateController(false);
+ } else {
+ // if there are no children we retrieve the CheckBoxController state directly.
+ setState(storedState(key), true, false);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ void KviTalCheckListItem::updateController(bool update , bool store)
+ {
+ if (myType != CheckBoxController)
+ return;
+
+ KviTalCheckListItem *controller = 0;
+ // checks if this CheckBoxController has another CheckBoxController as parent
+ if (parent() && parent()->rtti() == 1
+ && ((KviTalCheckListItem*)parent())->type() == CheckBoxController)
+ controller = (KviTalCheckListItem*)parent();
+
+ ToggleState theState = Off;
+ bool first = true;
+ KviTalListViewItem *item = firstChild();
+ while(item && theState != NoChange) {
+ if (item->rtti() == 1 &&
+ (((KviTalCheckListItem*)item)->type() == CheckBox ||
+ ((KviTalCheckListItem*)item)->type() == CheckBoxController)) {
+ KviTalCheckListItem *checkItem = (KviTalCheckListItem*)item;
+ if (first) {
+ theState = checkItem->internalState();
+ first = false;
+ } else {
+ if (checkItem->internalState() == NoChange ||
+ theState != checkItem->internalState())
+ theState = NoChange;
+ else
+ theState = checkItem->internalState();
+ }
+ }
+ item = item->nextSibling();
+ }
+ if (internalState() != theState) {
+ setCurrentState(theState);
+ if (store && (internalState() == On || internalState() == Off))
+ updateStoredState(this);
+ stateChange(state());
+ if (update && controller) {
+ controller->updateController(update, store);
+ }
+ repaint();
+ }
+ }
+
+ void KviTalCheckListItem::updateStoredState(KviTalCheckListItem *key)
+ {
+ if (myType != CheckBoxController)
+ return;
+
+ KviTalListViewItem *item = firstChild();
+ while(item) {
+ if (item->rtti() == 1) {
+ KviTalCheckListItem *checkItem = (KviTalCheckListItem*)item;
+ if (checkItem->type() == CheckBox)
+ checkItem->setStoredState(checkItem->internalState(), key);
+ else if (checkItem->type() == CheckBoxController)
+ checkItem->updateStoredState(key);
+ }
+ item = item->nextSibling();
+ }
+ // this state is only needed if the CheckBoxController has no CheckBox / CheckBoxController children.
+ setStoredState(internalState() , key);
+ }
+
+ void KviTalCheckListItem::setup()
+ {
+ KviTalListViewItem::setup();
+ int h = height();
+ KviTalListView *lv = listView();
+ if (lv)
+ h = qMax(lv->style()->pixelMetric(QStyle::PM_CheckListButtonSize, 0, lv),
+ h);
+ h = qMax(h, QApplication::globalStrut().height());
+ setHeight(h);
+ }
+
+ int KviTalCheckListItem::width(const QFontMetrics& fm, const KviTalListView* lv, int column) const
+ {
+ int r = KviTalListViewItem::width(fm, lv, column);
+ if (column == 0) {
+ r += lv->itemMargin();
+ if (myType == RadioButtonController && pixmap(0)) {
+ // r += 0;
+ } else {
+ r += lv->style()->pixelMetric(QStyle::PM_CheckListButtonSize, 0, lv) + 4;
+ }
+ }
+ return qMax(r, QApplication::globalStrut().width());
+ }
+
+ void KviTalCheckListItem::paintCell(QPainter * p, const QColorGroup & cg,
+ int column, int width, int align)
+ {
+ if (!p)
+ return;
+
+ KviTalListView *lv = listView();
+ if (!lv)
+ return;
+
+ const QPalette::ColorRole crole = lv->foregroundRole();
+ if (cg.brush(crole) != lv->palette().brush(crole))
+ p->fillRect(0, 0, width, height(), cg.brush(crole));
+ else
+ lv->paintEmptyArea(p, QRect(0, 0, width, height()));
+
+ if (column != 0) {
+ // The rest is text, or for subclasses to change.
+ KviTalListViewItem::paintCell(p, cg, column, width, align);
+ return;
+ }
+
+ bool parentControl = false;
+ if (parent() && parent()->rtti() == 1 &&
+ ((KviTalCheckListItem*) parent())->type() == RadioButtonController)
+ parentControl = true;
+
+ QFontMetrics fm(lv->fontMetrics());
+ int boxsize = lv->style()->pixelMetric(myType == RadioButtonController ? QStyle::PM_CheckListControllerSize :
+ QStyle::PM_CheckListButtonSize, 0, lv);
+ int marg = lv->itemMargin();
+ int r = marg;
+
+ // Draw controller / checkbox / radiobutton ---------------------
+ QStyle::State styleflags = QStyle::State_None;
+ if (internalState() == On) {
+ styleflags |= QStyle::State_On;
+ } else if (internalState() == NoChange) {
+ if (myType == CheckBoxController && !isTristate())
+ styleflags |= QStyle::State_Off;
+ else
+ styleflags |= QStyle::State_NoChange;
+ } else {
+ styleflags |= QStyle::State_Off;
+ }
+ if (isSelected())
+ styleflags |= QStyle::State_Selected;
+ if (isEnabled() && lv->isEnabled())
+ styleflags |= QStyle::State_Enabled;
+ if (lv->window()->isActiveWindow())
+ styleflags |= QStyle::State_Active;
+
+ if (myType == RadioButtonController) {
+ int x = 0;
+ if(!parentControl)
+ x += 3;
+ if (!pixmap(0)) {
+ QStyleOptionKviTalListView opt = getStyleOption(lv, this);
+ opt.rect.setRect(x, 0, boxsize, fm.height() + 2 + marg);
+ opt.palette = cg;
+ opt.state = styleflags;
+ lv->style()->drawPrimitive(QStyle::PE_Q3CheckListController, &opt, p, lv);
+ r += boxsize + 4;
+ }
+ } else {
+ Q_ASSERT(lv); //###
+ int x = 0;
+ int y = 0;
+ if (!parentControl)
+ x += 3;
+ if (align & Qt::AlignVCenter)
+ y = ((height() - boxsize) / 2) + marg;
+ else
+ y = (fm.height() + 2 + marg - boxsize) / 2;
+
+ QStyleOptionKviTalListView opt = getStyleOption(lv, this);
+ opt.rect.setRect(x, y, boxsize, fm.height() + 2 + marg);
+ opt.palette = cg;
+ opt.state = styleflags;
+ lv->style()->drawPrimitive((myType == CheckBox || myType == CheckBoxController)
+ ? QStyle::PE_Q3CheckListIndicator
+ : QStyle::PE_Q3CheckListExclusiveIndicator, &opt, p, lv);
+ r += boxsize + 4;
+ }
+
+ // Draw text ----------------------------------------------------
+ p->translate(r, 0);
+ p->setPen(QPen(cg.text()));
+ KviTalListViewItem::paintCell(p, cg, column, width - r, align);
+ }
+
+ void KviTalCheckListItem::paintFocus(QPainter *p, const QColorGroup & cg,
+ const QRect & r)
+ {
+ bool intersect = true;
+ KviTalListView *lv = listView();
+ if (lv && lv->header()->mapToActual(0) != 0) {
+ int xdepth = lv->treeStepSize() * (depth() + (lv->rootIsDecorated() ? 1 : 0)) + lv->itemMargin();
+ int p = lv->header()->cellPos(lv->header()->mapToActual(0));
+ xdepth += p;
+ intersect = r.intersects(QRect(p, r.y(), xdepth - p + 1, r.height()));
+ }
+ bool parentControl = false;
+ if (parent() && parent()->rtti() == 1 &&
+ ((KviTalCheckListItem*) parent())->type() == RadioButtonController)
+ parentControl = true;
+ if (myType != RadioButtonController && intersect &&
+ (lv->rootIsDecorated() || myType == RadioButton ||
+ (myType == CheckBox && parentControl))) {
+ QRect rect;
+ int boxsize = lv->style()->pixelMetric(QStyle::PM_CheckListButtonSize, 0, lv);
+ if (lv->columnAlignment(0) == Qt::AlignCenter) {
+ QFontMetrics fm(lv->font());
+ int bx = (lv->columnWidth(0) - (boxsize + fm.width(text())))/2 + boxsize;
+ if (bx < 0) bx = 0;
+ rect.setRect(r.x() + bx + 5, r.y(), r.width() - bx - 5,
+ r.height());
+ } else
+ rect.setRect(r.x() + boxsize + 5, r.y(), r.width() - boxsize - 5,
+ r.height());
+ KviTalListViewItem::paintFocus(p, cg, rect);
+ } else {
+ KviTalListViewItem::paintFocus(p, cg, r);
+ }
+ }
+
+
+ #include "kvi_tal_listview_qt4.moc"
+#else
+ #include <qpainter.h>
+ #include <qstyle.h>
+ #include <qheader.h>
+ #include <qapplication.h>
+
+ KviTalListView::KviTalListView(QWidget * pParent)
+ : QListView(pParent)
+ {
+ connect(this,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(redirect_selectionChanged(QListViewItem *)));
+ connect(this,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(redirect_currentChanged(QListViewItem *)));
+ connect(this,SIGNAL(clicked(QListViewItem *)),this,SLOT(redirect_clicked(QListViewItem *)));
+ connect(this,SIGNAL(clicked(QListViewItem *,const QPoint &,int)),this,SLOT(redirect_clicked(QListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(pressed(QListViewItem *)),this,SLOT(redirect_pressed(QListViewItem *)));
+ connect(this,SIGNAL(pressed(QListViewItem *,const QPoint &,int)),this,SLOT(redirect_pressed(QListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(doubleClicked(QListViewItem *)),this,SLOT(redirect_doubleClicked(QListViewItem *)));
+ connect(this,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),this,SLOT(redirect_doubleClicked(QListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(returnPressed(QListViewItem *)),this,SLOT(redirect_returnPressed(QListViewItem *)));
+ connect(this,SIGNAL(spacePressed(QListViewItem *)),this,SLOT(redirect_spacePressed(QListViewItem *)));
+ connect(this,SIGNAL(rightButtonClicked(QListViewItem *,const QPoint &,int)),this,SLOT(redirect_rightButtonClicked(QListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),this,SLOT(redirect_rightButtonPressed(QListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(mouseButtonClicked(int,QListViewItem *,const QPoint &,int)),this,SLOT(redirect_mouseButtonClicked(int,QListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(mouseButtonPressed(int,QListViewItem *,const QPoint &,int)),this,SLOT(redirect_mouseButtonPressed(int,QListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(contextMenuRequested(QListViewItem *,const QPoint &,int)),this,SLOT(redirect_contextMenuRequested(QListViewItem *,const QPoint &,int)));
+ connect(this,SIGNAL(onItem(QListViewItem *)),this,SLOT(redirect_onItem(QListViewItem *)));
+ connect(this,SIGNAL(expanded(QListViewItem *)),this,SLOT(redirect_expanded(QListViewItem *)));
+ connect(this,SIGNAL(collapsed(QListViewItem *)),this,SLOT(redirect_collapsed(QListViewItem *)));
+ }
+
+ void KviTalListView::redirect_selectionChanged(QListViewItem * pItem)
+ {
+ emit selectionChanged((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_currentChanged(QListViewItem * pItem)
+ {
+ emit currentChanged((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_clicked(QListViewItem * pItem)
+ {
+ emit clicked((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_clicked(QListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit clicked((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_pressed(QListViewItem * pItem)
+ {
+ emit pressed((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_pressed(QListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit pressed((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_doubleClicked(QListViewItem * pItem)
+ {
+ emit doubleClicked((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_doubleClicked(QListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit doubleClicked((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_returnPressed(QListViewItem * pItem)
+ {
+ emit returnPressed((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_spacePressed(QListViewItem * pItem)
+ {
+ emit spacePressed((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_rightButtonClicked(QListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit rightButtonClicked((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_rightButtonPressed(QListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit rightButtonPressed((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_mouseButtonClicked(int iButton,QListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit mouseButtonClicked(iButton,(KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_mouseButtonPressed(int iButton,QListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit mouseButtonPressed(iButton,(KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_contextMenuRequested(QListViewItem * pItem,const QPoint &pnt,int uColumn)
+ {
+ emit contextMenuRequested((KviTalListViewItem *)pItem,pnt,uColumn);
+ }
+
+ void KviTalListView::redirect_onItem(QListViewItem * pItem)
+ {
+ emit onItem((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_expanded(QListViewItem * pItem)
+ {
+ emit expanded((KviTalListViewItem *)pItem);
+ }
+
+ void KviTalListView::redirect_collapsed(QListViewItem * pItem)
+ {
+ emit collapsed((KviTalListViewItem *)pItem);
+ }
+
+ struct KviTalCheckListItemPrivate
+ {
+ KviTalCheckListItemPrivate():
+ exclusive( 0 ),
+ currentState( KviTalCheckListItem::Off ),
+ statesDict( 0 ),
+ tristate( FALSE ) {}
+
+ KviTalCheckListItem *exclusive;
+ KviTalCheckListItem::ToggleState currentState;
+ KviPtrDict<KviTalCheckListItem::ToggleState> *statesDict;
+ bool tristate;
+ };
+
+ // ### obscenity is warranted.
+
+ KviTalCheckListItem::KviTalCheckListItem( KviTalCheckListItem *parent, const QString &text,
+ Type tt )
+ : KviTalListViewItem( parent, text, QString::null )
+ {
+ myType = tt;
+ init();
+ if ( myType == RadioButton ) {
+ if ( parent->type() != RadioButtonController )
+ qWarning( "KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a controller" );
+ else
+ d->exclusive = parent;
+ }
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem( KviTalCheckListItem *parent, KviTalListViewItem *after,
+ const QString &text, Type tt )
+ : KviTalListViewItem( parent, after, text )
+ {
+ myType = tt;
+ init();
+ if ( myType == RadioButton ) {
+ if ( parent->type() != RadioButtonController )
+ qWarning( "KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a controller" );
+ else
+ d->exclusive = parent;
+ }
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem( KviTalListViewItem *parent, const QString &text,
+ Type tt )
+ : KviTalListViewItem( parent, text, QString::null )
+ {
+ myType = tt;
+ if ( myType == RadioButton ) {
+ qWarning( "KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a KviTalCheckListItem" );
+ }
+ init();
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem( KviTalListViewItem *parent, KviTalListViewItem *after,
+ const QString &text, Type tt )
+ : KviTalListViewItem( parent, after, text )
+ {
+ myType = tt;
+ if ( myType == RadioButton ) {
+ qWarning( "KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a KviTalCheckListItem" );
+ }
+ init();
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem( KviTalListView *parent, const QString &text,
+ Type tt )
+ : KviTalListViewItem( parent, text )
+ {
+ myType = tt;
+ if ( tt == RadioButton )
+ qWarning( "KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a KviTalCheckListItem" );
+ init();
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem( KviTalListView *parent, KviTalListViewItem *after,
+ const QString &text, Type tt )
+ : KviTalListViewItem( parent, after, text )
+ {
+ myType = tt;
+ if ( tt == RadioButton )
+ qWarning( "KviTalCheckListItem::KviTalCheckListItem(), radio button must be "
+ "child of a KviTalCheckListItem" );
+ init();
+ }
+
+
+ int KviTalCheckListItem::RTTI = 1;
+
+ int KviTalCheckListItem::rtti() const
+ {
+ return RTTI;
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem( KviTalListView *parent, const QString &text,
+ const QPixmap & p )
+ : KviTalListViewItem( parent, text )
+ {
+ myType = RadioButtonController;
+ setPixmap( 0, p );
+ init();
+ }
+
+ KviTalCheckListItem::KviTalCheckListItem( KviTalListViewItem *parent, const QString &text,
+ const QPixmap & p )
+ : KviTalListViewItem( parent, text )
+ {
+ myType = RadioButtonController;
+ setPixmap( 0, p );
+ init();
+ }
+
+ void KviTalCheckListItem::init()
+ {
+ d = new KviTalCheckListItemPrivate();
+ on = FALSE; // ### remove on ver 4
+ if ( myType == CheckBoxController || myType == CheckBox ) {
+ d->statesDict = new KviPtrDict<ToggleState>(101);
+ d->statesDict->setAutoDelete( TRUE );
+ }
+ // CheckBoxControllers by default have tristate set to TRUE
+ if ( myType == CheckBoxController )
+ setTristate( TRUE );
+ }
+
+ KviTalCheckListItem::~KviTalCheckListItem()
+ {
+ if ( myType == RadioButton
+ && d->exclusive && d->exclusive->d
+ && d->exclusive->d->exclusive == this )
+ d->exclusive->turnOffChild();
+ d->exclusive = 0; // so the children won't try to access us.
+ if ( d->statesDict )
+ delete d->statesDict;
+ delete d;
+ d = 0;
+ }
+
+ void KviTalCheckListItem::setTristate( bool b )
+ {
+ if ( ( myType != CheckBoxController ) && ( myType != CheckBox ) ) {
+ qWarning( "KviTalCheckListItem::setTristate(), has no effect on RadioButton "
+ "or RadioButtonController." );
+ return;
+ }
+ d->tristate = b;
+ }
+
+ bool KviTalCheckListItem::isTristate() const
+ {
+ return d->tristate;
+ }
+
+ KviTalCheckListItem::ToggleState KviTalCheckListItem::state() const
+ {
+ if ( !isTristate() && internalState() == NoChange )
+ return Off;
+ else
+ return d->currentState;
+ }
+
+ KviTalCheckListItem::ToggleState KviTalCheckListItem::internalState() const
+ {
+ return d->currentState;
+ }
+
+ void KviTalCheckListItem::setState( ToggleState s )
+ {
+ if ( myType == CheckBoxController && state() == NoChange )
+ updateStoredState( (void*) this );
+ setState( s, TRUE, TRUE );
+ }
+
+ void KviTalCheckListItem::setState( ToggleState s, bool update, bool store)
+ {
+
+ if ( s == internalState() )
+ return;
+
+ if ( myType == CheckBox ) {
+ setCurrentState( s );
+ stateChange( state() );
+ if ( update && parent() && parent()->rtti() == 1
+ && ((KviTalCheckListItem*)parent())->type() == CheckBoxController )
+ ((KviTalCheckListItem*)parent())->updateController( update, store );
+ } else if ( myType == CheckBoxController ) {
+ if ( s == NoChange && childCount()) {
+ restoreState( (void*) this );
+ } else {
+ KviTalListViewItem *item = firstChild();
+ int childCount = 0;
+ while( item ) {
+ if ( item->rtti() == 1 &&
+ ( ((KviTalCheckListItem*)item)->type() == CheckBox ||
+ ((KviTalCheckListItem*)item)->type() == CheckBoxController ) ) {
+ KviTalCheckListItem *checkItem = (KviTalCheckListItem*)item;
+ checkItem->setState( s, FALSE, FALSE );
+ childCount++;
+ }
+ item = item->nextSibling();
+ }
+ if ( update ) {
+ if ( childCount > 0 ) {
+ ToggleState oldState = internalState();
+ updateController( FALSE, FALSE );
+ if ( oldState != internalState() &&
+ parent() && parent()->rtti() == 1 &&
+ ((KviTalCheckListItem*)parent())->type() == CheckBoxController )
+ ((KviTalCheckListItem*)parent())->updateController( update, store );
+
+ updateController( update, store );
+ } else {
+ // if there are no children we simply set the CheckBoxController and update its parent
+ setCurrentState( s );
+ stateChange( state() );
+ if ( parent() && parent()->rtti() == 1
+ && ((KviTalCheckListItem*)parent())->type() == CheckBoxController )
+ ((KviTalCheckListItem*)parent())->updateController( update, store );
+ }
+ } else {
+ setCurrentState( s );
+ stateChange( state() );
+ }
+
+ }
+ } else if ( myType == RadioButton ) {
+ if ( s == On ) {
+ if ( d->exclusive && d->exclusive->d->exclusive != this )
+ d->exclusive->turnOffChild();
+ setCurrentState( s );
+ if ( d->exclusive )
+ d->exclusive->d->exclusive = this;
+ } else {
+ if ( d->exclusive && d->exclusive->d->exclusive == this )
+ d->exclusive->d->exclusive = 0;
+ setCurrentState( Off );
+ }
+ stateChange( state() );
+ }
+ repaint();
+ }
+
+ void KviTalCheckListItem::setCurrentState( ToggleState s )
+ {
+ ToggleState old = d->currentState;
+ d->currentState = s;
+ if (d->currentState == On)
+ on = TRUE;
+ else
+ on = FALSE;
+
+ #if defined(QT_ACCESSIBILITY_SUPPORT)
+ if ( old != d->currentState && listView() )
+ QAccessible::updateAccessibility( listView()->viewport(), indexOfItem( this ), QAccessible::StateChanged );
+ #else
+ Q_UNUSED( old );
+ #endif
+ }
+
+ void KviTalCheckListItem::setStoredState( ToggleState newState, void *key )
+ {
+ if ( myType == CheckBox || myType == CheckBoxController )
+ d->statesDict->replace( key, new ToggleState(newState) );
+ }
+
+ KviTalCheckListItem::ToggleState KviTalCheckListItem::storedState( void *key ) const
+ {
+ if ( !d->statesDict )
+ return Off;
+
+ ToggleState *foundState = d->statesDict->find( key );
+ if ( foundState )
+ return ToggleState( *foundState );
+ else
+ return Off;
+ }
+
+ void KviTalCheckListItem::turnOffChild()
+ {
+ if ( myType == RadioButtonController && d->exclusive )
+ d->exclusive->setOn( FALSE );
+ }
+
+ void KviTalCheckListItem::activate()
+ {
+ KviTalListView * lv = listView();
+
+ if ( lv && !lv->isEnabled() || !isEnabled() )
+ return;
+
+ QPoint pos;
+ int boxsize = lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv);
+ if ( activatedPos( pos ) ) {
+ bool parentControl = FALSE;
+ if ( parent() && parent()->rtti() == 1 &&
+ ((KviTalCheckListItem*) parent())->type() == RadioButtonController )
+ parentControl = TRUE;
+
+ int x = parentControl ? 0 : 3;
+ int align = lv->columnAlignment( 0 );
+ int marg = lv->itemMargin();
+ int y = 0;
+
+ if ( align & AlignVCenter )
+ y = ( ( height() - boxsize ) / 2 ) + marg;
+ else
+ y = (lv->fontMetrics().height() + 2 + marg - boxsize) / 2;
+
+ QRect r( x, y, boxsize-3, boxsize-3 );
+ // columns might have been swapped
+ r.moveBy( lv->header()->sectionPos( 0 ), 0 );
+ if ( !r.contains( pos ) )
+ return;
+ }
+ if ( ( myType == CheckBox ) || ( myType == CheckBoxController) ) {
+ switch ( internalState() ) {
+ case On:
+ setState( Off );
+ break;
+ case Off:
+ if ( !isTristate() && myType == CheckBox ) {
+ setState( On );
+ } else {
+ setState( NoChange );
+ if ( myType == CheckBoxController && internalState() != NoChange )
+ setState( On );
+ }
+ break;
+ case NoChange:
+ setState( On );
+ break;
+ }
+ ignoreDoubleClick();
+ } else if ( myType == RadioButton ) {
+ setOn( TRUE );
+ ignoreDoubleClick();
+ }
+ }
+
+ void KviTalCheckListItem::setOn( bool b )
+ {
+ if ( b )
+ setState( On , TRUE, TRUE );
+ else
+ setState( Off , TRUE, TRUE );
+ }
+
+ void KviTalCheckListItem::stateChange( bool )
+ {
+ }
+
+ void KviTalCheckListItem::stateChange( ToggleState s )
+ {
+ stateChange( s == On );
+ }
+
+ void KviTalCheckListItem::restoreState( void *key, int depth )
+ {
+ switch ( type() ) {
+ case CheckBox:
+ setCurrentState( storedState( key ) );
+ stateChange( state() );
+ repaint();
+ break;
+ case CheckBoxController: {
+ KviTalListViewItem *item = firstChild();
+ int childCount = 0;
+ while ( item ) {
+ // recursively calling restoreState for children of type CheckBox and CheckBoxController
+ if ( item->rtti() == 1 &&
+ ( ((KviTalCheckListItem*)item)->type() == CheckBox ||
+ ((KviTalCheckListItem*)item)->type() == CheckBoxController ) ) {
+ ((KviTalCheckListItem*)item)->restoreState( key , depth+1 );
+ childCount++;
+ }
+ item = item->nextSibling();
+ }
+ if ( childCount > 0 ) {
+ if ( depth == 0 )
+ updateController( TRUE );
+ else
+ updateController( FALSE );
+ } else {
+ // if there are no children we retrieve the CheckBoxController state directly.
+ setState( storedState( key ), TRUE, FALSE );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ void KviTalCheckListItem::updateController( bool update , bool store )
+ {
+ if ( myType != CheckBoxController )
+ return;
+
+ KviTalCheckListItem *controller = 0;
+ // checks if this CheckBoxController has another CheckBoxController as parent
+ if ( parent() && parent()->rtti() == 1
+ && ((KviTalCheckListItem*)parent())->type() == CheckBoxController )
+ controller = (KviTalCheckListItem*)parent();
+
+ ToggleState theState = Off;
+ bool first = TRUE;
+ KviTalListViewItem *item = firstChild();
+ while( item && theState != NoChange ) {
+ if ( item->rtti() == 1 &&
+ ( ((KviTalCheckListItem*)item)->type() == CheckBox ||
+ ((KviTalCheckListItem*)item)->type() == CheckBoxController ) ) {
+ KviTalCheckListItem *checkItem = (KviTalCheckListItem*)item;
+ if ( first ) {
+ theState = checkItem->internalState();
+ first = FALSE;
+ } else {
+ if ( checkItem->internalState() == NoChange ||
+ theState != checkItem->internalState() )
+ theState = NoChange;
+ else
+ theState = checkItem->internalState();
+ }
+ }
+ item = item->nextSibling();
+ }
+ if ( internalState() != theState ) {
+ setCurrentState( theState );
+ if ( store && ( internalState() == On || internalState() == Off ) )
+ updateStoredState( (void*) this );
+ stateChange( state() );
+ if ( update && controller ) {
+ controller->updateController( update, store );
+ }
+ repaint();
+ }
+ }
+
+ void KviTalCheckListItem::updateStoredState( void *key )
+ {
+ if ( myType != CheckBoxController )
+ return;
+
+ KviTalListViewItem *item = firstChild();
+ while( item ) {
+ if ( item->rtti() == 1 ) {
+ KviTalCheckListItem *checkItem = (KviTalCheckListItem*)item;
+ if ( checkItem->type() == CheckBox )
+ checkItem->setStoredState( checkItem->internalState(), key );
+ else if (checkItem->type() == CheckBoxController )
+ checkItem->updateStoredState( key );
+ }
+ item = item->nextSibling();
+ }
+ // this state is only needed if the CheckBoxController has no CheckBox / CheckBoxController children.
+ setStoredState( internalState() , key );
+ }
+
+ void KviTalCheckListItem::setup()
+ {
+ KviTalListViewItem::setup();
+ int h = height();
+ KviTalListView *lv = listView();
+ if ( lv )
+ h = QMAX( lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv),
+ h );
+ h = QMAX( h, QApplication::globalStrut().height() );
+ setHeight( h );
+ }
+
+ int KviTalCheckListItem::width( const QFontMetrics& fm, const KviTalListView* lv, int column) const
+ {
+ int r = KviTalListViewItem::width( fm, lv, column );
+ if ( column == 0 ) {
+ r += lv->itemMargin();
+ if ( myType == RadioButtonController && pixmap( 0 ) ) {
+ // r += 0;
+ } else {
+ r += lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv) + 4;
+ }
+ }
+ return QMAX( r, QApplication::globalStrut().width() );
+ }
+
+ void KviTalCheckListItem::paintCell( QPainter * p, const QColorGroup & cg,
+ int column, int width, int align )
+ {
+ if ( !p )
+ return;
+
+ KviTalListView *lv = listView();
+ if ( !lv )
+ return;
+
+ const BackgroundMode bgmode = lv->viewport()->backgroundMode();
+ const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode( bgmode );
+ if ( cg.brush( crole ) != lv->colorGroup().brush( crole ) )
+ p->fillRect( 0, 0, width, height(), cg.brush( crole ) );
+ else
+ lv->paintEmptyArea( p, QRect( 0, 0, width, height() ) );
+
+ if ( column != 0 ) {
+ // The rest is text, or for subclasses to change.
+ KviTalListViewItem::paintCell( p, cg, column, width, align );
+ return;
+ }
+
+ bool parentControl = FALSE;
+ if ( parent() && parent()->rtti() == 1 &&
+ ((KviTalCheckListItem*) parent())->type() == RadioButtonController )
+ parentControl = TRUE;
+
+ QFontMetrics fm( lv->fontMetrics() );
+ int boxsize = lv->style().pixelMetric( myType == RadioButtonController ? QStyle::PM_CheckListControllerSize :
+ QStyle::PM_CheckListButtonSize, lv);
+ int marg = lv->itemMargin();
+ int r = marg;
+
+ // Draw controller / checkbox / radiobutton ---------------------
+ int styleflags = QStyle::Style_Default;
+ if ( internalState() == On ) {
+ styleflags |= QStyle::Style_On;
+ } else if ( internalState() == NoChange ) {
+ if ( myType == CheckBoxController && !isTristate() )
+ styleflags |= QStyle::Style_Off;
+ else
+ styleflags |= QStyle::Style_NoChange;
+ } else {
+ styleflags |= QStyle::Style_Off;
+ }
+ if ( isSelected() )
+ styleflags |= QStyle::Style_Selected;
+ if ( isEnabled() && lv->isEnabled() )
+ styleflags |= QStyle::Style_Enabled;
+
+ if ( myType == RadioButtonController ) {
+ int x = 0;
+ if(!parentControl)
+ x += 3;
+ if ( !pixmap( 0 ) ) {
+ lv->style().drawPrimitive(QStyle::PE_CheckListController, p,
+ QRect(x, 0, boxsize,
+ fm.height() + 2 + marg),
+ cg, styleflags, QStyleOption(this));
+ r += boxsize + 4;
+ }
+ } else {
+ Q_ASSERT( lv ); //###
+ int x = 0;
+ int y = 0;
+ if ( !parentControl )
+ x += 3;
+ if ( align & AlignVCenter )
+ y = ( ( height() - boxsize ) / 2 ) + marg;
+ else
+ y = (fm.height() + 2 + marg - boxsize) / 2;
+
+ if ( ( myType == CheckBox ) || ( myType == CheckBoxController ) ) {
+ lv->style().drawPrimitive(QStyle::PE_CheckListIndicator, p,
+ QRect(x, y, boxsize,
+ fm.height() + 2 + marg),
+ cg, styleflags, QStyleOption(this));
+ } else { //radio button look
+ lv->style().drawPrimitive(QStyle::PE_CheckListExclusiveIndicator,
+ p, QRect(x, y, boxsize,
+ fm.height() + 2 + marg),
+ cg, styleflags, QStyleOption(this));
+ }
+ r += boxsize + 4;
+ }
+
+ // Draw text ----------------------------------------------------
+ p->translate( r, 0 );
+ p->setPen( QPen( cg.text() ) );
+ KviTalListViewItem::paintCell( p, cg, column, width - r, align );
+ }
+
+ void KviTalCheckListItem::paintFocus( QPainter *p, const QColorGroup & cg,const QRect & r )
+ {
+ bool intersect = TRUE;
+ KviTalListView *lv = listView();
+ if ( lv && lv->header()->mapToActual( 0 ) != 0 ) {
+ int xdepth = lv->treeStepSize() * ( depth() + ( lv->rootIsDecorated() ? 1 : 0) ) + lv->itemMargin();
+ int p = lv->header()->cellPos( lv->header()->mapToActual( 0 ) );
+ xdepth += p;
+ intersect = r.intersects( QRect( p, r.y(), xdepth - p + 1, r.height() ) );
+ }
+ bool parentControl = FALSE;
+ if ( parent() && parent()->rtti() == 1 &&
+ ((KviTalCheckListItem*) parent())->type() == RadioButtonController )
+ parentControl = TRUE;
+ if ( myType != RadioButtonController && intersect &&
+ (lv->rootIsDecorated() || myType == RadioButton ||
+ (myType == CheckBox && parentControl) ) ) {
+ QRect rect;
+ int boxsize = lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv);
+ if ( lv->columnAlignment(0) == AlignCenter ) {
+ QFontMetrics fm( lv->font() );
+ int bx = (lv->columnWidth(0) - (boxsize + fm.width(text())))/2 + boxsize;
+ if ( bx < 0 ) bx = 0;
+ rect.setRect( r.x() + bx + 5, r.y(), r.width() - bx - 5,
+ r.height() );
+ } else
+ rect.setRect( r.x() + boxsize + 5, r.y(), r.width() - boxsize - 5,
+ r.height() );
+ KviTalListViewItem::paintFocus(p, cg, rect);
+ } else {
+ KviTalListViewItem::paintFocus(p, cg, r);
+ }
+ }
+
+ #include "kvi_tal_listview_qt3.moc"
+#endif
+
+
+
diff --git a/src/kvilib/tal/kvi_tal_listview.h b/src/kvilib/tal/kvi_tal_listview.h
new file mode 100644
index 000000000..5fe825495
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_listview.h
@@ -0,0 +1,51 @@
+#ifndef _KVI_TAL_LISTVIEW_H_
+#define _KVI_TAL_LISTVIEW_H_
+
+//=============================================================================
+//
+// File : kvi_tal_listview.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+
+//
+// This is the only reasonable CROSS-QT3-QT4-COMPATIBLE implementation
+// of QListView I've been able to find.
+// Note that using macros for the items will NOT work since moc
+// doesn't expand them. Note also that KviTalCheckListItem must
+// be fully reimplemented and not be inherited from QCheckListItem
+// to build up a consistent item object hierarchy. To complete
+// the obscenity, we need TWO COMPLETE implementations: one for Qt3
+// and one for Qt4... bleah :D
+//
+// The code for KviTalCheckListItem is adapted from qlistview.h/cpp
+// present in qt 3.3.6 AND in qt 4.1.2.
+//
+
+#include "kvi_settings.h"
+
+#ifdef COMPILE_USE_QT4
+ #include "kvi_tal_listview_qt4.h"
+#else
+ #include "kvi_tal_listview_qt3.h"
+#endif
+
+#endif // _KVI_TAL_LISTVIEW_H_
diff --git a/src/kvilib/tal/kvi_tal_listview_qt3.h b/src/kvilib/tal/kvi_tal_listview_qt3.h
new file mode 100644
index 000000000..955b1c326
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_listview_qt3.h
@@ -0,0 +1,190 @@
+#ifndef _KVI_TAL_LISTVIEW_QT3_H_
+#define _KVI_TAL_LISTVIEW_QT3_H_
+
+//=============================================================================
+//
+// File : kvi_tal_listview_qt3.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+
+#include "kvi_qstring.h"
+
+#include <qlistview.h>
+
+class KviTalListViewItem;
+
+class KVILIB_API KviTalListView : public QListView
+{
+ friend class KviTalCheckListItem;
+ Q_OBJECT
+public:
+ KviTalListView(QWidget * pParent);
+ virtual ~KviTalListView() {};
+public:
+ // Shadow the internal Qt methods
+ KviTalListViewItem * firstChild() const { return (KviTalListViewItem *)QListView::firstChild(); };
+ KviTalListViewItem * lastItem() const { return (KviTalListViewItem *)QListView::lastItem(); };
+ KviTalListViewItem * selectedItem() const { return (KviTalListViewItem *)QListView::selectedItem(); };
+ KviTalListViewItem * currentItem() const { return (KviTalListViewItem *)QListView::currentItem(); };
+ KviTalListViewItem * itemAt(const QPoint &pnt) const { return (KviTalListViewItem *)QListView::itemAt(pnt); };
+signals:
+ void selectionChanged(KviTalListViewItem * pItem);
+ void currentChanged(KviTalListViewItem * pItem);
+ void clicked(KviTalListViewItem * pItem);
+ void clicked(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void pressed(KviTalListViewItem * pItem);
+ void pressed(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void doubleClicked(KviTalListViewItem * pItem);
+ void doubleClicked(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void returnPressed(KviTalListViewItem * pItem);
+ void spacePressed(KviTalListViewItem * pItem);
+ void rightButtonClicked(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void rightButtonPressed(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void mouseButtonClicked(int iButton,KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void mouseButtonPressed(int iButton,KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void contextMenuRequested(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void onItem(KviTalListViewItem * pItem);
+ void expanded(KviTalListViewItem * pItem);
+ void collapsed(KviTalListViewItem * pItem);
+protected slots:
+ void redirect_selectionChanged(QListViewItem * pItem);
+ void redirect_currentChanged(QListViewItem * pItem);
+ void redirect_clicked(QListViewItem * pItem);
+ void redirect_clicked(QListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_pressed(QListViewItem * pItem);
+ void redirect_pressed(QListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_doubleClicked(QListViewItem * pItem);
+ void redirect_doubleClicked(QListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_returnPressed(QListViewItem * pItem);
+ void redirect_spacePressed(QListViewItem * pItem);
+ void redirect_rightButtonClicked(QListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_rightButtonPressed(QListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_mouseButtonClicked(int iButton,QListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_mouseButtonPressed(int iButton,QListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_contextMenuRequested(QListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_onItem(QListViewItem * pItem);
+ void redirect_expanded(QListViewItem * pItem);
+ void redirect_collapsed(QListViewItem * pItem);
+};
+
+
+class KVILIB_API KviTalListViewItem : public QListViewItem
+{
+public:
+ KviTalListViewItem(KviTalListView * pParent)
+ : QListViewItem(pParent) {};
+ KviTalListViewItem(KviTalListViewItem * pParent)
+ : QListViewItem(pParent) {};
+ KviTalListViewItem(KviTalListView * pParent,KviTalListViewItem * pAfter)
+ : QListViewItem(pParent,pAfter) {};
+ KviTalListViewItem(KviTalListViewItem * pParent,KviTalListViewItem * pAfter)
+ : QListViewItem(pParent,pAfter) {};
+ KviTalListViewItem(KviTalListView * pParent,const QString &szLabel1,const QString &szLabel2 = KviQString::empty,const QString &szLabel3 = KviQString::empty,const QString &szLabel4 = KviQString::empty,const QString &szLabel5 = KviQString::empty)
+ : QListViewItem(pParent,szLabel1,szLabel2,szLabel3,szLabel4,szLabel5) {};
+ KviTalListViewItem(KviTalListView * pParent,KviTalListViewItem * pAfter,const QString &szLabel1,const QString &szLabel2 = KviQString::empty,const QString &szLabel3 = KviQString::empty,const QString &szLabel4 = KviQString::empty,const QString &szLabel5 = KviQString::empty)
+ : QListViewItem(pParent,pAfter,szLabel1,szLabel2,szLabel3,szLabel4,szLabel5) {};
+ KviTalListViewItem(KviTalListViewItem * pParent,const QString &szLabel1,const QString &szLabel2 = KviQString::empty,const QString &szLabel3 = KviQString::empty,const QString &szLabel4 = KviQString::empty)
+ : QListViewItem(pParent,szLabel1,szLabel2,szLabel3,szLabel4) {};
+ KviTalListViewItem(KviTalListViewItem * pParent,KviTalListViewItem * pAfter,const QString &szLabel1,const QString &szLabel2 = KviQString::empty,const QString &szLabel3 = KviQString::empty,const QString &szLabel4 = KviQString::empty)
+ : QListViewItem(pParent,pAfter,szLabel1,szLabel2,szLabel3,szLabel4) {};
+ virtual ~KviTalListViewItem() {};
+public:
+ // Shadow the internal Qt methods
+ KviTalListViewItem * firstChild() const { return (KviTalListViewItem *)QListViewItem::firstChild(); };
+ KviTalListViewItem * nextSibling() const { return (KviTalListViewItem *)QListViewItem::nextSibling(); };
+ KviTalListViewItem * parent() const { return (KviTalListViewItem *)QListViewItem::parent(); };
+ KviTalListView * listView() const { return (KviTalListView *)QListViewItem::listView(); };
+ KviTalListViewItem * itemAbove() { return (KviTalListViewItem *)QListViewItem::itemAbove(); };
+ KviTalListViewItem * itemBelow() { return (KviTalListViewItem *)QListViewItem::itemBelow(); };
+};
+
+struct KviTalCheckListItemPrivate;
+
+class KVILIB_API KviTalCheckListItem : public KviTalListViewItem
+{
+public:
+ enum Type {
+ RadioButton,
+ CheckBox,
+ Controller,
+ RadioButtonController=Controller,
+ CheckBoxController
+ };
+ enum ToggleState { Off, NoChange, On };
+
+ KviTalCheckListItem(KviTalCheckListItem *parent, const QString &text,Type = RadioButtonController);
+ KviTalCheckListItem(KviTalCheckListItem *parent, KviTalListViewItem *after,const QString &text, Type = RadioButtonController);
+ KviTalCheckListItem( KviTalListViewItem *parent, const QString &text,Type = RadioButtonController );
+ KviTalCheckListItem( KviTalListViewItem *parent, KviTalListViewItem *after,const QString &text, Type = RadioButtonController );
+ KviTalCheckListItem( KviTalListView *parent, const QString &text,Type = RadioButtonController );
+ KviTalCheckListItem( KviTalListView *parent, KviTalListViewItem *after,const QString &text, Type = RadioButtonController );
+ KviTalCheckListItem( KviTalListViewItem *parent, const QString &text,const QPixmap & );
+ KviTalCheckListItem( KviTalListView *parent, const QString &text,const QPixmap & );
+ ~KviTalCheckListItem();
+
+ void paintCell( QPainter *,const QColorGroup & cg,int column, int width, int alignment );
+ virtual void paintFocus( QPainter *, const QColorGroup & cg,
+ const QRect & r );
+ int width( const QFontMetrics&, const KviTalListView*, int column) const;
+ void setup();
+
+ virtual void setOn( bool ); // ### should be replaced by setChecked in ver4
+ bool isOn() const { return on; }
+ Type type() const { return myType; }
+ QString text() const { return KviTalListViewItem::text( 0 ); }
+ QString text( int n ) const { return KviTalListViewItem::text( n ); }
+
+ void setTristate( bool );
+ bool isTristate() const;
+ ToggleState state() const;
+ void setState( ToggleState s);
+
+ int rtti() const;
+ static int RTTI;
+
+protected:
+ void activate();
+ void turnOffChild();
+ virtual void stateChange( bool );
+
+private:
+ void init();
+ ToggleState internalState() const;
+ void setStoredState( ToggleState newState, void *key );
+ ToggleState storedState( void *key ) const;
+ void stateChange( ToggleState s );
+ void restoreState( void *key, int depth = 0 );
+ void updateController( bool update = TRUE , bool store = FALSE );
+ void updateStoredState( void *key );
+ void setState( ToggleState s, bool update, bool store );
+ void setCurrentState( ToggleState s );
+
+ Type myType;
+ bool on; // ### remove in ver4
+ KviTalCheckListItemPrivate *d;
+};
+
+
+#define KviTalListViewItemIterator QListViewItemIterator
+
+#endif // _KVI_TAL_LISTVIEW_QT3_H_
diff --git a/src/kvilib/tal/kvi_tal_listview_qt4.h b/src/kvilib/tal/kvi_tal_listview_qt4.h
new file mode 100644
index 000000000..1c18f8a32
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_listview_qt4.h
@@ -0,0 +1,199 @@
+#ifndef _KVI_TAL_LISTVIEW_QT4_H_
+#define _KVI_TAL_LISTVIEW_QT4_H_
+
+//=============================================================================
+//
+// File : kvi_tal_listview_qt4.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+
+#include "kvi_qstring.h"
+
+#include <q3listview.h>
+
+class KviTalListViewItem;
+
+
+class KVILIB_API KviTalListView : public Q3ListView
+{
+ friend class KviTalCheckListItem;
+ Q_OBJECT
+public:
+ KviTalListView(QWidget * pParent);
+ virtual ~KviTalListView() {};
+public:
+ // Shadow the internal Qt methods
+ KviTalListViewItem * firstChild() const { return (KviTalListViewItem *)Q3ListView::firstChild(); };
+ KviTalListViewItem * lastItem() const { return (KviTalListViewItem *)Q3ListView::lastItem(); };
+ KviTalListViewItem * selectedItem() const { return (KviTalListViewItem *)Q3ListView::selectedItem(); };
+ KviTalListViewItem * currentItem() const { return (KviTalListViewItem *)Q3ListView::currentItem(); };
+ KviTalListViewItem * itemAt(const QPoint &pnt) const { return (KviTalListViewItem *)Q3ListView::itemAt(pnt); };
+ignals:
+ void selectionChanged(KviTalListViewItem * pItem);
+ void currentChanged(KviTalListViewItem * pItem);
+ void clicked(KviTalListViewItem * pItem);
+ void clicked(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void pressed(KviTalListViewItem * pItem);
+ void pressed(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void doubleClicked(KviTalListViewItem * pItem);
+ void doubleClicked(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void returnPressed(KviTalListViewItem * pItem);
+ void spacePressed(KviTalListViewItem * pItem);
+ void rightButtonClicked(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void rightButtonPressed(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void mouseButtonClicked(int iButton,KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void mouseButtonPressed(int iButton,KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void contextMenuRequested(KviTalListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void onItem(KviTalListViewItem * pItem);
+ void expanded(KviTalListViewItem * pItem);
+ void collapsed(KviTalListViewItem * pItem);
+protected slots:
+ void redirect_selectionChanged(Q3ListViewItem * pItem);
+ void redirect_currentChanged(Q3ListViewItem * pItem);
+ void redirect_clicked(Q3ListViewItem * pItem);
+ void redirect_clicked(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_pressed(Q3ListViewItem * pItem);
+ void redirect_pressed(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_doubleClicked(Q3ListViewItem * pItem);
+ void redirect_doubleClicked(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_returnPressed(Q3ListViewItem * pItem);
+ void redirect_spacePressed(Q3ListViewItem * pItem);
+ void redirect_rightButtonClicked(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_rightButtonPressed(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_mouseButtonClicked(int iButton,Q3ListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_mouseButtonPressed(int iButton,Q3ListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_contextMenuRequested(Q3ListViewItem * pItem,const QPoint &pnt,int uColumn);
+ void redirect_onItem(Q3ListViewItem * pItem);
+ void redirect_expanded(Q3ListViewItem * pItem);
+ void redirect_collapsed(Q3ListViewItem * pItem);
+
+};
+
+
+class KVILIB_API KviTalListViewItem : public Q3ListViewItem
+{
+public:
+ KviTalListViewItem(KviTalListView * pParent)
+ : Q3ListViewItem(pParent) {};
+ KviTalListViewItem(KviTalListViewItem * pParent)
+ : Q3ListViewItem(pParent) {};
+ KviTalListViewItem(KviTalListView * pParent,KviTalListViewItem * pAfter)
+ : Q3ListViewItem(pParent,pAfter) {};
+ KviTalListViewItem(KviTalListViewItem * pParent,KviTalListViewItem * pAfter)
+ : Q3ListViewItem(pParent,pAfter) {};
+ KviTalListViewItem(KviTalListView * pParent,const QString &szLabel1,const QString &szLabel2 = KviQString::empty,const QString &szLabel3 = KviQString::empty,const QString &szLabel4 = KviQString::empty,const QString &szLabel5 = KviQString::empty)
+ : Q3ListViewItem(pParent,szLabel1,szLabel2,szLabel3,szLabel4,szLabel5) {};
+ KviTalListViewItem(KviTalListView * pParent,KviTalListViewItem * pAfter,const QString &szLabel1,const QString &szLabel2 = KviQString::empty,const QString &szLabel3 = KviQString::empty,const QString &szLabel4 = KviQString::empty,const QString &szLabel5 = KviQString::empty)
+ : Q3ListViewItem(pParent,pAfter,szLabel1,szLabel2,szLabel3,szLabel4,szLabel5) {};
+ KviTalListViewItem(KviTalListViewItem * pParent,const QString &szLabel1,const QString &szLabel2 = KviQString::empty,const QString &szLabel3 = KviQString::empty,const QString &szLabel4 = KviQString::empty)
+ : Q3ListViewItem(pParent,szLabel1,szLabel2,szLabel3,szLabel4) {};
+ KviTalListViewItem(KviTalListViewItem * pParent,KviTalListViewItem * pAfter,const QString &szLabel1,const QString &szLabel2 = KviQString::empty,const QString &szLabel3 = KviQString::empty,const QString &szLabel4 = KviQString::empty)
+ : Q3ListViewItem(pParent,pAfter,szLabel1,szLabel2,szLabel3,szLabel4) {};
+public:
+ // Shadow the internal Qt methods
+ KviTalListViewItem * firstChild() const { return (KviTalListViewItem *)Q3ListViewItem::firstChild(); };
+ KviTalListViewItem * nextSibling() const { return (KviTalListViewItem *)Q3ListViewItem::nextSibling(); };
+ KviTalListViewItem * parent() const { return (KviTalListViewItem *)Q3ListViewItem::parent(); };
+ KviTalListView * listView() const { return (KviTalListView *)Q3ListViewItem::listView(); };
+ KviTalListViewItem * itemAbove() { return (KviTalListViewItem *)Q3ListViewItem::itemAbove(); };
+ KviTalListViewItem * itemBelow() { return (KviTalListViewItem *)Q3ListViewItem::itemBelow(); };
+};
+
+struct KviTalCheckListItemPrivate;
+
+class KVILIB_API KviTalCheckListItem : public KviTalListViewItem
+{
+public:
+ enum Type { RadioButton,
+ CheckBox,
+ Controller,
+ RadioButtonController=Controller,
+ CheckBoxController };
+
+ enum ToggleState { Off, NoChange, On };
+
+ KviTalCheckListItem(KviTalCheckListItem *parent, const QString &text,
+ Type = RadioButtonController);
+ KviTalCheckListItem(KviTalCheckListItem *parent, KviTalListViewItem *after,
+ const QString &text, Type = RadioButtonController);
+ KviTalCheckListItem(KviTalListViewItem *parent, const QString &text,
+ Type = RadioButtonController);
+ KviTalCheckListItem(KviTalListViewItem *parent, KviTalListViewItem *after,
+ const QString &text, Type = RadioButtonController);
+ KviTalCheckListItem(KviTalListView *parent, const QString &text,
+ Type = RadioButtonController);
+ KviTalCheckListItem(KviTalListView *parent, KviTalListViewItem *after,
+ const QString &text, Type = RadioButtonController);
+ KviTalCheckListItem(KviTalListViewItem *parent, const QString &text,
+ const QPixmap &);
+ KviTalCheckListItem(KviTalListView *parent, const QString &text,
+ const QPixmap &);
+ ~KviTalCheckListItem();
+
+ void paintCell(QPainter *, const QColorGroup & cg,
+ int column, int width, int alignment);
+ virtual void paintFocus(QPainter *, const QColorGroup &cg,
+ const QRect & r);
+ int width(const QFontMetrics&, const KviTalListView*, int column) const;
+ void setup();
+
+ virtual void setOn(bool);
+ bool isOn() const { return on; }
+ Type type() const { return myType; }
+ QString text() const { return KviTalListViewItem::text(0); }
+ QString text(int n) const { return KviTalListViewItem::text(n); }
+
+ void setTristate(bool);
+ bool isTristate() const;
+ ToggleState state() const;
+ void setState(ToggleState s);
+
+ int rtti() const;
+ enum { RTTI = 1 };
+
+protected:
+ void activate();
+ void turnOffChild();
+ virtual void stateChange(bool);
+
+private:
+ void init();
+ ToggleState internalState() const;
+ void setStoredState(ToggleState newState, KviTalCheckListItem *key);
+ ToggleState storedState(KviTalCheckListItem *key) const;
+ void stateChange(ToggleState s);
+ void restoreState(KviTalCheckListItem *key, int depth = 0);
+ void updateController(bool update = true , bool store = false);
+ void updateStoredState(KviTalCheckListItem *key);
+ void setState(ToggleState s, bool update, bool store);
+ void setCurrentState(ToggleState s);
+
+ Type myType;
+ bool on;
+ KviTalCheckListItemPrivate *d;
+};
+
+#define KviTalListViewItemIterator Q3ListViewItemIterator
+
+
+#endif // _KVI_TAL_LISTVIEW_QT4_H_
diff --git a/src/kvilib/tal/kvi_tal_popupmenu_qt4.h b/src/kvilib/tal/kvi_tal_popupmenu_qt4.h
index 51f3b8f96..1a6e58b2b 100644
--- a/src/kvilib/tal/kvi_tal_popupmenu_qt4.h
+++ b/src/kvilib/tal/kvi_tal_popupmenu_qt4.h
@@ -40,6 +40,33 @@ public:
setName(szName);
};
virtual ~KviTalPopupMenu() {};
+
+ int insertItem(const QString &szText)
+ {
+ return Q3PopupMenu::insertItem(szText);
+ }
+ int insertItem(const QPixmap &pix,const QString &szText)
+ {
+ return Q3PopupMenu::insertItem(QIcon(pix),szText,-1,-1);
+ }
+ int insertItem(const QString &szText,const QObject * pReceiver,const char * szSlot)
+ {
+ return Q3PopupMenu::insertItem(szText,pReceiver,szSlot);
+ }
+ int insertItem(const QPixmap &pix,const QString &szText,const QObject * pReceiver,const char * szSlot)
+ {
+ return Q3PopupMenu::insertItem(QIcon(pix),szText,pReceiver,szSlot);
+ }
+ int insertItem(const QPixmap &pix,const QString &szText,QMenu *pMenu)
+ {
+ return Q3PopupMenu::insertItem(QIcon(pix),szText,pMenu,-1,-1);
+ }
+ int insertItem(const QString &szText,QMenu *pMenu)
+ {
+ return Q3PopupMenu::insertItem(szText,pMenu,-1,-1);
+ }
+
+
};
#endif // _KVI_TAL_POPUPMENU_QT4_H_
diff --git a/src/kvilib/tal/kvi_tal_scrollview.cpp b/src/kvilib/tal/kvi_tal_scrollview.cpp
new file mode 100644
index 000000000..dea4833c6
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_scrollview.cpp
@@ -0,0 +1,33 @@
+//=============================================================================
+//
+// File : kvi_tal_scrollview.cpp
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#define __KVILIB__
+#include "kvi_tal_scrollview.h"
+
+#ifdef COMPILE_USE_QT4
+ #include "kvi_tal_scrollview_qt4.moc"
+#else
+ #include "kvi_tal_scrollview_qt3.moc"
+#endif
+
diff --git a/src/kvilib/tal/kvi_tal_scrollview.h b/src/kvilib/tal/kvi_tal_scrollview.h
new file mode 100644
index 000000000..b23069268
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_scrollview.h
@@ -0,0 +1,36 @@
+#ifndef _KVI_TAL_SCROLLVIEW_H_
+#define _KVI_TAL_SCROLLVIEW_H_
+
+//=============================================================================
+//
+// File : kvi_tal_scrollview.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+
+#ifdef COMPILE_USE_QT4
+ #include "kvi_tal_scrollview_qt4.h"
+#else
+ #include "kvi_tal_scrollview_qt3.h"
+#endif
+
+#endif // _KVI_TAL_SCROLLVIEW_H_
diff --git a/src/kvilib/tal/kvi_tal_scrollview_qt3.h b/src/kvilib/tal/kvi_tal_scrollview_qt3.h
new file mode 100644
index 000000000..c1306b142
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_scrollview_qt3.h
@@ -0,0 +1,41 @@
+#ifndef _KVI_TAL_SCROLLVIEW_QT3_H_
+#define _KVI_TAL_SCROLLVIEW_QT3_H_
+
+//=============================================================================
+//
+// File : kvi_tal_scrollview_qt3.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+
+#include <qscrollview.h>
+
+class KVILIB_API KviTalScrollView : public QScrollView
+{
+ Q_OBJECT
+public:
+ KviTalScrollView(QWidget * pParent)
+ : QScrollView(pParent) {};
+ virtual ~KviTalScrollView() {};
+};
+
+#endif // _KVI_TAL_SCROLLVIEW_QT3_H_
diff --git a/src/kvilib/tal/kvi_tal_scrollview_qt4.h b/src/kvilib/tal/kvi_tal_scrollview_qt4.h
new file mode 100644
index 000000000..68ad803c9
--- /dev/null
+++ b/src/kvilib/tal/kvi_tal_scrollview_qt4.h
@@ -0,0 +1,41 @@
+#ifndef _KVI_TAL_SCROLLVIEW_QT4_H_
+#define _KVI_TAL_SCROLLVIEW_QT4_H_
+
+//=============================================================================
+//
+// File : kvi_tal_scrollview_qt4.h
+// Creation date : Mon Jan 22 2007 11:25:08 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2007 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+
+#include <qscrollarea.h>
+
+class KVILIB_API KviTalScrollView : public QScrollArea
+{
+ Q_OBJECT
+public:
+ KviTalScrollView(QWidget * pParent)
+ : QScrollArea(pParent) {};
+ virtual ~KviTalScrollView() {};
+};
+
+#endif // _KVI_TAL_SCROLLVIEW_QT4_H_
diff --git a/src/kvilib/tal/kvi_tal_tooltip.cpp b/src/kvilib/tal/kvi_tal_tooltip.cpp
index 6592383b3..5628b828c 100644
--- a/src/kvilib/tal/kvi_tal_tooltip.cpp
+++ b/src/kvilib/tal/kvi_tal_tooltip.cpp
@@ -45,6 +45,10 @@ void KviTalToolTip::add(QWidget * widget,const QString & text)
QToolTip::add(widget,text);
}
+void KviTalToolTip::remove(QWidget * widget)
+{
+ QToolTip::remove(widget);
+}
void KviTalToolTip::tip(const QRect & rect,const QString & text)
{
diff --git a/src/kvilib/tal/kvi_tal_tooltip.h b/src/kvilib/tal/kvi_tal_tooltip.h
index 5e10dca19..4e058c2e5 100644
--- a/src/kvilib/tal/kvi_tal_tooltip.h
+++ b/src/kvilib/tal/kvi_tal_tooltip.h
@@ -41,6 +41,7 @@ public:
public:
#ifdef COMPILE_USE_QT4
static void add(QWidget * widget,const QString & text);
+ static void remove(QWidget * widget);
virtual void tip(const QRect & rect,const QString & text);
#endif
protected:
diff --git a/src/kvirc/kernel/kvi_app.cpp b/src/kvirc/kernel/kvi_app.cpp
index edf49fdf5..70d579992 100644
--- a/src/kvirc/kernel/kvi_app.cpp
+++ b/src/kvirc/kernel/kvi_app.cpp
@@ -89,7 +89,10 @@
#include <qstringlist.h>
#include "kvi_asciidict.h"
#include <qmime.h>
-#include <qlistbox.h>
+#ifdef COMPILE_USE_QT4
+ #include <q3mimefactory.h>
+#endif
+#include "kvi_tal_listbox.h"
#include <qclipboard.h>
#include <qmessagebox.h>
#include <qtextcodec.h>
@@ -241,7 +244,11 @@ void KviApp::setup()
list.append(tmp);
getGlobalKvircDirectory(tmp,HelpNoIntl);
list.append(tmp);
+#ifdef COMPILE_USE_QT4
+ Q3MimeSourceFactory::defaultFactory()->setFilePath(list);
+#else
QMimeSourceFactory::defaultFactory()->setFilePath(list);
+#endif
KVI_SPLASH_SET_PROGRESS(1)
@@ -644,6 +651,8 @@ QTextCodec * KviApp::defaultTextCodec()
void KviApp::contextSensitiveHelp()
{
+ // this stuff doesn't work with Qt 4.x
+#ifndef COMPILE_USE_QT4
// the F1 Key has been pressed
// try to pass it to the active widget or one of its parents
QWidget * w = g_pApp->focusWidget();
@@ -666,6 +675,7 @@ void KviApp::contextSensitiveHelp()
// no way
// FIXME: just show up simple plain online help
//debug("No way: found no focus widget for that...");
+#endif
}
@@ -686,7 +696,9 @@ void KviApp::loadDefaultScript()
#endif
KviKvsScript::run(cmd,g_pFrame->firstConsole());
// now line up the toolbars (they may get messed while loading the script)
- g_pFrame->lineUpDockWindows();
+#ifndef COMPILE_USE_QT4
+ g_pFrame->lineUpDockWindows(); // missing on Qt 4.x
+#endif
}
// 07.01.2005 06:01: Got this curious gcc error while writing
@@ -1938,7 +1950,7 @@ void KviApp::fillRecentChannelsPopup(KviTalPopupMenu * m,KviConsole * pConsole)
/*
-void KviApp::fillRecentServersListBox(QListBox * l)
+void KviApp::fillRecentServersListBox(KviTalListBox * l)
{
l->clear();
for(QStringList::Iterator it = KVI_OPTION_STRINGLIST(KviOption_stringlistRecentServers).begin(); it != KVI_OPTION_STRINGLIST(KviOption_stringlistRecentServers).end(); ++it)
diff --git a/src/kvirc/kernel/kvi_app.h b/src/kvirc/kernel/kvi_app.h
index aafadb900..562c27bda 100644
--- a/src/kvirc/kernel/kvi_app.h
+++ b/src/kvirc/kernel/kvi_app.h
@@ -50,7 +50,7 @@
class KviTalPopupMenu;
class QPixmap;
-class QListBox;
+class KviTalListBox;
class QTextCodec;
class QDomElement;
diff --git a/src/kvirc/kernel/kvi_app_fs.cpp b/src/kvirc/kernel/kvi_app_fs.cpp
index c3b570db0..0b21ebc2c 100644
--- a/src/kvirc/kernel/kvi_app_fs.cpp
+++ b/src/kvirc/kernel/kvi_app_fs.cpp
@@ -37,6 +37,7 @@
#include <qdir.h>
#include <qfileinfo.h>
+#include <qdatetime.h>
extern KviMediaManager * g_pMediaManager;
diff --git a/src/kvirc/kernel/kvi_coreactions.cpp b/src/kvirc/kernel/kvi_coreactions.cpp
index 00df7007c..568ddca4f 100644
--- a/src/kvirc/kernel/kvi_coreactions.cpp
+++ b/src/kvirc/kernel/kvi_coreactions.cpp
@@ -466,10 +466,13 @@ void KviIrcContextDisplayAction::setup()
bool KviIrcContextDisplayAction::addToPopupMenu(KviTalPopupMenu *p)
{
+ // QT4SUX: Widgets can be no longer added to popup menus.. what about labels ?
+#ifndef COMPILE_USE_QT4
if(!setupDone())setup();
KviIrcContextDisplay * w = new KviIrcContextDisplay(p,"kvirc.irccontextdisplay");
registerWidget(w);
p->insertItem(w);
+#endif
return true;
}
diff --git a/src/kvirc/kernel/kvi_filetransfer.cpp b/src/kvirc/kernel/kvi_filetransfer.cpp
index 61c77cd81..ff67dcb3a 100644
--- a/src/kvirc/kernel/kvi_filetransfer.cpp
+++ b/src/kvirc/kernel/kvi_filetransfer.cpp
@@ -28,7 +28,7 @@
#include "kvi_app.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include "kvi_tal_popupmenu.h"
static KviFileTransferManager * g_pFileTransferManager = 0;
diff --git a/src/kvirc/kernel/kvi_filetransfer.h b/src/kvirc/kernel/kvi_filetransfer.h
index 8323d40dd..79a6b5376 100644
--- a/src/kvirc/kernel/kvi_filetransfer.h
+++ b/src/kvirc/kernel/kvi_filetransfer.h
@@ -30,10 +30,12 @@
#include <qobject.h>
#include "kvi_list.h"
+#include "kvi_tal_listview.h"
class KviFileTransfer;
class KviWindow;
class KviTalPopupMenu;
+class QPainter;
// This is for the external extension
#define KVI_FILE_TRANSFER_WINDOW_EXTENSION_NAME "File transfer extension"
@@ -73,7 +75,6 @@ signals:
#define COLUMN_FILEINFO 1
#define COLUMN_PROGRESS 2
-class QListViewItem;
class KVIRC_API KviFileTransfer : public QObject
{
@@ -83,10 +84,10 @@ public:
~KviFileTransfer();
protected:
int m_iId;
- QListViewItem * m_pDisplayItem;
+ KviTalListViewItem * m_pDisplayItem;
public:
// This is called by KviFileTransferItem at any time
- void setDisplayItem(QListViewItem * i){ m_pDisplayItem = i; };
+ void setDisplayItem(KviTalListViewItem * i){ m_pDisplayItem = i; };
int id(){ return m_iId; };
// this is just a convenience function : it's equivalent to !active()
bool terminated();
diff --git a/src/kvirc/kernel/kvi_iconmanager.cpp b/src/kvirc/kernel/kvi_iconmanager.cpp
index e3cd5684c..685f88f95 100644
--- a/src/kvirc/kernel/kvi_iconmanager.cpp
+++ b/src/kvirc/kernel/kvi_iconmanager.cpp
@@ -38,10 +38,15 @@
#include <qlayout.h>
#include <qlabel.h>
-#include <qdragobject.h>
+#ifndef COMPILE_USE_QT4
+ // In Qt.4 we need to use QMimeData ?
+ #include <qdragobject.h>
+#endif
#include <qcursor.h>
-
+#ifdef COMPILE_USE_QT4
+ #include <qevent.h>
+#endif
// kvi_app.cpp
extern QPixmap * g_pUserChanStatePixmap;
@@ -346,7 +351,11 @@ static const char * g_szIconNames[KVI_NUM_SMALL_ICONS]=
};
KviIconWidget::KviIconWidget()
+#ifdef COMPILE_USE_QT4
+: QWidget(0,"global_icon_widget" /*,WType_TopLevel | WStyle_Customize | WStyle_Title | WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_SysMenu | WStyle_Minimize*/)
+#else
: QWidget(0,"global_icon_widget",WType_TopLevel | WStyle_Customize | WStyle_Title | WStyle_StaysOnTop | WStyle_DialogBorder | WStyle_SysMenu | WStyle_Minimize)
+#endif
{
init();
}
@@ -415,11 +424,14 @@ bool KviIconWidget::eventFilter(QObject * o,QEvent *e)
parentWidget()->close();
return true;
} else {
- if(QPixmap * pix = ((QLabel *)o)->pixmap())
+ if(const QPixmap * pix = ((QLabel *)o)->pixmap())
{
+// FIXME: In Qt 4.x this stuff needs to be ported to a different api.. which one ?
+#ifndef COMPILE_USE_QT4
QDragObject * drobj = new QTextDrag(o->name(),this);
drobj->setPixmap(*pix,((QLabel *)o)->mapFromGlobal(QCursor::pos()));
drobj->dragCopy();
+#endif
return true;
}
}
diff --git a/src/kvirc/kernel/kvi_ipc.cpp b/src/kvirc/kernel/kvi_ipc.cpp
index f181c4f17..27bb87f4d 100644
--- a/src/kvirc/kernel/kvi_ipc.cpp
+++ b/src/kvirc/kernel/kvi_ipc.cpp
@@ -1,9 +1,10 @@
+//=============================================================================
//
// File : kvi_ipc.hcpp
// Creation date : Tue Apr 10 2001 15:04:45 by Szymon Stefanek
//
// This file is part of the KVirc irc client distribution
-// Copyright (C) 2001 Szymon Stefanek (pragma at kvirc dot net)
+// Copyright (C) 2001-2007 Szymon Stefanek (pragma at kvirc dot net)
//
// This program is FREE software. You can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -19,7 +20,11 @@
// along with this program. If not, write to the Free Software Foundation,
// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
+//=============================================================================
+
#define __KVIRC__
+
+
#include "kvi_ipc.h"
@@ -49,6 +54,15 @@
#include <unistd.h> // for getuid
#include <sys/types.h> // for getuid
+ #ifdef COMPILE_USE_QT4
+ #include <qx11info_x11.h>
+ #define kvi_ipc_get_xdisplay QX11Info::display
+ #define kvi_ipc_get_xrootwin QX11Info::appRootWindow
+ #else
+ #define kvi_ipc_get_xdisplay qt_xdisplay
+ #define kvi_ipc_get_xrootwin qt_xrootwin
+ #endif
+
static Atom kvi_atom_ipc_sentinel_window;
static Atom kvi_atom_ipc_remote_command;
static Atom kvi_atom_ipc_remote_message;
@@ -60,14 +74,14 @@
if(g_bIpcAtomsLoaded)return;
g_bIpcAtomsLoaded = true;
kvi_sentinel_id.sprintf("tonno e mistero - %d",getuid());
- kvi_atom_ipc_sentinel_window = XInternAtom(qt_xdisplay(),"XA_KVI_IPC_SENTINEL_WINDOW",False);
- kvi_atom_ipc_remote_command = XInternAtom(qt_xdisplay(),"XA_KVI_IPC_REMOTE_COMMAND",False);
- kvi_atom_ipc_remote_message = XInternAtom(qt_xdisplay(),"XA_KVI_IPC_REMOTE_MESSAGE",False);
+ kvi_atom_ipc_sentinel_window = XInternAtom(kvi_ipc_get_xdisplay(),"XA_KVI_IPC_SENTINEL_WINDOW",False);
+ kvi_atom_ipc_remote_command = XInternAtom(kvi_ipc_get_xdisplay(),"XA_KVI_IPC_REMOTE_COMMAND",False);
+ kvi_atom_ipc_remote_message = XInternAtom(kvi_ipc_get_xdisplay(),"XA_KVI_IPC_REMOTE_MESSAGE",False);
}
static void kvi_ipcSetRemoteCommand(Window w,const char * command)
{
- XChangeProperty(qt_xdisplay(),w,kvi_atom_ipc_remote_command,
+ XChangeProperty(kvi_ipc_get_xdisplay(),w,kvi_atom_ipc_remote_command,
XA_STRING,8,PropModeReplace,(const unsigned char *)command,kvi_strLen(command) + 1);
}
@@ -77,7 +91,7 @@
int format;
unsigned long nItems,after;
unsigned char * data = 0;
- if(XGetWindowProperty(qt_xdisplay(),win,kvi_atom_ipc_sentinel_window,0,32,FALSE,XA_STRING,
+ if(XGetWindowProperty(kvi_ipc_get_xdisplay(),win,kvi_atom_ipc_sentinel_window,0,32,FALSE,XA_STRING,
&type,&format,&nItems,&after,&data) == Success)
{
if((type == XA_STRING) && (format == 8))
@@ -97,7 +111,7 @@
Window * children;
unsigned int nChildren;
- if(!XQueryTree(qt_xdisplay(),win,&root,&parent,&children,&nChildren))
+ if(!XQueryTree(kvi_ipc_get_xdisplay(),win,&root,&parent,&children,&nChildren))
{
if(children)XFree((char *)children);
return 0;
@@ -138,22 +152,22 @@
kvi_ipcLoadAtoms();
- Window sentinel = kvi_x11_findIpcSentinel(qt_xrootwin());
+ Window sentinel = kvi_x11_findIpcSentinel(kvi_ipc_get_xrootwin());
if(sentinel != 0)
{
-// XChangeProperty(qt_xdisplay(),sentinel,kvi_atom_ipc_remote_command,XA_STRING,8,
+// XChangeProperty(kvi_ipc_get_xdisplay(),sentinel,kvi_atom_ipc_remote_command,XA_STRING,8,
// PropModeReplace,(const unsigned char *)message,kvi_strLen(message));
kvi_ipcSetRemoteCommand(sentinel,message);
XEvent e;
kvi_memset(&e,0,sizeof(XEvent));
e.type = ClientMessage;
- e.xclient.display = qt_xdisplay();
+ e.xclient.display = kvi_ipc_get_xdisplay();
e.xclient.window = sentinel;
e.xclient.message_type = kvi_atom_ipc_remote_message;
e.xclient.format = 8;
- XSendEvent(qt_xdisplay(),sentinel,False,0,&e);
+ XSendEvent(kvi_ipc_get_xdisplay(),sentinel,False,0,&e);
return true;
}
@@ -179,7 +193,7 @@
#ifndef COMPILE_NO_X
kvi_ipcLoadAtoms();
- XChangeProperty(qt_xdisplay(),winId(),kvi_atom_ipc_sentinel_window,XA_STRING,8,
+ XChangeProperty(kvi_ipc_get_xdisplay(),winId(),kvi_atom_ipc_sentinel_window,XA_STRING,8,
PropModeReplace,(const unsigned char *)kvi_sentinel_id.ptr(),kvi_sentinel_id.len());
kvi_ipcSetRemoteCommand(winId(),"");
@@ -228,7 +242,7 @@
unsigned long nItems,after;
unsigned char * data = 0;
KviStr szData;
- if(XGetWindowProperty(qt_xdisplay(),winId(),kvi_atom_ipc_remote_command,0,1024,FALSE,XA_STRING,
+ if(XGetWindowProperty(kvi_ipc_get_xdisplay(),winId(),kvi_atom_ipc_remote_command,0,1024,FALSE,XA_STRING,
&type,&format,&nItems,&after,&data) == Success)
{
if((type == XA_STRING) && (format == 8) && (nItems > 0) && data)
diff --git a/src/kvirc/kernel/kvi_ipc.h b/src/kvirc/kernel/kvi_ipc.h
index e54308abf..83775f101 100644
--- a/src/kvirc/kernel/kvi_ipc.h
+++ b/src/kvirc/kernel/kvi_ipc.h
@@ -1,11 +1,12 @@
#ifndef _KVI_IPC_H_
#define _KVI_IPC_H_
+//=============================================================================
//
// File : kvi_ipc.h
// Creation date : Tue Apr 10 2001 15:04:45 by Szymon Stefanek
//
// This file is part of the KVirc irc client distribution
-// Copyright (C) 2001 Szymon Stefanek (pragma at kvirc dot net)
+// Copyright (C) 2001-2007 Szymon Stefanek (pragma at kvirc dot net)
//
// This program is FREE software. You can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -21,6 +22,7 @@
// along with this program. If not, write to the Free Software Foundation,
// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
+//=============================================================================
#include "kvi_settings.h"
@@ -36,7 +38,12 @@
#include <windows.h>
#else //!COMPILE_ON_WINDOWS
#ifndef COMPILE_NO_X
- #include <X11/Xlib.h> // for XEvent
+ #ifdef COMPILE_USE_QT4
+ // We need this to be included BEFORE X11/Xlib.h
+ // because of preprocessor constant collisions...
+ #include <qcoreevent.h>
+ #endif
+ #include "kvi_xlib.h" // for XEvent
#endif //!COMPILE_NO_X
#endif //!COMPILE_ON_WINDOWS
diff --git a/src/kvirc/kernel/kvi_ircconnection.cpp b/src/kvirc/kernel/kvi_ircconnection.cpp
index 2bb3b43bf..9f64e22e2 100644
--- a/src/kvirc/kernel/kvi_ircconnection.cpp
+++ b/src/kvirc/kernel/kvi_ircconnection.cpp
@@ -949,16 +949,20 @@ void KviIrcConnection::loginToIrcServer()
// disconnected :(
return;
}
+
QString szGenderTag;
- if(KVI_OPTION_BOOL(KviOption_boolPrependGenderInfoToRealname) && !KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender).isEmpty()){
+ if(KVI_OPTION_BOOL(KviOption_boolPrependGenderInfoToRealname) && !KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender).isEmpty())
+ {
szGenderTag.append(KVI_TEXT_COLOR);
- if(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender).startsWith("m",false)){
+ if(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender).startsWith("m",false))
+ {
szGenderTag.append("1");
- } else if(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender).startsWith("f",false)){
+ } else if(KVI_OPTION_STRING(KviOption_stringCtcpUserInfoGender).startsWith("f",false))
+ {
szGenderTag.append("2");
}
szGenderTag.append(KVI_TEXT_RESET);
- szReal.prepend(szGenderTag);
+ szReal.prepend(KviQString::toUtf8(szGenderTag));
}
if(!sendFmtData("USER %s 0 %s :%s",szUser.data(),
diff --git a/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp b/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp
index 48c471bbb..08910721b 100644
--- a/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp
+++ b/src/kvirc/kernel/kvi_ircconnectionserverinfo.cpp
@@ -90,12 +90,13 @@ void KviIrcConnectionServerInfo::buildModePrefixTable()
if(!cPrefix || !cFlag)return; // eh ?
m_uPrefixes=QMIN(m_szSupportedModePrefixes.length(),m_szSupportedModePrefixes.length());
- m_pModePrefixTable=(Q_UINT32*)kvi_malloc(sizeof(Q_UINT32)*3*m_uPrefixes);
+ m_pModePrefixTable=(kvi_u32_t*)kvi_malloc(sizeof(kvi_u32_t)*3*m_uPrefixes);
unsigned short uPrefix,uFlag;
- // FIXME: The whole mode handling needs rethinking!
- //FIXED: rethinked:)
+ // Pragma: FIXME: The whole mode handling needs rethinking!
+ // Alexey: FIXED: rethinked:)
+ // Pragma: LOL :DDDD
int i=0;
while( (uPrefix = cPrefix->unicode()) && (uFlag = cFlag->unicode()) && i<m_uPrefixes*3)
{
@@ -145,7 +146,7 @@ bool KviIrcConnectionServerInfo::isSupportedModeFlag(QChar c)
return false;
}
-QChar KviIrcConnectionServerInfo::modePrefixChar(Q_UINT32 flag)
+QChar KviIrcConnectionServerInfo::modePrefixChar(kvi_u32_t flag)
{
if(!m_pModePrefixTable) return 0;
for(int i=0;i<m_uPrefixes;i++)
@@ -155,7 +156,7 @@ QChar KviIrcConnectionServerInfo::modePrefixChar(Q_UINT32 flag)
return 0;
}
-QChar KviIrcConnectionServerInfo::modeFlagChar(Q_UINT32 flag)
+QChar KviIrcConnectionServerInfo::modeFlagChar(kvi_u32_t flag)
{
if(!m_pModePrefixTable) return 0;
for(int i=0;i<m_uPrefixes;i++)
@@ -165,7 +166,7 @@ QChar KviIrcConnectionServerInfo::modeFlagChar(Q_UINT32 flag)
return 0;
}
-Q_UINT32 KviIrcConnectionServerInfo::modeFlagFromPrefixChar(QChar c)
+kvi_u32_t KviIrcConnectionServerInfo::modeFlagFromPrefixChar(QChar c)
{
if(!m_pModePrefixTable) return 0;
for(int i=0;i<m_uPrefixes;i++)
@@ -175,7 +176,7 @@ Q_UINT32 KviIrcConnectionServerInfo::modeFlagFromPrefixChar(QChar c)
return 0;
}
-Q_UINT32 KviIrcConnectionServerInfo::modeFlagFromModeChar(QChar c)
+kvi_u32_t KviIrcConnectionServerInfo::modeFlagFromModeChar(QChar c)
{
if(!m_pModePrefixTable) return 0;
for(int i=0;i<m_uPrefixes;i++)
@@ -206,19 +207,19 @@ const QString & KviBasicIrcServerInfo::getChannelModeDescription(QChar mode)
{
QString tmp=getCustomChannelModeDescription(mode);
if(tmp.isNull()) return getBasicChannelModeDescription(mode);
- return QString::null;
+ return KviQString::empty;
}
const QString & KviBasicIrcServerInfo::getUserModeDescription(QChar mode)
{
QString tmp=getCustomUserModeDescription(mode);
if(tmp.isNull()) return getBasicUserModeDescription(mode);
- return QString::null;
+ return KviQString::empty;
}
const QString & KviBasicIrcServerInfo::getBasicChannelModeDescription(QChar mode)
{
- switch(mode)
+ switch(mode.unicode())
{
case 'o': return __tr2qs("Channel operators"); break;
case 'v': return __tr2qs("Voiced users"); break;
@@ -253,12 +254,12 @@ const QString & KviBasicIrcServerInfo::getBasicChannelModeDescription(QChar mode
case '7': return __tr2qs("Only 7-bit letters in nicknames allowed"); break;
case 'x': return __tr2qs("Impossible to use both 7-bit and 8-bit letters in nicknames"); break;
}
- return QString::null;
+ return KviQString::empty;
}
const QString & KviBasicIrcServerInfo::getBasicUserModeDescription(QChar mode)
{
- switch(mode)
+ switch(mode.unicode())
{
case 'o': return __tr2qs("o: IRC operator (OPER)"); break;
case 'O': return __tr2qs("O: Local IRC operator (LOCOP)"); break;
@@ -274,5 +275,5 @@ const QString & KviBasicIrcServerInfo::getBasicUserModeDescription(QChar mode)
case 'd': return __tr2qs("d: Obscure 'DEBUG' flag"); break;
case 'n': return __tr2qs("n: Recipient for nick changes"); break;
}
- return QString::null;
+ return KviQString::empty;
}
diff --git a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h
index 0cd54fc73..7b50ca786 100644
--- a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h
+++ b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h
@@ -26,16 +26,18 @@
#include "kvi_settings.h"
#include "kvi_qstring.h"
+#include "kvi_inttypes.h"
-class KVIRC_API KviBasicIrcServerInfo {
+class KVIRC_API KviBasicIrcServerInfo
+{
protected:
QString m_szServerVersion;
public:
- KviBasicIrcServerInfo(const QString & version = QString::null);
+ KviBasicIrcServerInfo(const QString & version = KviQString::empty);
~KviBasicIrcServerInfo();
protected:
- virtual const QString & getCustomChannelModeDescription(QChar mode) { return QString::null; };
- virtual const QString & getCustomUserModeDescription(QChar mode) { return QString::null; };
+ virtual const QString & getCustomChannelModeDescription(QChar mode) { return KviQString::empty; };
+ virtual const QString & getCustomUserModeDescription(QChar mode) { return KviQString::empty; };
private:
const QString & getBasicChannelModeDescription(QChar mode);
const QString & getBasicUserModeDescription(QChar mode);
@@ -58,7 +60,7 @@ private:
QString m_szSupportedUserModes; // the supported user modes
QString m_szSupportedChannelModes; // the supported channel modes
QString m_szSupportedModePrefixes; // the actually used mode prefixes @+
- Q_UINT32* m_pModePrefixTable; // the mode prefixes above in a table
+ kvi_u32_t * m_pModePrefixTable; // the mode prefixes above in a table
unsigned int m_uPrefixes;
QString m_szSupportedModeFlags; // the actually used mode flags ov
QString m_szSupportedChannelTypes; // the supported channel types
@@ -92,10 +94,10 @@ public:
bool isSupportedModePrefix(QChar c);
bool isSupportedModeFlag(QChar c);
- QChar modePrefixChar(Q_UINT32 flag);
- QChar modeFlagChar(Q_UINT32 flag);
- Q_UINT32 modeFlagFromPrefixChar(QChar c);
- Q_UINT32 modeFlagFromModeChar(QChar c);
+ QChar modePrefixChar(kvi_u32_t flag);
+ QChar modeFlagChar(kvi_u32_t flag);
+ kvi_u32_t modeFlagFromPrefixChar(QChar c);
+ kvi_u32_t modeFlagFromModeChar(QChar c);
protected:
void setName(const QString &szName){ m_szName = szName; };
void setSupportedUserModes(const QString &szSupportedUserModes){ m_szSupportedUserModes = szSupportedUserModes; };
diff --git a/src/kvirc/kernel/kvi_irccontext.cpp b/src/kvirc/kernel/kvi_irccontext.cpp
index 82af11a50..e2aa5ac4b 100644
--- a/src/kvirc/kernel/kvi_irccontext.cpp
+++ b/src/kvirc/kernel/kvi_irccontext.cpp
@@ -50,6 +50,7 @@
#include "kvi_kvs_script.h"
#include "kvi_netutils.h"
#include "kvi_ircurl.h"
+#include "kvi_qcstring.h"
#define __KVI_DEBUG__
#include "kvi_debug.h"
@@ -842,7 +843,7 @@ void KviIrcContext::terminateConnectionRequest(bool bForce,const QString &szQuit
ret.asString(buffer);
else
buffer = szQuit;
- QCString dat = console()->encodeText(buffer);
+ KviQCString dat = console()->encodeText(buffer);
bWasSentQuit = false;
connection()->stateData()->setSentQuit();
connection()->sendFmtData("QUIT :%s",dat.data() ? dat.data() : ""); // here theoretically we COULD get disconnected
diff --git a/src/kvirc/kernel/kvi_lagmeter.cpp b/src/kvirc/kernel/kvi_lagmeter.cpp
index b06b5c3e6..c9e0a008d 100644
--- a/src/kvirc/kernel/kvi_lagmeter.cpp
+++ b/src/kvirc/kernel/kvi_lagmeter.cpp
@@ -66,7 +66,9 @@ KviLagMeter::KviLagMeter(KviIrcConnection * c)
KviLagMeter::~KviLagMeter()
{
if(m_pDeletionSignal)*m_pDeletionSignal = true;
+#ifndef COMPILE_USE_QT4
killTimers();
+#endif
delete m_pCheckList;
}
diff --git a/src/kvirc/kernel/kvi_notifylist.cpp b/src/kvirc/kernel/kvi_notifylist.cpp
index 03a401cb8..5b23cf643 100644
--- a/src/kvirc/kernel/kvi_notifylist.cpp
+++ b/src/kvirc/kernel/kvi_notifylist.cpp
@@ -45,6 +45,7 @@
#include "kvi_qstring.h"
#include "kvi_lagmeter.h"
#include "kvi_kvs_eventtriggers.h"
+#include "kvi_qcstring.h"
#include <qstringlist.h>
@@ -491,7 +492,7 @@ void KviIsOnNotifyListManager::sendIsOn()
{
if(_OUTPUT_PARANOIC)
m_pConsole->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Notify list: Checking for: %Q"),&m_szIsOnString);
- QCString szDec = m_pConnection->encodeText(m_szIsOnString);
+ KviQCString szDec = m_pConnection->encodeText(m_szIsOnString);
m_pConnection->sendFmtData("ISON %s",szDec.data());
if(m_pConnection->lagMeter())
m_pConnection->lagMeter()->lagCheckRegister("@notify_ison",40); // not that reliable
@@ -761,7 +762,7 @@ void KviIsOnNotifyListManager::sendUserhost()
{
if(_OUTPUT_PARANOIC)
m_pConsole->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Notify list: Checking userhost for: %Q"),&m_szUserhostString);
- QCString ccc = m_pConnection->encodeText(m_szUserhostString);
+ KviQCString ccc = m_pConnection->encodeText(m_szUserhostString);
m_pConnection->sendFmtData("USERHOST %s",ccc.data());
if(m_pConnection->lagMeter())
m_pConnection->lagMeter()->lagCheckRegister("@notify_userhost",50);
@@ -958,7 +959,7 @@ void KviStupidNotifyListManager::sendIsOn()
}
if(_OUTPUT_PARANOIC)
m_pConsole->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Notify list: Checking for:%Q"),&m_szLastIsOnMsg);
- QCString dat = m_pConnection->encodeText(m_szLastIsOnMsg);
+ KviQCString dat = m_pConnection->encodeText(m_szLastIsOnMsg);
m_pConnection->sendFmtData("ISON%s",dat.data());
if(m_pConnection->lagMeter())
@@ -1122,7 +1123,7 @@ void KviWatchNotifyListManager::start()
{
if((watchStr.length() + nk.length() + 2) > 501)
{
- QCString dat = m_pConnection->encodeText(watchStr);
+ KviQCString dat = m_pConnection->encodeText(watchStr);
m_pConnection->sendFmtData("WATCH%s",dat.data());
if(_OUTPUT_VERBOSE)
m_pConsole->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Notify list: Adding watch entries for%Q"),&watchStr);
@@ -1135,7 +1136,7 @@ void KviWatchNotifyListManager::start()
if(!watchStr.isEmpty())
{
- QCString dat = m_pConnection->encodeText(watchStr);
+ KviQCString dat = m_pConnection->encodeText(watchStr);
m_pConnection->sendFmtData("WATCH%s",dat.data());
if(_OUTPUT_VERBOSE)
m_pConsole->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Notify list: Adding watch entries for%Q"),&watchStr);
diff --git a/src/kvirc/kernel/kvi_options.cpp b/src/kvirc/kernel/kvi_options.cpp
index b08d6c800..117c96078 100644
--- a/src/kvirc/kernel/kvi_options.cpp
+++ b/src/kvirc/kernel/kvi_options.cpp
@@ -806,7 +806,13 @@ KviMsgTypeOption g_msgtypeOptionsTable[KVI_NUM_MSGTYPE_OPTIONS]=
MSGTYPE_OPTION("MeChanUnOwner",__tr_no_lookup("Own chan owner status unset"),KVI_SMALLICON_MECHANUNOWNER,KVI_MSGTYPE_LEVEL_5),
MSGTYPE_OPTION_SPEC("ServerError",__tr_no_lookup("Server error"),KVI_SMALLICON_SERVERERROR,KVI_RED,KVI_TRANSPARENT,KVI_MSGTYPE_LEVEL_5),
MSGTYPE_OPTION_SPEC("Help",__tr_no_lookup("Help"),KVI_SMALLICON_HELP,KVI_DARKGREEN,KVI_TRANSPARENT,KVI_MSGTYPE_LEVEL_1),
- MSGTYPE_OPTION("TextEncoding",__tr_no_lookup("Text Encoding Server message"),KVI_SMALLICON_TEXTENCODING,KVI_MSGTYPE_LEVEL_1)
+ MSGTYPE_OPTION("TextEncoding",__tr_no_lookup("Text Encoding Server message"),KVI_SMALLICON_TEXTENCODING,KVI_MSGTYPE_LEVEL_1),
+ // TODO: add icon and check what level means
+ // Pragma: the message level is a warning level that is rendered in the taskbar
+ // messages with higher level are rendered with more visible color (i.e. red)
+ // messages with very high level might flash the tray and end up in the notifier
+ // level 1 or 2 for standard torrent messages is ok
+ MSGTYPE_OPTION("BitTorrent",__tr_no_lookup("BitTorrent message"),KVI_SMALLICON_MULTIMEDIA,KVI_MSGTYPE_LEVEL_2)
};
static const char * options_section_table[KVI_NUM_OPTION_SECT_FLAGS] =
diff --git a/src/kvirc/kernel/kvi_options.h b/src/kvirc/kernel/kvi_options.h
index 17439e092..84efbd05c 100644
--- a/src/kvirc/kernel/kvi_options.h
+++ b/src/kvirc/kernel/kvi_options.h
@@ -581,7 +581,7 @@ DECLARE_OPTION_STRUCT(KviStringListOption,QStringList)
#define KVI_MSGTYPE_OPTIONS_PREFIX "msgtype"
#define KVI_MSGTYPE_OPTIONS_PREFIX_LEN 7
-#define KVI_NUM_MSGTYPE_OPTIONS 136
+#define KVI_NUM_MSGTYPE_OPTIONS 137
diff --git a/src/kvirc/kernel/kvi_out.h b/src/kvirc/kernel/kvi_out.h
index 1739105d8..e48c43100 100644
--- a/src/kvirc/kernel/kvi_out.h
+++ b/src/kvirc/kernel/kvi_out.h
@@ -160,6 +160,7 @@
#define KVI_OUT_SERVERERROR 133
#define KVI_OUT_HELP 134
#define KVI_OUT_TEXTENCODING 135
+#define KVI_OUT_TORRENT 136
//#define KVI_NUM_MSGTYPE_OPTIONS 136
// UPDATE THE TOTAL COUNT IN kvi_options.h !!!!
diff --git a/src/kvirc/kernel/kvi_theme.cpp b/src/kvirc/kernel/kvi_theme.cpp
index 1e3221b20..e15e8a6a2 100644
--- a/src/kvirc/kernel/kvi_theme.cpp
+++ b/src/kvirc/kernel/kvi_theme.cpp
@@ -36,6 +36,12 @@
#define KVI_THEME_MEDIUM_SCREENSHOT_NAME "screenshot_medium.png"
#define KVI_THEME_LARGE_SCREENSHOT_NAME "screenshot.png"
+#ifdef COMPILE_USE_QT4
+ #define QIMAGE_SCALE_MIN Qt::KeepAspectRatio
+#else
+ #define QIMAGE_SCALE_MIN QImage::ScaleMin
+#endif
+
KviThemeInfo::KviThemeInfo()
: KviHeapObject()
{
@@ -169,7 +175,7 @@ const QPixmap & KviThemeInfo::smallScreenshot()
if(pix.width() > 300 || pix.height() > 225)
{
QImage sbri = pix.convertToImage();
- pix.convertFromImage(sbri.smoothScale(300,225,QImage::ScaleMin));
+ pix.convertFromImage(sbri.smoothScale(300,225,QIMAGE_SCALE_MIN));
}
pix.save(szFileName,"PNG");
@@ -203,7 +209,7 @@ const QPixmap & KviThemeInfo::mediumScreenshot()
if(pix.width() > 600 || pix.height() > 450)
{
QImage sbri = pix.convertToImage();
- pix.convertFromImage(sbri.smoothScale(600,450,QImage::ScaleMin));
+ pix.convertFromImage(sbri.smoothScale(600,450,QIMAGE_SCALE_MIN));
}
pix.save(szFileName,"PNG");
@@ -261,7 +267,7 @@ namespace KviTheme
}
if(pix.width() > 600 || pix.height() > 450)
- out.convertFromImage(pix.smoothScale(600,450,QImage::ScaleMin));
+ out.convertFromImage(pix.smoothScale(600,450,QIMAGE_SCALE_MIN));
else
out.convertFromImage(pix);
@@ -275,7 +281,7 @@ namespace KviTheme
}
if(pix.width() > 300 || pix.height() > 225)
- out.convertFromImage(pix.smoothScale(300,225,QImage::ScaleMin));
+ out.convertFromImage(pix.smoothScale(300,225,QIMAGE_SCALE_MIN));
else
out.convertFromImage(pix);
diff --git a/src/kvirc/kernel/kvi_userinput.cpp b/src/kvirc/kernel/kvi_userinput.cpp
index b9c2148b9..c50baa2b2 100644
--- a/src/kvirc/kernel/kvi_userinput.cpp
+++ b/src/kvirc/kernel/kvi_userinput.cpp
@@ -117,7 +117,7 @@ namespace KviUserInput
case KVI_WINDOW_TYPE_CONSOLE:
if(pWindow->connection())
{
- QCString data = pWindow->connection()->encodeText(buf);
+ KviQCString data = pWindow->connection()->encodeText(buf);
if(((KviConsole *)pWindow)->connection()->sendData(data.data()))
{
pWindow->output(KVI_OUT_RAW,"[RAW]: %Q",&buf);
diff --git a/src/kvirc/kernel/kvi_userinput.h b/src/kvirc/kernel/kvi_userinput.h
index f07bf3494..94faed47c 100644
--- a/src/kvirc/kernel/kvi_userinput.h
+++ b/src/kvirc/kernel/kvi_userinput.h
@@ -32,10 +32,10 @@ namespace KviUserInput
{
// WARNING: May destroy szData
// returns false if szData is a command and it fails to run
- KVIRC_API bool parse(QString &szData,KviWindow * pWindow,const QString &szContext = QString::null,bool bUserFriendlyCommandline = false);
+ KVIRC_API bool parse(QString &szData,KviWindow * pWindow,const QString &szContext = KviQString::empty,bool bUserFriendlyCommandline = false);
- KVIRC_API bool parseCommand(const QString &szData,KviWindow * pWindow,const QString &szContext = QString::null,bool bUserFriendlyCommandline = false);
- //bool parseCommandWithSingleArgument(const QString &szData,KviWindow * pWindow,const QString &szContext = QString::null);
+ KVIRC_API bool parseCommand(const QString &szData,KviWindow * pWindow,const QString &szContext = KviQString::empty,bool bUserFriendlyCommandline = false);
+ //bool parseCommandWithSingleArgument(const QString &szData,KviWindow * pWindow,const QString &szContext = KviQString::empty);
KVIRC_API void parseNonCommand(QString &szData,KviWindow * pWindow);
};
diff --git a/src/kvirc/kvs/kvi_kvs_corecallbackcommands.cpp b/src/kvirc/kvs/kvi_kvs_corecallbackcommands.cpp
index 69f0ac5c7..418098a6c 100644
--- a/src/kvirc/kvs/kvi_kvs_corecallbackcommands.cpp
+++ b/src/kvirc/kvs/kvi_kvs_corecallbackcommands.cpp
@@ -349,7 +349,7 @@ namespace KviKvsCoreCallbackCommands
KVSCCC_REQUIRE_CONNECTION
- QCString szN = KVSCCC_pConnection->encodeText(szNick);
+ KviQCString szN = KVSCCC_pConnection->encodeText(szNick);
KviAsyncWhoisInfo * info = new KviAsyncWhoisInfo();
info->pCallback = new KviKvsScript(*KVSCCC_pCallback);
diff --git a/src/kvirc/kvs/kvi_kvs_corefunctions_gl.cpp b/src/kvirc/kvs/kvi_kvs_corefunctions_gl.cpp
index f5e4ed868..4c431fb8f 100644
--- a/src/kvirc/kvs/kvi_kvs_corefunctions_gl.cpp
+++ b/src/kvirc/kvs/kvi_kvs_corefunctions_gl.cpp
@@ -129,7 +129,7 @@ namespace KviKvsCoreFunctions
KviStr tmp1(szHex);
char * buf;
int len = tmp1.hexToBuffer(&buf,true);
- KVSCF_pRetBuffer->setString(QString(QCString(buf,len+1)));
+ KVSCF_pRetBuffer->setString(QString(KviQCString(buf,len+1)));
KviStr::freeBuffer(buf);
return true;
}
diff --git a/src/kvirc/kvs/kvi_kvs_coresimplecommands.cpp b/src/kvirc/kvs/kvi_kvs_coresimplecommands.cpp
index 9550ac65f..68415bfea 100644
--- a/src/kvirc/kvs/kvi_kvs_coresimplecommands.cpp
+++ b/src/kvirc/kvs/kvi_kvs_coresimplecommands.cpp
@@ -155,14 +155,14 @@ namespace KviKvsCoreSimpleCommands
QStringList sl = QStringList::split(QRegExp("[, ]+"),szTokens,false);
- QCString szFlags;
- QCString szTarget = KVSCSC_pConnection->encodeText(KVSCSC_pWindow->windowName());
- QCString szMessage;
+ KviQCString szFlags;
+ KviQCString szTarget = KVSCSC_pConnection->encodeText(KVSCSC_pWindow->windowName());
+ KviQCString szMessage;
int i = 0;
for(QStringList::Iterator it = sl.begin();it != sl.end();++it)
{
- QCString szTxt = KVSCSC_pConnection->encodeText(*it);
+ KviQCString szTxt = KVSCSC_pConnection->encodeText(*it);
if(!szTxt.isEmpty())
{
szFlags += flag;
@@ -223,8 +223,8 @@ namespace KviKvsCoreSimpleCommands
KVSCSC_REQUIRE_CONNECTION
- QCString txt = KVSCSC_pConnection->encodeText(szText);
- QCString cmd = KVSCSC_pConnection->encodeText(((KviKvsTreeNodeCommand *)(KVSCSC_pContext->defaultReportLocation()))->commandName());
+ KviQCString txt = KVSCSC_pConnection->encodeText(szText);
+ KviQCString cmd = KVSCSC_pConnection->encodeText(((KviKvsTreeNodeCommand *)(KVSCSC_pContext->defaultReportLocation()))->commandName());
if(!KVSCSC_pConnection->sendFmtData("%s %s",cmd.data(),txt.data() ? txt.data() : ""))
return KVSCSC_pContext->warningNoIrcConnection();
diff --git a/src/kvirc/kvs/kvi_kvs_coresimplecommands_af.cpp b/src/kvirc/kvs/kvi_kvs_coresimplecommands_af.cpp
index 8973b6db0..79293ef6e 100644
--- a/src/kvirc/kvs/kvi_kvs_coresimplecommands_af.cpp
+++ b/src/kvirc/kvs/kvi_kvs_coresimplecommands_af.cpp
@@ -46,6 +46,14 @@
#ifndef COMPILE_NO_X_BELL
#include "kvi_xlib.h" // XBell : THIS SHOULD BE INCLUDED AS LAST!
#include <unistd.h> // for usleep();
+
+ #ifdef COMPILE_USE_QT4
+ #include <qx11info_x11.h>
+ #define get_xdisplay QX11Info::display
+ #else
+ #define get_xdisplay qt_xdisplay
+ #endif
+
#endif
#include "kvi_tal_tooltip.h"
@@ -130,7 +138,7 @@ namespace KviKvsCoreSimpleCommands
++it;
}
} else {
- QCString szR = KVSCSC_pConnection->encodeText(szReason);
+ KviQCString szR = KVSCSC_pConnection->encodeText(szReason);
if(!(KVSCSC_pConnection->sendFmtData("AWAY :%s",szR.data())))
return KVSCSC_pContext->warningNoIrcConnection();
}
@@ -309,10 +317,12 @@ namespace KviKvsCoreSimpleCommands
#else
#ifndef COMPILE_NO_X_BELL
+
+
XKeyboardState st;
XKeyboardControl ctl;
- XGetKeyboardControl(qt_xdisplay(),&st);
+ XGetKeyboardControl(get_xdisplay(),&st);
unsigned long mask = KBBellPercent;
ctl.bell_percent = uVolume;
@@ -326,9 +336,9 @@ namespace KviKvsCoreSimpleCommands
ctl.bell_duration = duration;
mask |= KBBellDuration;
}
- XChangeKeyboardControl(qt_xdisplay(),mask,&ctl);
+ XChangeKeyboardControl(get_xdisplay(),mask,&ctl);
- XBell(qt_xdisplay(),100);
+ XBell(get_xdisplay(),100);
if(bSync)
{
@@ -340,7 +350,7 @@ namespace KviKvsCoreSimpleCommands
ctl.bell_duration = st.bell_duration;
ctl.bell_percent = st.bell_percent;
- XChangeKeyboardControl(qt_xdisplay(),mask,&ctl);
+ XChangeKeyboardControl(get_xdisplay(),mask,&ctl);
#endif //COMPILE_NO_X_BELL
#endif
@@ -509,8 +519,8 @@ namespace KviKvsCoreSimpleCommands
KviQString::appendFormatted(szCtcpData," %d.%d",tv.tv_sec,tv.tv_usec);
}
- QCString szT = KVSCSC_pConnection->encodeText(szTarget);
- QCString szD = KVSCSC_pConnection->encodeText(szCtcpData);
+ KviQCString szT = KVSCSC_pConnection->encodeText(szTarget);
+ KviQCString szD = KVSCSC_pConnection->encodeText(szCtcpData);
if(!(KVSCSC_pConnection->sendFmtData("%s %s :%c%s%c",
KVSCSC_pSwitches->find('n',"notice") ? "NOTICE" : "PRIVMSG",szT.data(),0x01,szD.data(),0x01)))
diff --git a/src/kvirc/kvs/kvi_kvs_coresimplecommands_gl.cpp b/src/kvirc/kvs/kvi_kvs_coresimplecommands_gl.cpp
index 187fec49e..68bb4332b 100644
--- a/src/kvirc/kvs/kvi_kvs_coresimplecommands_gl.cpp
+++ b/src/kvirc/kvs/kvi_kvs_coresimplecommands_gl.cpp
@@ -35,6 +35,10 @@
#include "kvi_ircconnectionserverinfo.h"
#include "kvi_locale.h"
+#ifdef COMPILE_USE_QT4
+ #include <q3mimefactory.h>
+#endif
+
namespace KviKvsCoreSimpleCommands
{
/*
@@ -133,8 +137,12 @@ namespace KviKvsCoreSimpleCommands
QString szOriginal = szTopic;
QString topik = szTopic;
+#ifdef COMPILE_USE_QT4
+ QStringList pl = Q3MimeSourceFactory::defaultFactory()->filePath();
+#else
QStringList pl = QMimeSourceFactory::defaultFactory()->filePath();
-
+#endif
+
bool bLowCaseTried = false;
bool bFound = KviFileUtils::fileExists(szTopic);
@@ -402,14 +410,14 @@ try_again:
}
szChans = slChans.join(",");
- QCString szEncodedChans = KVSCSC_pConnection->encodeText(szChans);
+ KviQCString szEncodedChans = KVSCSC_pConnection->encodeText(szChans);
if(szKeys.isEmpty())
{
if(!(KVSCSC_pConnection->sendFmtData("JOIN %s",szEncodedChans.data())))
return KVSCSC_pContext->warningNoIrcConnection();
} else {
- QCString szEncodedKeys = KVSCSC_pConnection->encodeText(szKeys);
+ KviQCString szEncodedKeys = KVSCSC_pConnection->encodeText(szKeys);
if(!(KVSCSC_pConnection->sendFmtData("JOIN %s %s",szEncodedChans.data(),szEncodedKeys.data())))
return KVSCSC_pContext->warningNoIrcConnection();
}
@@ -456,9 +464,9 @@ try_again:
return false;
}
- QCString szC = KVSCSC_pConnection->encodeText(KVSCSC_pWindow->target());
- QCString szU = KVSCSC_pConnection->encodeText(szUser);
- QCString szR = KVSCSC_pConnection->encodeText(szReason);
+ KviQCString szC = KVSCSC_pConnection->encodeText(KVSCSC_pWindow->target());
+ KviQCString szU = KVSCSC_pConnection->encodeText(szUser);
+ KviQCString szR = KVSCSC_pConnection->encodeText(szReason);
if(szR.isEmpty())
{
diff --git a/src/kvirc/kvs/kvi_kvs_coresimplecommands_mr.cpp b/src/kvirc/kvs/kvi_kvs_coresimplecommands_mr.cpp
index c5706c380..d633459e3 100644
--- a/src/kvirc/kvs/kvi_kvs_coresimplecommands_mr.cpp
+++ b/src/kvirc/kvs/kvi_kvs_coresimplecommands_mr.cpp
@@ -132,7 +132,7 @@ namespace KviKvsCoreSimpleCommands
KVSCSC_REQUIRE_CONNECTION
- QCString szTxt = KVSCSC_pConnection->encodeText(szText);
+ KviQCString szTxt = KVSCSC_pConnection->encodeText(szText);
if(!szTxt.isEmpty())
{
@@ -219,7 +219,7 @@ namespace KviKvsCoreSimpleCommands
KVSCSC_REQUIRE_CONNECTION
- QCString szData = KVSCSC_pConnection->encodeText(szNick);
+ KviQCString szData = KVSCSC_pConnection->encodeText(szNick);
if(!szData.data())szData = "";
if(!KVSCSC_pConnection->sendFmtData("NICK %s",szData.data()))
@@ -270,8 +270,8 @@ namespace KviKvsCoreSimpleCommands
KviWindow * w = KVSCSC_pConnection->findChannel(szTarget);
if(!w)w = KVSCSC_pConnection->findQuery(szTarget);
- QCString szT = KVSCSC_pConnection->encodeText(szTarget);
- QCString szD = w ? w->encodeText(szText) : KVSCSC_pConnection->encodeText(szText);
+ KviQCString szT = KVSCSC_pConnection->encodeText(szTarget);
+ KviQCString szD = w ? w->encodeText(szText) : KVSCSC_pConnection->encodeText(szText);
if(!szT.data())szT = ""; // encoding problems ?
if(!szD.data())szD = ""; // encoding problems ?
@@ -708,13 +708,13 @@ namespace KviKvsCoreSimpleCommands
}
}
- QCString szEncodedChans = KVSCSC_pConnection->encodeText(szChans);
+ KviQCString szEncodedChans = KVSCSC_pConnection->encodeText(szChans);
QStringList sl = QStringList::split(",",szChans);
if(!szMsg.isEmpty())
{
- QCString szText;
+ KviQCString szText;
if(sl.count() == 1)
{
// single chan , use channel encoding if possible
@@ -939,8 +939,8 @@ namespace KviKvsCoreSimpleCommands
if(w)w->ownMessage(szText);
else {
- QCString szT = KVSCSC_pConnection->encodeText(szTarget);
- QCString szD = w ? w->encodeText(szText) : KVSCSC_pConnection->encodeText(szText);
+ KviQCString szT = KVSCSC_pConnection->encodeText(szTarget);
+ KviQCString szD = w ? w->encodeText(szText) : KVSCSC_pConnection->encodeText(szText);
if(!szT.data())szT = ""; // encoding problems ?
if(!szD.data())szD = ""; // encoding problems ?
@@ -1168,7 +1168,7 @@ namespace KviKvsCoreSimpleCommands
KVSCSC_REQUIRE_CONNECTION
- QCString szData = KVSCSC_pConnection->encodeText(szRawCommand);
+ KviQCString szData = KVSCSC_pConnection->encodeText(szRawCommand);
if(!szData.data())szData = "";
if(!KVSCSC_pConnection->sendData(szData.data()))
@@ -1311,9 +1311,15 @@ namespace KviKvsCoreSimpleCommands
KVSCSC_PARAMETER("parameters",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,l)
KVSCSC_PARAMETERS_END
+#ifdef COMPILE_USE_QT4
+ QProcess proc;
+ proc.start(szCommand,l);
+ // FIXME: KVSCSC_pContext->warning(__tr2qs("Failed to execute command '%Q'"),&szCommand);
+#else
QProcess proc(szCommand);
for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) proc.addArgument(*it);
if(!proc.start())KVSCSC_pContext->warning(__tr2qs("Failed to execute command '%Q'"),&szCommand);
+#endif
return true;
}
};
diff --git a/src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp b/src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp
index a58aadadd..81b17db27 100644
--- a/src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp
+++ b/src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp
@@ -606,8 +606,8 @@ namespace KviKvsCoreSimpleCommands
}
}
- QCString szC = KVSCSC_pConnection->encodeText(szChannel);
- QCString szT = KVSCSC_pConnection->encodeText(szTopic);
+ KviQCString szC = KVSCSC_pConnection->encodeText(szChannel);
+ KviQCString szT = KVSCSC_pConnection->encodeText(szTopic);
if(szTopic.isEmpty())
{
if(!KVSCSC_pConnection->sendFmtData("TOPIC %s",szC.data()))
@@ -919,7 +919,7 @@ namespace KviKvsCoreSimpleCommands
KVSCSC_PARAMETER("nickname",KVS_PT_NONEMPTYSTRING,KVS_PF_APPENDREMAINING,szNick)
KVSCSC_PARAMETERS_END
- QCString szData = KVSCSC_pContext->window()->encodeText(szNick);
+ KviQCString szData = KVSCSC_pContext->window()->encodeText(szNick);
if(!KVSCSC_pContext->connection())return KVSCSC_pContext->warningNoIrcConnection();
if(!KVSCSC_pContext->connection()->sendFmtData("WHOIS %s",szData.data()))return KVSCSC_pContext->warningNoIrcConnection();
@@ -959,7 +959,7 @@ namespace KviKvsCoreSimpleCommands
KVSCSC_PARAMETER("nickname",KVS_PT_NONEMPTYSTRING,KVS_PF_APPENDREMAINING,szNick)
KVSCSC_PARAMETERS_END
- QCString szData = KVSCSC_pContext->window()->encodeText(szNick);
+ KviQCString szData = KVSCSC_pContext->window()->encodeText(szNick);
if(!KVSCSC_pContext->connection())return KVSCSC_pContext->warningNoIrcConnection();
if(!KVSCSC_pContext->connection()->sendFmtData("WHOWAS %s",szData.data()))return KVSCSC_pContext->warningNoIrcConnection();
diff --git a/src/kvirc/kvs/kvi_kvs_object.cpp b/src/kvirc/kvs/kvi_kvs_object.cpp
index 57ae53798..fed2cd139 100644
--- a/src/kvirc/kvs/kvi_kvs_object.cpp
+++ b/src/kvirc/kvs/kvi_kvs_object.cpp
@@ -994,7 +994,10 @@ bool KviKvsObject::function_killTimer(KviKvsObjectFunctionCall * c)
bool KviKvsObject::function_killTimers(KviKvsObjectFunctionCall * c)
{
+ // FIXME: QT4 does not seem to have QObject::killTimers()
+#ifndef COMPILE_USE_QT4
killTimers();
+#endif
return true;
}
@@ -1016,18 +1019,27 @@ bool KviKvsObject::function_listProperties(KviKvsObjectFunctionCall * c)
kvs_int_t cnt = 0;
if(m_pObject)
{
- QMetaObject *o = m_pObject->metaObject();
+ const QMetaObject *o = m_pObject->metaObject();
if(!bArray)
w->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Properties for Qt class %s"),o->className());
while(o)
{
kvs_int_t idx = 0;
+#ifdef COMPILE_USE_QT4
+ QMetaProperty prop = o->property(idx);
+ const QMetaProperty *p = &prop;
+#else
const QMetaProperty *p = o->property(idx);
+#endif
while(p)
{
QString szOut;
QString szName = p->name();
+#ifdef COMPILE_USE_QT4
+ QString szType = p->typeName();
+#else
QString szType = p->type();
+#endif
if(bArray)
KviQString::sprintf(szOut,"%Q, %Q",&szName,&szType);
else {
@@ -1037,6 +1049,8 @@ bool KviKvsObject::function_listProperties(KviKvsObjectFunctionCall * c)
if(p->isEnumType())
{
szOut += ", enum(";
+#ifndef COMPILE_USE_QT4
+ // FIXME: Qt 4.x needs QMetaEnum for this loop
QStrList le = p->enumKeys();
int i = 0;
for(char *c2 = le.first(); c2; c2 = le.next())
@@ -1047,15 +1061,27 @@ bool KviKvsObject::function_listProperties(KviKvsObjectFunctionCall * c)
szOut.append(", ");
szOut.append(c2);
}
+#endif
szOut += ")";
}
+#ifdef COMPILE_USE_QT4
+ // FIXME: QT4 Need to read better the docs and check the changes: there seem to be too many
+ // for me to fix now. Actually I need to get the whole executable working...
+ if(p->isWritable())szOut += ", writable";
+#else
if(p->isSetType())szOut += ", set";
if(p->writable())szOut += ", writable";
+#endif
if(bArray)
a->set(cnt,new KviKvsVariant(szOut));
else
w->outputNoFmt(KVI_OUT_SYSTEMMESSAGE,szOut);
+#ifdef COMPILE_USE_QT4
+ prop = o->property(idx);
+ p = &prop;
+#else
p = o->property(idx);
+#endif
idx++;
cnt++;
}
@@ -1090,13 +1116,22 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c)
return true;
}
+#ifdef COMPILE_USE_QT4
+ int idx = m_pObject->metaObject()->indexOfProperty(szName);
+#else
int idx = m_pObject->metaObject()->findProperty(szName,true);
+#endif
if(idx < 0)
{
c->warning(__tr2qs("No Qt property named \"%Q\" for object named \"%Q\" of class %Q"),&szName,&m_szName,&(m_pClass->name()));
return true;
}
+#ifdef COMPILE_USE_QT4
+ QMetaProperty prop = m_pObject->metaObject()->property(idx);
+ const QMetaProperty * p = &prop;
+#else
const QMetaProperty * p = m_pObject->metaObject()->property(idx,true);
+#endif
if(!p)
{
c->warning(__tr2qs("Can't find property named \"%Q\" for object named \"%Q\" of class %Q: the property is indexed but it doesn't really exist"),&szName,&m_szName,&(m_pClass->name()));
@@ -1114,7 +1149,11 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c)
{
QString szKey;
v->asString(szKey);
+#ifdef COMPILE_USE_QT4
+ int val = p->enumerator().keyToValue(szKey);
+#else
int val = p->keyToValue(szKey);
+#endif
QVariant var(val);
m_pObject->setProperty(szName,var);
return true;
@@ -1198,6 +1237,8 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c)
m_pObject->setProperty(szName,QVariant(QRect(iX,iY,iW,iH)));
}
break;
+#ifndef COMPILE_USE_QT4
+ // FIXME: QT4 ????
case QVariant::Color:
{
if(!v->isArray())WRONG_TYPE("array(integer,integer,integer)")
@@ -1276,6 +1317,7 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c)
}
}
break;
+#endif
default:
c->warning(__tr2qs("Property \"%Q\" for object named \"%Q\" of class %Q has an unsupported data type"),&szName,&m_szName,&(m_pClass->name()));
c->returnValue()->setNothing();
@@ -1305,7 +1347,11 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c)
return true;
}
+#ifdef COMPILE_USE_QT4
+ int idx = m_pObject->metaObject()->indexOfProperty(szName);
+#else
int idx = m_pObject->metaObject()->findProperty(szName,true);
+#endif
if(idx < 0)
{
if (bNoerror) c->returnValue()->setString("No Qt properties");
@@ -1316,7 +1362,12 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c)
}
return true;
}
+#ifdef COMPILE_USE_QT4
+ QMetaProperty prop = m_pObject->metaObject()->property(idx);
+ const QMetaProperty * p = &prop;
+#else
const QMetaProperty * p = m_pObject->metaObject()->property(idx,true);
+#endif
if(!p)
{
c->warning(__tr2qs("Can't find property named \"%Q\" for object named \"%Q\" of class %Q: the property is indexed but it doesn't really exist"),&szName,&m_szName,&(m_pClass->name()));
@@ -1334,7 +1385,11 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c)
if(p->isEnumType())
{
+#ifdef COMPILE_USE_QT4
+ c->returnValue()->setString(p->enumerator().valueToKey(v.toInt()));
+#else
c->returnValue()->setString(p->valueToKey(v.toInt()));
+#endif
return true;
}
@@ -1384,6 +1439,8 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c)
c->returnValue()->setArray(a);
}
break;
+#ifndef COMPILE_USE_QT4
+ // FIXME: QT4 ?
case QVariant::Color:
{
QColor clr = v.toColor();
@@ -1411,6 +1468,7 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c)
c->returnValue()->setString(szFlags);
}
break;
+#endif
default:
if (bNoerror) c->returnValue()->setString("Unsupported_data_type");
else
diff --git a/src/kvirc/kvs/kvi_kvs_parameterprocessor.cpp b/src/kvirc/kvs/kvi_kvs_parameterprocessor.cpp
index 0f7fbbeb0..1f8b1ba54 100644
--- a/src/kvirc/kvs/kvi_kvs_parameterprocessor.cpp
+++ b/src/kvirc/kvs/kvi_kvs_parameterprocessor.cpp
@@ -77,7 +77,7 @@ namespace KviKvsParameterProcessor
break;
case KVS_PT_CSTRING:
case KVS_PT_NONEMPTYCSTRING:
- *((QCString *)(pFmtArray->pContainer)) = 0;
+ *((KviQCString *)(pFmtArray->pContainer)) = 0;
break;
case KVS_PT_STRINGLIST:
((QStringList *)(pFmtArray->pContainer))->clear();
@@ -246,14 +246,14 @@ namespace KviKvsParameterProcessor
v = pVariantList->next();
while(v)
{
- *((QCString *)(pFmtArray->pContainer)) += ' ';
+ *((KviQCString *)(pFmtArray->pContainer)) += ' ';
v->appendAsString(tmp);
v = pVariantList->next();
}
- *((QCString *)(pFmtArray->pContainer)) = tmp.utf8();
+ *((KviQCString *)(pFmtArray->pContainer)) = tmp.utf8();
return true;
}
- *((QCString *)(pFmtArray->pContainer)) = tmp.utf8();
+ *((KviQCString *)(pFmtArray->pContainer)) = tmp.utf8();
}
break;
case KVS_PT_NONEMPTYCSTRING:
@@ -266,15 +266,15 @@ namespace KviKvsParameterProcessor
v = pVariantList->next();
while(v)
{
- *((QCString *)(pFmtArray->pContainer)) += ' ';
+ *((KviQCString *)(pFmtArray->pContainer)) += ' ';
v->appendAsString(tmp);
v = pVariantList->next();
}
- *((QCString *)(pFmtArray->pContainer)) = tmp.utf8();
+ *((KviQCString *)(pFmtArray->pContainer)) = tmp.utf8();
bDoReturn = true;
}
- *((QCString *)(pFmtArray->pContainer)) = tmp.utf8();
- if(((QCString *)(pFmtArray->pContainer))->isEmpty())
+ *((KviQCString *)(pFmtArray->pContainer)) = tmp.utf8();
+ if(((KviQCString *)(pFmtArray->pContainer))->isEmpty())
{
QString szError;
KviQString::sprintf(szError,__tr2qs("Invalid data type for parameter \"%s\""),pFmtArray->szName);
diff --git a/src/kvirc/kvs/kvi_kvs_popupmenu.cpp b/src/kvirc/kvs/kvi_kvs_popupmenu.cpp
index f654115e8..fa820586a 100644
--- a/src/kvirc/kvs/kvi_kvs_popupmenu.cpp
+++ b/src/kvirc/kvs/kvi_kvs_popupmenu.cpp
@@ -324,7 +324,10 @@ void KviKvsPopupMenuItemLabel::fill(KviKvsPopupMenu * pMenu,KviKvsPopupMenuTopLe
}
m_pLabel = new QLabel(szText,pMenu);
QObject::connect(m_pLabel,SIGNAL(destroyed()),m_pSignalRelay,SLOT(labelDestroyed()));
+#ifndef COMPILE_USE_QT4
+ // FIXME: QT4 Seems to not allow widgets as QMenu items
pMenu->insertItem(m_pLabel);
+#endif
m_pLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
if(pPix)m_pLabel->setPixmap(*pPix);
}
diff --git a/src/kvirc/kvs/kvi_kvs_timermanager.cpp b/src/kvirc/kvs/kvi_kvs_timermanager.cpp
index 05bd28606..d965bf2e6 100644
--- a/src/kvirc/kvs/kvi_kvs_timermanager.cpp
+++ b/src/kvirc/kvs/kvi_kvs_timermanager.cpp
@@ -70,7 +70,7 @@ KviKvsTimerManager * KviKvsTimerManager::m_pInstance = 0;
KviKvsTimerManager::KviKvsTimerManager()
: QObject()
{
- m_pTimerDictById = new QIntDict<KviKvsTimer>(17);
+ m_pTimerDictById = new KviIntDict<KviKvsTimer>(17);
m_pTimerDictById->setAutoDelete(false);
m_pTimerDictByName = new KviDict<KviKvsTimer>(17,false);
m_pTimerDictByName->setAutoDelete(false);
@@ -162,7 +162,7 @@ bool KviKvsTimerManager::deleteCurrentTimer()
void KviKvsTimerManager::deleteAllTimers()
{
if(m_pTimerDictById->isEmpty())return;
- QIntDictIterator<KviKvsTimer> it(*m_pTimerDictById);
+ KviIntDictIterator<KviKvsTimer> it(*m_pTimerDictById);
KviPtrList<KviKvsTimer> tl;
tl.setAutoDelete(false);
while(KviKvsTimer * t = it.current())
diff --git a/src/kvirc/kvs/kvi_kvs_timermanager.h b/src/kvirc/kvs/kvi_kvs_timermanager.h
index 60a2ab1a1..f7d17348e 100644
--- a/src/kvirc/kvs/kvi_kvs_timermanager.h
+++ b/src/kvirc/kvs/kvi_kvs_timermanager.h
@@ -29,7 +29,7 @@
#include "kvi_qstring.h"
#include <qobject.h>
-#include <qintdict.h>
+#include "kvi_intdict.h"
#include "kvi_dict.h"
#include "kvi_list.h"
@@ -92,7 +92,7 @@ protected: // it only can be created and destroyed by KviKvsTimerManager::init()
KviKvsTimerManager();
~KviKvsTimerManager();
private:
- QIntDict<KviKvsTimer> * m_pTimerDictById; // stored by id
+ KviIntDict<KviKvsTimer> * m_pTimerDictById; // stored by id
KviDict<KviKvsTimer> * m_pTimerDictByName; // stored by name
static KviKvsTimerManager * m_pInstance; // the one and only timer manager instance
KviPtrList<KviKvsTimer> * m_pKilledTimerList; // list of timers for that killing has been scheduled
diff --git a/src/kvirc/kvs/kvi_kvs_treenode_switchlist.cpp b/src/kvirc/kvs/kvi_kvs_treenode_switchlist.cpp
index 18b4e1aa7..a6639f79f 100644
--- a/src/kvirc/kvs/kvi_kvs_treenode_switchlist.cpp
+++ b/src/kvirc/kvs/kvi_kvs_treenode_switchlist.cpp
@@ -51,7 +51,7 @@ void KviKvsTreeNodeSwitchList::dump(const char * prefix)
debug("%s SwitchList",prefix);
if(m_pShortSwitchDict)
{
- QIntDictIterator<KviKvsTreeNodeData> it(*m_pShortSwitchDict);
+ KviIntDictIterator<KviKvsTreeNodeData> it(*m_pShortSwitchDict);
while(it.current())
{
QString tmp = prefix;
@@ -82,7 +82,7 @@ void KviKvsTreeNodeSwitchList::addShort(int iShortKey,KviKvsTreeNodeData * p)
{
if(!m_pShortSwitchDict)
{
- m_pShortSwitchDict = new QIntDict<KviKvsTreeNodeData>(11);
+ m_pShortSwitchDict = new KviIntDict<KviKvsTreeNodeData>(11);
m_pShortSwitchDict->setAutoDelete(true);
}
@@ -109,7 +109,7 @@ bool KviKvsTreeNodeSwitchList::evaluate(KviKvsRunTimeContext * c,KviKvsSwitchLis
if(m_pShortSwitchDict)
{
- QIntDictIterator<KviKvsTreeNodeData> it(*m_pShortSwitchDict);
+ KviIntDictIterator<KviKvsTreeNodeData> it(*m_pShortSwitchDict);
while(KviKvsTreeNodeData * d = it.current())
{
KviKvsVariant * v = new KviKvsVariant();
diff --git a/src/kvirc/kvs/kvi_kvs_treenode_switchlist.h b/src/kvirc/kvs/kvi_kvs_treenode_switchlist.h
index f5c0f512d..b7d954677 100644
--- a/src/kvirc/kvs/kvi_kvs_treenode_switchlist.h
+++ b/src/kvirc/kvs/kvi_kvs_treenode_switchlist.h
@@ -27,7 +27,7 @@
#include "kvi_settings.h"
#include "kvi_qstring.h"
-#include <qintdict.h>
+#include "kvi_intdict.h"
#include "kvi_dict.h"
#include "kvi_kvs_treenode_base.h"
@@ -42,7 +42,7 @@ public:
KviKvsTreeNodeSwitchList(const QChar * pLocation);
~KviKvsTreeNodeSwitchList();
public:
- QIntDict<KviKvsTreeNodeData> * m_pShortSwitchDict;
+ KviIntDict<KviKvsTreeNodeData> * m_pShortSwitchDict;
KviDict<KviKvsTreeNodeData> *m_pLongSwitchDict;
public:
void addShort(int iShortKey,KviKvsTreeNodeData * p);
diff --git a/src/kvirc/ui/kvi_actiondrawer.cpp b/src/kvirc/ui/kvi_actiondrawer.cpp
index 6b6b5b8a6..cefd7fd34 100644
--- a/src/kvirc/ui/kvi_actiondrawer.cpp
+++ b/src/kvirc/ui/kvi_actiondrawer.cpp
@@ -45,8 +45,8 @@
#define LVI_MINIMUM_TEXT_WIDTH 300
#define LVI_MINIMUM_CELL_WIDTH (LVI_MINIMUM_TEXT_WIDTH + LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER)
-KviActionDrawerPageListViewItem::KviActionDrawerPageListViewItem(QListView * v,KviAction * a)
-: QListViewItem(v,"")
+KviActionDrawerPageListViewItem::KviActionDrawerPageListViewItem(KviTalListView * v,KviAction * a)
+: KviTalListViewItem(v,"")
{
m_pListView = v;
setDragEnabled(true);
@@ -74,7 +74,7 @@ QString KviActionDrawerPageListViewItem::key(int,bool) const
void KviActionDrawerPageListViewItem::setup()
{
- QListViewItem::setup();
+ KviTalListViewItem::setup();
int iWidth = m_pListView->visibleWidth();
if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH;
iWidth -= LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER;
@@ -86,7 +86,7 @@ void KviActionDrawerPageListViewItem::setup()
void KviActionDrawerPageListViewItem::paintCell(QPainter * p,const QColorGroup & cg,int column,int width,int align)
{
- QListViewItem::paintCell(p,cg,column,width,align);
+ KviTalListViewItem::paintCell(p,cg,column,width,align);
//p->fillRect(QRect(0,0,width,height()),isSelected() ? cg.highlight() : cg.base());
p->drawPixmap(LVI_BORDER,LVI_BORDER,*m_pIcon);
int afterIcon = LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING;
diff --git a/src/kvirc/ui/kvi_actiondrawer.h b/src/kvirc/ui/kvi_actiondrawer.h
index 3ac85417d..386307742 100644
--- a/src/kvirc/ui/kvi_actiondrawer.h
+++ b/src/kvirc/ui/kvi_actiondrawer.h
@@ -37,16 +37,16 @@ class QPixmap;
class QSimpleRichText;
class KviAction;
-class KVIRC_API KviActionDrawerPageListViewItem : public QListViewItem
+class KVIRC_API KviActionDrawerPageListViewItem : public KviTalListViewItem
{
public:
- KviActionDrawerPageListViewItem(QListView * v,KviAction * a);
+ KviActionDrawerPageListViewItem(KviTalListView * v,KviAction * a);
~KviActionDrawerPageListViewItem();
protected:
QString m_szName;
QSimpleRichText * m_pText;
QPixmap * m_pIcon;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QString m_szKey;
public:
QPixmap * icon(){ return m_pIcon; };
diff --git a/src/kvirc/ui/kvi_cryptcontroller.cpp b/src/kvirc/ui/kvi_cryptcontroller.cpp
index bf86a5091..15085b0f3 100644
--- a/src/kvirc/ui/kvi_cryptcontroller.cpp
+++ b/src/kvirc/ui/kvi_cryptcontroller.cpp
@@ -47,8 +47,8 @@
extern KVIRC_API KviCryptEngineManager * g_pCryptEngineManager;
extern KVIRC_API KviModuleManager * g_pModuleManager;
- KviEngineListBoxItem::KviEngineListBoxItem(QListBox * lb,KviCryptEngineDescription * d,const char * modName)
- : QListBoxText(lb,d->szName)
+ KviEngineListBoxItem::KviEngineListBoxItem(KviTalListBox * lb,KviCryptEngineDescription * d,const char * modName)
+ : KviTalListBoxText(lb,d->szName)
{
m_szName = d->szName;
m_szAuthor = d->szAuthor;
@@ -96,8 +96,8 @@
g->addMultiCellWidget(m_pEnableCheck,2,2,0,3);
connect(m_pEnableCheck,SIGNAL(toggled(bool)),this,SLOT(enableCheckToggled(bool)));
- m_pListBox = new QListBox(this);
- connect(m_pListBox,SIGNAL(highlighted(QListBoxItem *)),this,SLOT(engineHighlighted(QListBoxItem *)));
+ m_pListBox = new KviTalListBox(this);
+ connect(m_pListBox,SIGNAL(highlighted(KviTalListBoxItem *)),this,SLOT(engineHighlighted(KviTalListBoxItem *)));
g->addMultiCellWidget(m_pListBox,3,8,0,0);
m_pDescriptionLabel = new QLabel(this);
@@ -147,7 +147,7 @@
if(cur)
{
- QListBoxItem * it = m_pListBox->findItem(cur->szEngineName.ptr());
+ KviTalListBoxItem * it = (KviTalListBoxItem *)m_pListBox->findItem(cur->szEngineName.ptr());
if(it)
{
m_pEnableCheck->setChecked(true);
@@ -191,7 +191,7 @@
noEnginesAvailable();
}
- void KviCryptController::engineHighlighted(QListBoxItem *it)
+ void KviCryptController::engineHighlighted(KviTalListBoxItem *it)
{
if(it)
{
diff --git a/src/kvirc/ui/kvi_cryptcontroller.h b/src/kvirc/ui/kvi_cryptcontroller.h
index 705508a04..bc1e41b63 100644
--- a/src/kvirc/ui/kvi_cryptcontroller.h
+++ b/src/kvirc/ui/kvi_cryptcontroller.h
@@ -30,7 +30,7 @@
#ifdef COMPILE_CRYPT_SUPPORT
#include <qwidget.h>
- #include <qlistbox.h>
+ #include "kvi_tal_listbox.h"
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qlabel.h>
@@ -53,11 +53,11 @@
};
- class KVIRC_API KviEngineListBoxItem : public QListBoxText
+ class KVIRC_API KviEngineListBoxItem : public KviTalListBoxText
{
friend class KviCryptController;
public:
- KviEngineListBoxItem(QListBox * lb,KviCryptEngineDescription * d,const char * modName);
+ KviEngineListBoxItem(KviTalListBox * lb,KviCryptEngineDescription * d,const char * modName);
~KviEngineListBoxItem();
public:
KviStr m_szName;
@@ -76,7 +76,7 @@
~KviCryptController();
protected:
KviWindow * m_pWindow;
- QListBox * m_pListBox;
+ KviTalListBox * m_pListBox;
QPushButton * m_pOkButton;
KviStyledCheckBox * m_pEnableCheck;
QLabel * m_pDescriptionLabel;
@@ -93,7 +93,7 @@
KviCryptSessionInfo * m_pSessionInfo;
private slots:
void enableCheckToggled(bool bChecked);
- void engineHighlighted(QListBoxItem *it);
+ void engineHighlighted(KviTalListBoxItem *it);
void okClicked();
public:
KviCryptSessionInfo * getNewSessionInfo();
diff --git a/src/kvirc/ui/kvi_historywin.cpp b/src/kvirc/ui/kvi_historywin.cpp
index 8743b36d2..1e6d98a89 100644
--- a/src/kvirc/ui/kvi_historywin.cpp
+++ b/src/kvirc/ui/kvi_historywin.cpp
@@ -38,7 +38,11 @@
extern KviInputHistory * g_pInputHistory;
KviHistoryWindow::KviHistoryWindow()
-:QListBox(0,"toplevel_history_window",Qt::WType_Popup)
+#ifdef COMPILE_USE_QT4
+: KviTalListBox(0,Qt::Popup)
+#else
+: KviTalListBox(0,Qt::WType_Popup)
+#endif
{
m_pOwner = 0;
setHScrollBarMode(QScrollView::AlwaysOff);
@@ -76,7 +80,7 @@ void KviHistoryWindow::mousePressEvent(QMouseEvent *e)
if(e->pos().y() < 0)goto hideme;
if(e->pos().y() > height())goto hideme;
- QListBox::mousePressEvent(e);
+ KviTalListBox::mousePressEvent(e);
return;
hideme:
@@ -126,7 +130,7 @@ void KviHistoryWindow::keyPressEvent(QKeyEvent *e)
case Qt::Key_PageUp:
case Qt::Key_PageDown:
case Qt::Key_Return:
- QListBox::keyPressEvent(e);
+ KviTalListBox::keyPressEvent(e);
return;
break;
case Qt::Key_Escape:
diff --git a/src/kvirc/ui/kvi_historywin.h b/src/kvirc/ui/kvi_historywin.h
index f119c5819..bc3c29a30 100644
--- a/src/kvirc/ui/kvi_historywin.h
+++ b/src/kvirc/ui/kvi_historywin.h
@@ -26,13 +26,13 @@
#include "kvi_settings.h"
#include "kvi_string.h"
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
class KviInput;
#define KVI_HISTORY_WIN_HEIGHT 130
-class KVIRC_API KviHistoryWindow : public QListBox
+class KVIRC_API KviHistoryWindow : public KviTalListBox
{
Q_OBJECT
public:
diff --git a/src/kvirc/ui/kvi_imagedialog.cpp b/src/kvirc/ui/kvi_imagedialog.cpp
index 637173a20..b379ad3db 100644
--- a/src/kvirc/ui/kvi_imagedialog.cpp
+++ b/src/kvirc/ui/kvi_imagedialog.cpp
@@ -41,12 +41,12 @@
#include "kvi_app.h"
-int KviImageDialogItem::height(const QListBox *lb) const
+int KviImageDialogItem::height(const KviTalListBox *lb) const
{
return pixmap()->height() + 12 + lb->fontMetrics().lineSpacing();
}
-int KviImageDialogItem::width(const QListBox *lb) const
+int KviImageDialogItem::width(const KviTalListBox *lb) const
{
int w;
if(text().isEmpty())w = 24;
@@ -146,9 +146,9 @@ KviImageDialog::KviImageDialog(QWidget * par,
g->addMultiCellWidget(l,1,1,0,2);
- m_pListBox = new QListBox(this);
- m_pListBox->setColumnMode(QListBox::FitToWidth);
- m_pListBox->setRowMode(QListBox::Variable);
+ m_pListBox = new KviTalListBox(this);
+ m_pListBox->setColumnMode(KviTalListBox::FitToWidth);
+ m_pListBox->setRowMode(KviTalListBox::Variable);
m_pTip = new KviDynamicToolTip(m_pListBox->viewport());
@@ -166,7 +166,7 @@ KviImageDialog::KviImageDialog(QWidget * par,
g->setColStretch(0,1);
connect(m_pTypeComboBox,SIGNAL(activated(int)),this,SLOT(jobTypeSelected(int)));
- connect(m_pListBox,SIGNAL(doubleClicked(QListBoxItem *)),this,SLOT(itemDoubleClicked(QListBoxItem *)));
+ connect(m_pListBox,SIGNAL(doubleClicked(KviTalListBoxItem *)),this,SLOT(itemDoubleClicked(KviTalListBoxItem *)));
connect(m_pTip,SIGNAL(tipRequest(KviDynamicToolTip *,const QPoint &)),this,SLOT(tipRequest(KviDynamicToolTip *,const QPoint &)));
m_pTypeComboBox->setCurrentItem(idx);
@@ -314,9 +314,9 @@ void KviImageDialog::heartbeat()
void KviImageDialog::okClicked()
{
- QListBoxItem * it = 0;
+ KviTalListBoxItem * it = 0;
int idx = m_pListBox->currentItem();
- if(idx != -1)it = m_pListBox->item(idx);
+ if(idx != -1)it = (KviTalListBoxItem *)m_pListBox->item(idx);
if(!it)return;
itemDoubleClicked(it);
}
@@ -333,7 +333,7 @@ void KviImageDialog::closeEvent(QCloseEvent * e)
QDialog::closeEvent(e);
}
-void KviImageDialog::itemDoubleClicked(QListBoxItem * it)
+void KviImageDialog::itemDoubleClicked(KviTalListBoxItem * it)
{
if(!it)return;
KviImageDialogItem * i = (KviImageDialogItem *)it;
@@ -355,7 +355,7 @@ void KviImageDialog::itemDoubleClicked(QListBoxItem * it)
void KviImageDialog::tipRequest(KviDynamicToolTip *,const QPoint &pnt)
{
- QListBoxItem * it = m_pListBox->itemAt(pnt);
+ KviTalListBoxItem * it = (KviTalListBoxItem *)m_pListBox->itemAt(pnt);
if(!it)return;
QRect r = m_pListBox->itemRect(it);
KviImageDialogItem * i = (KviImageDialogItem *)it;
diff --git a/src/kvirc/ui/kvi_imagedialog.h b/src/kvirc/ui/kvi_imagedialog.h
index ae5905225..3ffd44287 100644
--- a/src/kvirc/ui/kvi_imagedialog.h
+++ b/src/kvirc/ui/kvi_imagedialog.h
@@ -29,29 +29,29 @@
#include <qdialog.h>
#include <qcombobox.h>
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
#include <qvaluelist.h>
#include <qtimer.h>
#include <qstringlist.h>
#include "kvi_dynamictooltip.h"
-class KviImageDialogItem : public QListBoxPixmap
+class KviImageDialogItem : public KviTalListBoxPixmap
{
public:
bool m_bIsFolder;
QString m_szImageId;
QString m_szTipText;
public:
- KviImageDialogItem(QListBox * b,const QPixmap &thumb,const QString &szFile,const QString &image_id,const QString &szTipText = QString::null,bool bIsFolder = false)
- : QListBoxPixmap(b,thumb,szFile) , m_bIsFolder(bIsFolder) , m_szImageId(image_id) , m_szTipText(szTipText) {};
+ KviImageDialogItem(KviTalListBox * b,const QPixmap &thumb,const QString &szFile,const QString &image_id,const QString &szTipText = QString::null,bool bIsFolder = false)
+ : KviTalListBoxPixmap(b,thumb,szFile) , m_bIsFolder(bIsFolder) , m_szImageId(image_id) , m_szTipText(szTipText) {};
~KviImageDialogItem(){};
public:
bool isFolder(){ return m_bIsFolder; };
const QString & imageId(){ return m_szImageId; };
const QString & tipText(){ return m_szTipText; };
- virtual int height(const QListBox *) const;
- virtual int width(const QListBox *) const;
+ virtual int height(const KviTalListBox *) const;
+ virtual int width(const KviTalListBox *) const;
virtual void paint(QPainter * p);
};
@@ -75,7 +75,7 @@ public:
protected:
QComboBox * m_pTypeComboBox;
QValueList<int> * m_pTypeList;
- QListBox * m_pListBox;
+ KviTalListBox * m_pListBox;
QTimer * m_pTimer;
int m_iJobType;
@@ -102,7 +102,7 @@ protected slots:
void cancelClicked();
void heartbeat();
void jobTypeSelected(int index);
- void itemDoubleClicked(QListBoxItem * it);
+ void itemDoubleClicked(KviTalListBoxItem * it);
void tipRequest(KviDynamicToolTip *,const QPoint &pnt);
};
diff --git a/src/kvirc/ui/kvi_input.cpp b/src/kvirc/ui/kvi_input.cpp
index 0cf46032c..a0ebe8c7b 100644
--- a/src/kvirc/ui/kvi_input.cpp
+++ b/src/kvirc/ui/kvi_input.cpp
@@ -326,16 +326,15 @@ void KviInputEditor::drawContents(QPainter *p)
pa.drawTiledPixmap(0,0,widgetWidth,widgetHeight,*g_pShadedChildGlobalDesktopBackground,pnt.x(),pnt.y());
} else {
#endif
- pa.fillRect(0,0,widgetWidth,widgetHeight,KVI_OPTION_COLOR(KviOption_colorInputBackground));
+ QPixmap *pix=KVI_OPTION_PIXMAP(KviOption_pixmapInputBackground).pixmap();
+
+ if(pix)
+ KviPixmapUtils::drawPixmapWithPainter(&pa,pix,(Qt::AlignmentFlags)(KVI_OPTION_UINT(KviOption_uintInputPixmapAlign)),QRect(0,0,widgetWidth,widgetHeight),widgetWidth,widgetHeight);
+ else
+ pa.fillRect(0,0,widgetWidth,widgetHeight,KVI_OPTION_COLOR(KviOption_colorInputBackground));
#ifdef COMPILE_PSEUDO_TRANSPARENCY
}
#endif
- QPixmap *pix=KVI_OPTION_PIXMAP(KviOption_pixmapInputBackground).pixmap();
-
- if(pix)
- {
- KviPixmapUtils::drawPixmapWithPainter(&pa,pix,(Qt::AlignmentFlags)(KVI_OPTION_UINT(KviOption_uintInputPixmapAlign)),QRect(0,0,widgetWidth,widgetHeight),widgetWidth,widgetHeight);
- }
diff --git a/src/kvirc/ui/kvi_input.h b/src/kvirc/ui/kvi_input.h
index 9e761c6a7..e9c879c43 100644
--- a/src/kvirc/ui/kvi_input.h
+++ b/src/kvirc/ui/kvi_input.h
@@ -70,6 +70,9 @@ public:
void load(const char * filename);
};
+#ifdef COMPILE_USE_QT4
+ #define QIMEvent QInputMethodEvent
+#endif
class KVIRC_API KviInputEditor : public QFrame
{
diff --git a/src/kvirc/ui/kvi_ircview.cpp b/src/kvirc/ui/kvi_ircview.cpp
index d2dd58362..466b7296a 100644
--- a/src/kvirc/ui/kvi_ircview.cpp
+++ b/src/kvirc/ui/kvi_ircview.cpp
@@ -2761,18 +2761,19 @@ void KviIrcView::paintEvent(QPaintEvent *p)
pa.drawTiledPixmap(rectLeft,rectTop,rectWidth,rectHeight,*g_pShadedChildGlobalDesktopBackground,pnt.x(),pnt.y());
} else {
#endif
- pa.fillRect(rectLeft,rectTop,rectWidth,rectHeight,KVI_OPTION_COLOR(KviOption_colorIrcViewBackground));
+ QPixmap * pix = m_pPrivateBackgroundPixmap;
+
+ if(!pix)
+ pix = KVI_OPTION_PIXMAP(KviOption_pixmapIrcViewBackground).pixmap();
+
+ if(pix)
+ KviPixmapUtils::drawPixmapWithPainter(&pa,pix,(Qt::AlignmentFlags)(KVI_OPTION_UINT(KviOption_uintIrcViewPixmapAlign)),r,widgetWidth,widgetHeight);
+ else
+ pa.fillRect(rectLeft,rectTop,rectWidth,rectHeight,KVI_OPTION_COLOR(KviOption_colorIrcViewBackground));
#ifdef COMPILE_PSEUDO_TRANSPARENCY
}
#endif
- QPixmap *pix=m_pPrivateBackgroundPixmap;
- if(!pix) pix=KVI_OPTION_PIXMAP(KviOption_pixmapIrcViewBackground).pixmap();
-
- if(pix)
- {
- KviPixmapUtils::drawPixmapWithPainter(&pa,pix,(Qt::AlignmentFlags)(KVI_OPTION_UINT(KviOption_uintIrcViewPixmapAlign)),r,widgetWidth,widgetHeight);
- }
pa.setFont(font());
diff --git a/src/kvirc/ui/kvi_ircviewtools.cpp b/src/kvirc/ui/kvi_ircviewtools.cpp
index 8fe2c62db..c2691cc09 100644
--- a/src/kvirc/ui/kvi_ircviewtools.cpp
+++ b/src/kvirc/ui/kvi_ircviewtools.cpp
@@ -54,7 +54,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-KviIrcMessageCheckListItem::KviIrcMessageCheckListItem(QListView * par,KviIrcViewToolWidget * w,int id)
+KviIrcMessageCheckListItem::KviIrcMessageCheckListItem(KviTalListView * par,KviIrcViewToolWidget * w,int id)
: QCheckListItem(par,QString::null,QCheckListItem::CheckBox)
{
m_iId = id;
@@ -143,7 +143,7 @@ KviIrcViewToolWidget::KviIrcViewToolWidget(KviIrcView * par)
g = new QGridLayout(w1,5,2,2,1);
- m_pFilterView = new QListView(w1);
+ m_pFilterView = new KviTalListView(w1);
m_pFilterView->addColumn(__tr2qs("Type"));
m_pFilterView->header()->hide();
m_pFilterView->setMinimumSize(QSize(10,10));
diff --git a/src/kvirc/ui/kvi_ircviewtools.h b/src/kvirc/ui/kvi_ircviewtools.h
index 57b29b4b0..80d0e36a2 100644
--- a/src/kvirc/ui/kvi_ircviewtools.h
+++ b/src/kvirc/ui/kvi_ircviewtools.h
@@ -28,7 +28,7 @@
#include "kvi_tal_tooltip.h"
#include <qframe.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qstring.h>
class QLabel;
@@ -59,7 +59,7 @@ class KviIrcViewToolWidget;
class KviIrcMessageCheckListItem : public QCheckListItem
{
public:
- KviIrcMessageCheckListItem(QListView * par,KviIrcViewToolWidget * w,int id);
+ KviIrcMessageCheckListItem(KviTalListView * par,KviIrcViewToolWidget * w,int id);
~KviIrcMessageCheckListItem();
private:
int m_iId;
@@ -93,7 +93,7 @@ protected:
QLabel * m_pFindResult;
- QListView * m_pFilterView;
+ KviTalListView * m_pFilterView;
KviIrcMessageCheckListItem ** m_pFilterItems;
diff --git a/src/kvirc/ui/kvi_listview.cpp b/src/kvirc/ui/kvi_listview.cpp
index 29a798110..6dea4b02e 100644
--- a/src/kvirc/ui/kvi_listview.cpp
+++ b/src/kvirc/ui/kvi_listview.cpp
@@ -27,15 +27,13 @@
#include "kvi_listview.h"
-
-#include <qlistview.h>
#include <qpainter.h>
#include <qpixmap.h>
#include "kvi_doublebuffer.h"
-KviListView::KviListView( QWidget * parent, const char * name, WFlags f)
-:QListView(parent,name,f)
+KviListView::KviListView( QWidget * parent, const char * name)
+:KviTalListView(parent)
{
m_pBackgroundOverlayPixmap=0;
m_iBackgroundOverlayAlignment=Qt::AlignAuto;
@@ -62,7 +60,7 @@ void KviListView::drawContentsOffset(QPainter * p,int ox,int oy,int cx,int cy,in
{
if(!m_pBackgroundOverlayPixmap)
{
- QListView::drawContentsOffset(p,ox,oy,cx,cy,cw,ch);
+ KviTalListView::drawContentsOffset(p,ox,oy,cx,cy,cw,ch);
return;
}
@@ -80,7 +78,7 @@ void KviListView::drawContentsOffset(QPainter * p,int ox,int oy,int cx,int cy,in
pa.fillRect(QRect(xx,yy,cw,ch),viewport()->backgroundColor());
- //QListView::paintEmptyArea(&pa,);
+ //KviTalListView::paintEmptyArea(&pa,);
// compute the pixmap position
int x,y;
@@ -122,12 +120,12 @@ void KviListView::drawContentsOffset(QPainter * p,int ox,int oy,int cx,int cy,in
// widget we screw it even more just because our paintEmptyArea()
// does nothing and we do double buffering ourselves.
- QListView::drawContentsOffset(&pa,ox,oy,cx,cy,cw,ch);
+ KviTalListView::drawContentsOffset(&pa,ox,oy,cx,cy,cw,ch);
p->drawPixmap(xx,yy,*pMemPixmap,xx,yy,cw,ch);
//p->drawPixmap(cx-ox,cy-oy,*pMemPixmap,0,0,cw,ch);
- //QListView::drawContentsOffset(p,ox,oy,cx,cy,cw,ch);
+ //KviTalListView::drawContentsOffset(p,ox,oy,cx,cy,cw,ch);
}
@@ -135,7 +133,7 @@ void KviListView::paintEmptyArea(QPainter * p,const QRect & rect)
{
if(!m_pBackgroundOverlayPixmap)
{
- QListView::paintEmptyArea(p,rect);
+ KviTalListView::paintEmptyArea(p,rect);
return;
}
@@ -150,7 +148,7 @@ void KviListView::paintEmptyArea(QPainter * p,const QRect & rect)
pa.fillRect(rect,viewport()->backgroundColor());
- QListView::paintEmptyArea(&pa,rect);
+ KviTalListView::paintEmptyArea(&pa,rect);
QPoint realTopLeft = p->xForm(rect.topLeft());
@@ -186,7 +184,7 @@ void KviListView::paintEmptyArea(QPainter * p,const QRect & rect)
void KviListView::resizeEvent(QResizeEvent * e)
{
- QListView::resizeEvent(e);
+ KviTalListView::resizeEvent(e);
if(m_pBackgroundOverlayPixmap)
repaintContents(); // force a full repaint (otherwise qt does not honor static background here)
}
@@ -195,14 +193,14 @@ void KviListView::resizeEvent(QResizeEvent * e)
void KviListView::focusInEvent(QFocusEvent * e)
{
- QListView::focusInEvent(e);
+ KviTalListView::focusInEvent(e);
if(m_pBackgroundOverlayPixmap)
repaintContents();
}
void KviListView::focusOutEvent(QFocusEvent * e)
{
- QListView::focusOutEvent(e);
+ KviTalListView::focusOutEvent(e);
if(m_pBackgroundOverlayPixmap)
repaintContents();
}
diff --git a/src/kvirc/ui/kvi_listview.h b/src/kvirc/ui/kvi_listview.h
index c5335548a..ee194d48d 100644
--- a/src/kvirc/ui/kvi_listview.h
+++ b/src/kvirc/ui/kvi_listview.h
@@ -28,15 +28,15 @@
#include "kvi_heapobject.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
class QPainter;
-class KVIRC_API KviListView : public QListView
+class KVIRC_API KviListView : public KviTalListView
{
Q_OBJECT
public:
- KviListView( QWidget * parent = 0, const char * name = 0, WFlags f = 0 );
+ KviListView( QWidget * parent = 0, const char * name = 0);
~KviListView();
protected:
QPixmap * m_pBackgroundOverlayPixmap;
diff --git a/src/kvirc/ui/kvi_maskeditor.cpp b/src/kvirc/ui/kvi_maskeditor.cpp
index e553458e4..bc1116dde 100644
--- a/src/kvirc/ui/kvi_maskeditor.cpp
+++ b/src/kvirc/ui/kvi_maskeditor.cpp
@@ -36,8 +36,8 @@
#include <qlabel.h>
#include <qvalidator.h>
-KviMaskItem::KviMaskItem(QListView* parent,KviMaskEntry* entry)
-:QListViewItem(parent), m_Mask(*entry)
+KviMaskItem::KviMaskItem(KviTalListView* parent,KviMaskEntry* entry)
+:KviTalListViewItem(parent), m_Mask(*entry)
{
QDateTime date;
date.setTime_t(mask()->uSetAt);
@@ -50,7 +50,7 @@ KviMaskItem::~KviMaskItem()
{
}
-int KviMaskItem::compare ( QListViewItem * i, int col, bool ascending ) const
+int KviMaskItem::compare ( KviTalListViewItem * i, int col, bool ascending ) const
{
if(col==2)
{
@@ -58,7 +58,7 @@ int KviMaskItem::compare ( QListViewItem * i, int col, bool ascending ) const
if( ((KviMaskItem*)i)->mask()->uSetAt == m_Mask.uSetAt ) return 0;
if( ((KviMaskItem*)i)->mask()->uSetAt < m_Mask.uSetAt ) return 1;
}
- return QListViewItem::compare(i,col,ascending);
+ return KviTalListViewItem::compare(i,col,ascending);
}
KviMaskInputDialog::KviMaskInputDialog(const QString &szMask,KviMaskEditor* pEditor,KviChannel * pChannel)
@@ -175,7 +175,7 @@ KviMaskEditor::KviMaskEditor(QWidget * par,KviWindowToolPageButton* button,KviPt
g->addWidget(l,0,1);
g->addMultiCellWidget(l,1,1,0,1);
- m_pMaskBox = new QListView(this);
+ m_pMaskBox = new KviTalListView(this);
m_pMaskBox->setFocusPolicy(QWidget::ClickFocus);
m_pMaskBox->setFocusProxy(this);
m_pMaskBox->setFrameStyle(QFrame::StyledPanel|QFrame::Sunken);
@@ -186,7 +186,7 @@ KviMaskEditor::KviMaskEditor(QWidget * par,KviWindowToolPageButton* button,KviPt
m_pMaskBox->setAllColumnsShowFocus(true);
m_pMaskBox->setShowSortIndicator(true);
m_pMaskBox->setSorting(2,false);
- connect(m_pMaskBox,SIGNAL(doubleClicked ( QListViewItem * )),this,SLOT(listViewDoubleClicked( QListViewItem * )));
+ connect(m_pMaskBox,SIGNAL(doubleClicked ( KviTalListViewItem * )),this,SLOT(listViewDoubleClicked( KviTalListViewItem * )));
g->addMultiCellWidget(m_pMaskBox,2,2,0,1);
m_pRemoveMask = new QPushButton(__tr2qs("Re&move"),this);
@@ -278,7 +278,7 @@ void KviMaskEditor::removeMask(KviMaskEntry *e)
}
}
-void KviMaskEditor::listViewDoubleClicked( QListViewItem * pItem)
+void KviMaskEditor::listViewDoubleClicked( KviTalListViewItem * pItem)
{
if(pItem)
{
diff --git a/src/kvirc/ui/kvi_maskeditor.h b/src/kvirc/ui/kvi_maskeditor.h
index 5dab7af4e..45ed1b629 100644
--- a/src/kvirc/ui/kvi_maskeditor.h
+++ b/src/kvirc/ui/kvi_maskeditor.h
@@ -27,7 +27,7 @@
#include <qdialog.h>
#include <qlineedit.h>
#include <qwidget.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qpushbutton.h>
#include "kvi_list.h"
@@ -44,15 +44,15 @@ typedef struct _KviMaskEntry
unsigned int uSetAt;
} KviMaskEntry;
-class KviMaskItem: public QListViewItem
+class KviMaskItem: public KviTalListViewItem
{
public:
- KviMaskItem(QListView* parent,KviMaskEntry* entry);
+ KviMaskItem(KviTalListView* parent,KviMaskEntry* entry);
~KviMaskItem();
KviMaskEntry* mask() { return &m_Mask; };
- virtual int compare ( QListViewItem * i, int col, bool ascending ) const;
+ virtual int compare ( KviTalListViewItem * i, int col, bool ascending ) const;
protected:
KviMaskEntry m_Mask;
@@ -83,7 +83,7 @@ public:
char flag,const char * nam);
~KviMaskEditor();
protected:
- QListView * m_pMaskBox;
+ KviTalListView * m_pMaskBox;
QPushButton * m_pRemoveMask;
QPushButton * m_pAddButton;
char m_cFlag;
@@ -95,7 +95,7 @@ public:
protected slots:
void removeClicked();
void addClicked();
- void listViewDoubleClicked( QListViewItem * );
+ void listViewDoubleClicked( KviTalListViewItem * );
signals:
void removeMasks(KviMaskEditor *,KviPtrList<KviMaskEntry> *);
};
diff --git a/src/kvirc/ui/kvi_mdimanager.cpp b/src/kvirc/ui/kvi_mdimanager.cpp
index 6c690ac8f..46c163c78 100644
--- a/src/kvirc/ui/kvi_mdimanager.cpp
+++ b/src/kvirc/ui/kvi_mdimanager.cpp
@@ -54,7 +54,7 @@
KviMdiManager::KviMdiManager(QWidget * parent,KviFrame * pFrm,const char * name)
-: QScrollView(parent,name)
+: KviTalScrollView(parent)
{
setFrameShape(NoFrame);
m_pZ = new KviPtrList<KviMdiChild>;
diff --git a/src/kvirc/ui/kvi_mdimanager.h b/src/kvirc/ui/kvi_mdimanager.h
index 7133eb621..201d6bd26 100644
--- a/src/kvirc/ui/kvi_mdimanager.h
+++ b/src/kvirc/ui/kvi_mdimanager.h
@@ -31,9 +31,10 @@
#include <qwidget.h>
#include <qframe.h>
#include <qpixmap.h>
-#include <qscrollview.h>
#include <qtoolbutton.h>
+#include "kvi_tal_scrollview.h"
+
#define KVI_MDICHILD_BORDER 4
#define KVI_MDICHILD_SPACING 2
#define KVI_MDICHILD_MIN_WIDTH 100
@@ -53,7 +54,7 @@ class KviTalPopupMenu;
class KviSdiButtonBox;
class KviMenuBarToolButton;
-class KVIRC_API KviMdiManager : public QScrollView
+class KVIRC_API KviMdiManager : public KviTalScrollView
{
friend class KviMdiChild;
friend class KviMdiCaption;
diff --git a/src/kvirc/ui/kvi_selectors.cpp b/src/kvirc/ui/kvi_selectors.cpp
index 289729473..a0ef190d5 100644
--- a/src/kvirc/ui/kvi_selectors.cpp
+++ b/src/kvirc/ui/kvi_selectors.cpp
@@ -393,7 +393,7 @@ KviStringListSelector::KviStringListSelector(QWidget * par,const QString & txt,Q
: KviTalVBox(par), KviSelectorInterface()
{
m_pLabel = new QLabel(txt,this);
- m_pListBox = new QListBox(this);
+ m_pListBox = new KviTalListBox(this);
m_pLineEdit = new QLineEdit(this);
connect(m_pLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(textChanged(const QString &)));
connect(m_pLineEdit,SIGNAL(returnPressed()),this,SLOT(addClicked()));
@@ -404,7 +404,7 @@ KviStringListSelector::KviStringListSelector(QWidget * par,const QString & txt,Q
connect(m_pRemoveButton,SIGNAL(clicked()),this,SLOT(removeClicked()));
m_pOption = pOption;
m_pListBox->insertStringList(*pOption);
- m_pListBox->setSelectionMode(QListBox::Extended);
+ m_pListBox->setSelectionMode(KviTalListBox::Extended);
connect(m_pListBox,SIGNAL(selectionChanged()),this,SLOT(selectionChanged()));
setSpacing(4);
setStretchFactor(m_pListBox,1);
@@ -719,8 +719,8 @@ void KviSoundSelector::setEnabled(bool bEnabled)
m_pPlayButton->setEnabled(bEnabled);
}
-KviChanListViewItem::KviChanListViewItem(QListView* pList,QString szChan,QString szPass)
-:QListViewItem(pList,szChan)
+KviChanListViewItem::KviChanListViewItem(KviTalListView* pList,QString szChan,QString szPass)
+:KviTalListViewItem(pList,szChan)
{
m_szPass=szPass;
QString mask;
@@ -732,7 +732,7 @@ KviCahnnelListSelector::KviCahnnelListSelector(QWidget * par,const QString & txt
: KviTalVBox(par), KviSelectorInterface()
{
m_pLabel = new QLabel(txt,this);
- m_pListView = new QListView(this);
+ m_pListView = new KviTalListView(this);
m_pListView->addColumn(__tr2qs("Channel name"));
m_pListView->addColumn(__tr2qs("Channel password"));
@@ -759,7 +759,7 @@ KviCahnnelListSelector::KviCahnnelListSelector(QWidget * par,const QString & txt
new KviChanListViewItem(m_pListView,(*it).section(':',0,0),(*it).section(':',1));
}
- m_pListView->setSelectionMode(QListView::Extended);
+ m_pListView->setSelectionMode(KviTalListView::Extended);
m_pListView->setAllColumnsShowFocus(TRUE);
connect(m_pListView,SIGNAL(selectionChanged()),this,SLOT(selectionChanged()));
setSpacing(4);
@@ -775,7 +775,7 @@ void KviCahnnelListSelector::commit()
{
m_pOption->clear();
register KviChanListViewItem* pItem;
- QListViewItemIterator it( m_pListView);
+ KviTalListViewItemIterator it( m_pListView);
while ( it.current() ) {
pItem = (KviChanListViewItem*)( it.current() );
m_pOption->append(pItem->text(0)+":"+pItem->pass());
@@ -814,10 +814,10 @@ void KviCahnnelListSelector::addClicked()
void KviCahnnelListSelector::removeClicked()
{
- QPtrList<QListViewItem> lst;
- QListViewItemIterator it( m_pListView, QListViewItemIterator::Selected );
+ KviPtrList<KviTalListViewItem> lst;
+ KviTalListViewItemIterator it( m_pListView, KviTalListViewItemIterator::Selected );
while ( it.current() ) {
- lst.append( it.current() );
+ lst.append((KviTalListViewItem *)it.current() );
++it;
}
lst.setAutoDelete(TRUE);
diff --git a/src/kvirc/ui/kvi_selectors.h b/src/kvirc/ui/kvi_selectors.h
index 1f8e9483c..173c64dc7 100644
--- a/src/kvirc/ui/kvi_selectors.h
+++ b/src/kvirc/ui/kvi_selectors.h
@@ -37,8 +37,8 @@
#include <qpushbutton.h>
#include <qcolor.h>
#include <qfont.h>
-#include <qlistbox.h>
-#include <qlistview.h>
+#include "kvi_tal_listbox.h"
+#include "kvi_tal_listview.h"
#include <qspinbox.h>
#include <qstringlist.h>
#include <qvalidator.h>
@@ -267,7 +267,7 @@ public:
~KviStringListSelector();
private:
QLabel * m_pLabel;
- QListBox * m_pListBox;
+ KviTalListBox * m_pListBox;
QLineEdit * m_pLineEdit;
QPushButton * m_pAddButton;
QPushButton * m_pRemoveButton;
@@ -326,12 +326,12 @@ public:
virtual void setEnabled(bool bEnabled);
};
-class KVIRC_API KviChanListViewItem : public QListViewItem
+class KVIRC_API KviChanListViewItem : public KviTalListViewItem
{
private:
QString m_szPass;
public:
- KviChanListViewItem(QListView* pList,QString szChan,QString szPass);
+ KviChanListViewItem(KviTalListView* pList,QString szChan,QString szPass);
~KviChanListViewItem() {};
const QString& pass() { return m_szPass; }
@@ -345,7 +345,7 @@ public:
~KviCahnnelListSelector();
private:
QLabel * m_pLabel;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLineEdit * m_pChanLineEdit;
QLineEdit * m_pPassLineEdit;
QPushButton * m_pAddButton;
diff --git a/src/kvirc/ui/kvi_styled_controls.cpp b/src/kvirc/ui/kvi_styled_controls.cpp
index f01767497..a58edab90 100644
--- a/src/kvirc/ui/kvi_styled_controls.cpp
+++ b/src/kvirc/ui/kvi_styled_controls.cpp
@@ -30,6 +30,7 @@
#include "kvi_app.h"
#include "kvi_options.h"
#include "kvi_doublebuffer.h"
+#include "kvi_tal_toolbar.h"
#include <qcheckbox.h>
#include <qpainter.h>
@@ -237,7 +238,7 @@ KviStyledToolButton::KviStyledToolButton( QWidget * parent, const char * name )
resizeEvent(0);
}
-KviStyledToolButton::KviStyledToolButton ( const QIconSet & iconSet, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent, const char * name )
+KviStyledToolButton::KviStyledToolButton ( const QIconSet & iconSet, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, KviTalToolBar * parent, const char * name )
: QToolButton(iconSet,textLabel,grouptext,receiver,slot,parent,name), KviStyledControl(this), bShowSubmenuIndicator(false)
{
setWFlags(WNoAutoErase);
diff --git a/src/kvirc/ui/kvi_styled_controls.h b/src/kvirc/ui/kvi_styled_controls.h
index 1bbe27e4a..a462a0c1e 100644
--- a/src/kvirc/ui/kvi_styled_controls.h
+++ b/src/kvirc/ui/kvi_styled_controls.h
@@ -30,6 +30,9 @@
#include <qevent.h>
#include <qtimer.h>
#include "kvi_heapobject.h"
+
+class KviTalToolBar;
+
#define KVI_STYLE_NUM_STEPS 20
#define KVI_STYLE_COLOR_DIFF 60
#define KVI_STYLE_TIMER_STEP 18
@@ -85,7 +88,7 @@ private:
bool bShowSubmenuIndicator;
public:
KviStyledToolButton ( QWidget * parent, const char * name = 0 );
- KviStyledToolButton ( const QIconSet & iconSet, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent, const char * name = 0 );
+ KviStyledToolButton ( const QIconSet & iconSet, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, KviTalToolBar * parent, const char * name = 0 );
~KviStyledToolButton();
void setShowSubmenuIndicator(bool bShow);
diff --git a/src/kvirc/ui/kvi_taskbar.cpp b/src/kvirc/ui/kvi_taskbar.cpp
index 92f590452..a62344bc7 100644
--- a/src/kvirc/ui/kvi_taskbar.cpp
+++ b/src/kvirc/ui/kvi_taskbar.cpp
@@ -706,8 +706,8 @@ inline bool KviClassicTaskBar::setIterationPointer(KviTaskBarItem * it)
//
-KviTreeTaskBarItem::KviTreeTaskBarItem(QListView * par,KviWindow * wnd)
-: QListViewItem(par) , KviTaskBarItem(wnd)
+KviTreeTaskBarItem::KviTreeTaskBarItem(KviTalListView * par,KviWindow * wnd)
+: KviTalListViewItem(par) , KviTaskBarItem(wnd)
{
m_iStepNumber=0;
m_bIncreasing=0;
@@ -718,7 +718,7 @@ KviTreeTaskBarItem::KviTreeTaskBarItem(QListView * par,KviWindow * wnd)
}
KviTreeTaskBarItem::KviTreeTaskBarItem(KviTreeTaskBarItem * par,KviWindow * wnd)
-: QListViewItem(par) , KviTaskBarItem(wnd)
+: KviTalListViewItem(par) , KviTaskBarItem(wnd)
{
m_iStepNumber=0;
m_bIncreasing=0;
@@ -736,7 +736,7 @@ int KviTreeTaskBarItem::calculateColor(int col1,int col2)
KviTreeTaskBarItem::~KviTreeTaskBarItem()
{
- QListView* pView=listView();
+ KviTalListView* pView=(KviTalListView *)listView();
if(pView)
if(((KviTreeTaskBarListView*)(pView))->m_pPrevItem==this) ((KviTreeTaskBarListView*)(listView()))->m_pPrevItem=0;
delete m_pAnimTimer;
@@ -801,7 +801,11 @@ void KviTreeTaskBarItem::setActive(bool bActive)
}
}
+#ifdef COMPILE_USE_QT4
+void KviTreeTaskBarItem::paintBranches(QPainter *p,const QColorGroup &,int w,int y,int h)
+#else
void KviTreeTaskBarItem::paintBranches(QPainter *p,const QColorGroup &,int w,int y,int h,GUIStyle s)
+#endif
{
((KviTreeTaskBarListView *)listView())->paintEmptyArea(p,QRect(0,y,w,totalHeight() - height()));
}
@@ -1023,7 +1027,7 @@ void KviTreeTaskBarItem::mouseLeave()
KviTreeTaskBarListView::KviTreeTaskBarListView(QWidget * par)
-: QListView(par,"ttblistview")
+: KviTalListView(par)
{
//setSorting(0);
setShowSortIndicator(true);
@@ -1044,7 +1048,7 @@ void KviTreeTaskBarListView::contentsMouseMoveEvent ( QMouseEvent * e )
KviTreeTaskBarItem* pCur=(KviTreeTaskBarItem*)(itemAt(contentsToViewport(e->pos())));
if(pCur!=m_pPrevItem)
{
- if(m_pPrevItem) m_pPrevItem->mouseLeave();
+ if(m_pPrevItem)m_pPrevItem->mouseLeave();
if(pCur) pCur->mouseEnter();
setCursor(Qt::PointingHandCursor);
m_pPrevItem=pCur;
@@ -1062,7 +1066,7 @@ void KviTreeTaskBarListView::leaveEvent(QEvent *)
void KviTreeTaskBarListView::contentsMousePressEvent(QMouseEvent *e)
{
- QListViewItem * it = itemAt(contentsToViewport(e->pos()));
+ KviTalListViewItem * it = (KviTalListViewItem *)itemAt(contentsToViewport(e->pos()));
if(it)
{
if(e->button() & LeftButton)emit leftMousePress(it);
@@ -1090,7 +1094,7 @@ void KviTreeTaskBarListView::reverseSort()
void KviTreeTaskBarListView::resizeEvent(QResizeEvent *e)
{
- QListView::resizeEvent(e);
+ KviTalListView::resizeEvent(e);
setColumnWidth(0,viewport()->width());
resizeContents(viewport()->width(),contentsHeight());
}
@@ -1197,7 +1201,7 @@ void KviTreeTaskBar::tipRequest(KviDynamicToolTip *,const QPoint &pnt)
{
if(KVI_OPTION_BOOL(KviOption_boolShowTaskBarToolTips))
{
- QListViewItem * it = m_pListView->itemAt(pnt);
+ KviTalListViewItem * it = (KviTalListViewItem *)m_pListView->itemAt(pnt);
if(it)
{
QString szText;
@@ -1383,7 +1387,7 @@ bool KviTreeTaskBar::setIterationPointer(KviTaskBarItem * it)
{
m_pCurrentItem = (KviTreeTaskBarItem *)it;
if(!it)return true;
- if(((QListView *)m_pListView) == ((KviTreeTaskBarItem *)it)->listView())return true;
+ if(((KviTalListView *)m_pListView) == ((KviTreeTaskBarItem *)it)->listView())return true;
m_pCurrentItem = 0;
return false;
}
diff --git a/src/kvirc/ui/kvi_taskbar.h b/src/kvirc/ui/kvi_taskbar.h
index 0c9966bea..f38f1e4d6 100644
--- a/src/kvirc/ui/kvi_taskbar.h
+++ b/src/kvirc/ui/kvi_taskbar.h
@@ -31,7 +31,7 @@
#include "kvi_list.h"
#include <qframe.h>
#include "kvi_tal_tooltip.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qpushbutton.h>
@@ -169,19 +169,19 @@ public:
virtual void updateActivityMeter();
virtual void applyOptions();
protected slots:
- void orientationChangedSlot(Orientation o);
+ void orientationChangedSlot(Qt::Orientation o);
};
class KviTreeTaskBar;
class KviTreeTaskBarItemInternal;
-class KVIRC_API KviTreeTaskBarItem : public QListViewItem , public KviTaskBarItem
+class KVIRC_API KviTreeTaskBarItem : public KviTalListViewItem , public KviTaskBarItem
{
friend class KviTreeTaskBar;
friend class KviTreeTaskBarListView;
friend class KviTreeTaskBarItemInternal;
public:
- KviTreeTaskBarItem(QListView * par,KviWindow * wnd);
+ KviTreeTaskBarItem(KviTalListView * par,KviWindow * wnd);
KviTreeTaskBarItem(KviTreeTaskBarItem * par,KviWindow * wnd);
~KviTreeTaskBarItem();
protected:
@@ -195,7 +195,11 @@ protected:
public:
virtual QString key(int column,bool) const;
virtual void paintCell(QPainter *p,const QColorGroup &cg,int column,int width,int alignment);
+#ifdef COMPILE_USE_QT4
+ virtual void paintBranches(QPainter *p,const QColorGroup &cg,int w,int y,int h);
+#else
virtual void paintBranches(QPainter *p,const QColorGroup &cg,int w,int y,int h,GUIStyle s);
+#endif
virtual void captionChanged();
virtual void highlight(int iLevel = 1);
virtual void unhighlight();
@@ -222,7 +226,7 @@ public slots:
void timerShot() { m_pItem->timerShot();};
};
-class KVIRC_API KviTreeTaskBarListView : public QListView
+class KVIRC_API KviTreeTaskBarListView : public KviTalListView
{
friend class KviTreeTaskBarItem;
Q_OBJECT
@@ -237,8 +241,8 @@ protected:
virtual void contentsMouseMoveEvent ( QMouseEvent * e );
virtual void leaveEvent(QEvent *);
signals:
- void leftMousePress(QListViewItem * it);
- void rightMousePress(QListViewItem * it);
+ void leftMousePress(KviTalListViewItem * it);
+ void rightMousePress(KviTalListViewItem * it);
public slots:
void sort();
void reverseSort();
diff --git a/src/kvirc/ui/kvi_texticonwin.cpp b/src/kvirc/ui/kvi_texticonwin.cpp
index 86cf16d3d..39550653b 100644
--- a/src/kvirc/ui/kvi_texticonwin.cpp
+++ b/src/kvirc/ui/kvi_texticonwin.cpp
@@ -38,15 +38,19 @@
#include <ctype.h>
KviTextIconWindow::KviTextIconWindow()
-:QIconView(0,"toplevel_texticon_window",Qt::WType_Popup)
+#ifdef COMPILE_USE_QT4
+: KviTalIconView(0,Qt::Popup)
+#else
+: KviTalIconView(0,Qt::WType_Popup)
+#endif
{
setGridX ( 40 );
setFixedSize(KVI_TEXTICON_WIN_WIDTH,KVI_TEXTICON_WIN_HEIGHT);
m_pOwner = 0;
fill();
connect(g_pTextIconManager,SIGNAL(changed()),this,SLOT(fill()));
- connect(this,SIGNAL(doubleClicked( QIconViewItem * )),this,SLOT(itemSelected(QIconViewItem *)));
- connect(this,SIGNAL(returnPressed ( QIconViewItem * ) ),this,SLOT(itemSelected(QIconViewItem *)));
+ connect(this,SIGNAL(doubleClicked( KviTalIconViewItem * )),this,SLOT(itemSelected(KviTalIconViewItem *)));
+ connect(this,SIGNAL(returnPressed ( KviTalIconViewItem * ) ),this,SLOT(itemSelected(KviTalIconViewItem *)));
m_bAltMode = false;
setWordWrapIconText(true);
}
@@ -65,7 +69,7 @@ void KviTextIconWindow::fill()
while(KviTextIcon * i = it.current())
{
QPixmap *pix = i->pixmap();
- if(pix)insertItem(new QIconViewItem(this,it.currentKey(),*pix));
+ if(pix)insertItem(new KviTalIconViewItem(this,it.currentKey(),*pix));
++it;
}
sort();
@@ -86,10 +90,10 @@ bool KviTextIconWindow::findTypedSeq()
{
int cnt = count();
int max = 0;
- QIconViewItem *mit = 0;
+ KviTalIconViewItem *mit = 0;
bool bFullMax = false;
- QIconViewItem *item;
- for ( item = firstItem(); item; item = item->nextItem() )
+ KviTalIconViewItem *item;
+ for ( item = (KviTalIconViewItem *)firstItem(); item; item = (KviTalIconViewItem *)item->nextItem() )
{
QString szIt = item->text();
int j;
@@ -126,7 +130,7 @@ void KviTextIconWindow::keyPressEvent(QKeyEvent *e)
case Qt::Key_PageUp:
case Qt::Key_PageDown:
case Qt::Key_Return:
- QIconView::keyPressEvent(e);
+ KviTalIconView::keyPressEvent(e);
return;
break;
case Qt::Key_Escape:
@@ -225,7 +229,7 @@ void KviTextIconWindow::doHide()
if(m_pOwner)m_pOwner->setFocus();
}
-void KviTextIconWindow::itemSelected(QIconViewItem * item)
+void KviTextIconWindow::itemSelected(KviTalIconViewItem * item)
{
if(item)
{
@@ -255,7 +259,7 @@ void KviTextIconWindow::mousePressEvent(QMouseEvent *e)
if(e->pos().y() < 0)goto hideme;
if(e->pos().y() > height())goto hideme;
- QIconView::mousePressEvent(e);
+ KviTalIconView::mousePressEvent(e);
return;
hideme:
diff --git a/src/kvirc/ui/kvi_texticonwin.h b/src/kvirc/ui/kvi_texticonwin.h
index 9798f4bb8..b2d26dc42 100644
--- a/src/kvirc/ui/kvi_texticonwin.h
+++ b/src/kvirc/ui/kvi_texticonwin.h
@@ -27,13 +27,13 @@
#include "kvi_settings.h"
#include "kvi_string.h"
-#include <qiconview.h>
+#include "kvi_tal_iconview.h"
#define KVI_TEXTICON_WIN_WIDTH 230
#define KVI_TEXTICON_WIN_HEIGHT 200
-class KVIRC_API KviTextIconWindow : public QIconView
+class KVIRC_API KviTextIconWindow : public KviTalIconView
{
Q_OBJECT
public:
@@ -57,7 +57,7 @@ private:
public slots:
void fill();
void ownerDead();
- void itemSelected(QIconViewItem * item);
+ void itemSelected(KviTalIconViewItem * item);
};
#endif //_KVI_TEXTICONWIN_H_
diff --git a/src/kvirc/ui/kvi_topicw.cpp b/src/kvirc/ui/kvi_topicw.cpp
index 0d7134165..50a18f845 100644
--- a/src/kvirc/ui/kvi_topicw.cpp
+++ b/src/kvirc/ui/kvi_topicw.cpp
@@ -50,7 +50,7 @@ static int g_iInputFontCharWidth[256];
#include <qfontmetrics.h>
#include "kvi_tal_tooltip.h"
#include <qlineedit.h>
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
#include <qregexp.h>
#include <qclipboard.h>
#include "kvi_tal_popupmenu.h"
@@ -65,7 +65,7 @@ static int g_iInputFontCharWidth[256];
extern QStringList * g_pRecentTopicList;
-int KviListBoxTopicItem::width ( const QListBox * lb ) const
+int KviListBoxTopicItem::width ( const KviTalListBox * lb ) const
{
QFontMetrics fm(lb->font());
return fm.width(KviMircCntrl::stripControlBytes(text()));
@@ -90,11 +90,15 @@ KviTopicWidget::KviTopicWidget(QWidget * par,const char * name)
m_pInput = 0;
setBackgroundMode(QWidget::NoBackground);
reset();
- m_pCompletionBox=new QListBox(this,"m_pCompletionBox",Qt::WType_Popup);
+#ifdef COMPILE_USE_QT4
+ m_pCompletionBox=new KviTalListBox(this,Qt::Popup);
+#else
+ m_pCompletionBox=new KviTalListBox(this,Qt::WType_Popup);
+#endif
m_pCompletionBox->setFont( font() );
m_pCompletionBox->setPalette( palette() );
-// m_pCompletionBox->setVScrollBarMode( QListBox::AlwaysOff );
-// m_pCompletionBox->setHScrollBarMode( QListBox::AlwaysOff );
+// m_pCompletionBox->setVScrollBarMode( KviTalListBox::AlwaysOff );
+// m_pCompletionBox->setHScrollBarMode( KviTalListBox::AlwaysOff );
m_pCompletionBox->setFrameStyle( QFrame::Box | QFrame::Plain );
m_pCompletionBox->setLineWidth( 1 );
connect(m_pCompletionBox,SIGNAL(selected(int)),this,SLOT(complete(int)));
diff --git a/src/kvirc/ui/kvi_topicw.h b/src/kvirc/ui/kvi_topicw.h
index 8aa92cd43..a1d7f19f4 100644
--- a/src/kvirc/ui/kvi_topicw.h
+++ b/src/kvirc/ui/kvi_topicw.h
@@ -29,7 +29,7 @@
#include <qframe.h>
#include <qpushbutton.h>
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
#include "kvi_string.h"
#include "kvi_app.h"
@@ -39,13 +39,13 @@ class QComboBox;
class KviChannel;
class KviTalPopupMenu;
class KviIrcConnection;
-class QListBox;
+class KviTalListBox;
-class KVIRC_API KviListBoxTopicItem : public QListBoxText
+class KVIRC_API KviListBoxTopicItem : public KviTalListBoxText
{
public:
- KviListBoxTopicItem( QListBox * listbox = 0 , const QString & text = QString::null):QListBoxText(listbox,text) { ; };
- virtual int width ( const QListBox * lb ) const;
+ KviListBoxTopicItem( KviTalListBox * listbox = 0 , const QString & text = QString::null):KviTalListBoxText(listbox,text) { ; };
+ virtual int width ( const KviTalListBox * lb ) const;
protected:
virtual void paint ( QPainter * p );
@@ -72,7 +72,7 @@ private:
QChar getSubstituteChar(unsigned short control_code);
int xCursorPostionCalculation(int xInd);
KviInputEditor* m_pInput;
- QListBox* m_pCompletionBox;
+ KviTalListBox* m_pCompletionBox;
protected:
int m_iCursorPosition;
virtual void drawContents(QPainter *p);
diff --git a/src/kvirc/ui/kvi_userlistview.cpp b/src/kvirc/ui/kvi_userlistview.cpp
index 6d0f7b0cc..12f008357 100644
--- a/src/kvirc/ui/kvi_userlistview.cpp
+++ b/src/kvirc/ui/kvi_userlistview.cpp
@@ -1418,16 +1418,15 @@ void KviUserListViewArea::paintEvent(QPaintEvent *ev)
p.drawTiledPixmap(r.left(),r.top(),r.width(),r.height(),*g_pShadedChildGlobalDesktopBackground,pnt.x(),pnt.y());
} else {
#endif
- p.fillRect(r.left(),r.top(),r.width(),r.height(),KVI_OPTION_COLOR(KviOption_colorUserListViewBackground));
+ QPixmap *pix = KVI_OPTION_PIXMAP(KviOption_pixmapUserListViewBackground).pixmap();
+ if(pix)
+ KviPixmapUtils::drawPixmapWithPainter(&p,pix,(Qt::AlignmentFlags)(KVI_OPTION_UINT(KviOption_uintUserListPixmapAlign)),r,width(),height());
+ else
+ p.fillRect(r.left(),r.top(),r.width(),r.height(),KVI_OPTION_COLOR(KviOption_colorUserListViewBackground));
#ifdef COMPILE_PSEUDO_TRANSPARENCY
}
#endif
- QPixmap *pix=KVI_OPTION_PIXMAP(KviOption_pixmapUserListViewBackground).pixmap();
- if(pix)
- {
- KviPixmapUtils::drawPixmapWithPainter(&p,pix,(Qt::AlignmentFlags)(KVI_OPTION_UINT(KviOption_uintUserListPixmapAlign)),r,width(),height());
- }
KviUserListEntry * e = m_pListView->m_pTopItem;
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
index 165f56135..47280a277 100644
--- a/src/modules/Makefile.am
+++ b/src/modules/Makefile.am
@@ -56,5 +56,6 @@ SUBDIRS = about \
tmphighlight \
toolbar \
toolbareditor \
+ torrent \
url \
window
diff --git a/src/modules/actioneditor/actioneditor.cpp b/src/modules/actioneditor/actioneditor.cpp
index f76bf5df9..5299e63a3 100644
--- a/src/modules/actioneditor/actioneditor.cpp
+++ b/src/modules/actioneditor/actioneditor.cpp
@@ -72,8 +72,8 @@ static QString g_szLastEditedAction;
#define LVI_MINIMUM_TEXT_WIDTH 150
#define LVI_MINIMUM_CELL_WIDTH (LVI_MINIMUM_TEXT_WIDTH + LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER)
-KviActionEditorListViewItem::KviActionEditorListViewItem(QListView * v,KviActionData * a)
-: QListViewItem(v,"")
+KviActionEditorListViewItem::KviActionEditorListViewItem(KviTalListView * v,KviActionData * a)
+: KviTalListViewItem(v,"")
{
m_pActionData = a;
m_pListView = v;
@@ -111,7 +111,7 @@ QString KviActionEditorListViewItem::key(int,bool) const
void KviActionEditorListViewItem::setup()
{
- QListViewItem::setup();
+ KviTalListViewItem::setup();
int iWidth = m_pListView->visibleWidth();
if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH;
iWidth -= LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER;
@@ -617,7 +617,7 @@ void KviSingleActionEditor::commit()
KviActionEditorListView::KviActionEditorListView(QWidget * pParent)
-: QListView(pParent)
+: KviTalListView(pParent)
{
setSelectionMode(Extended);
int iWidth = visibleWidth();
@@ -633,7 +633,7 @@ KviActionEditorListView::~KviActionEditorListView()
void KviActionEditorListView::resizeEvent(QResizeEvent * e)
{
- QListView::resizeEvent(e);
+ KviTalListView::resizeEvent(e);
int iWidth = visibleWidth();
if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH;
setColumnWidth(0,iWidth);
@@ -662,7 +662,7 @@ KviActionEditor::KviActionEditor(QWidget * par)
//m_pListView->setMultiSelection(false);
m_pListView->setShowSortIndicator(true);
m_pListView->setFocusPolicy(QWidget::StrongFocus);
- connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentChanged(QListViewItem *)));
+ connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentChanged(KviTalListViewItem *)));
m_pNewActionButton = new QPushButton(__tr2qs("New Action"),box);
@@ -846,7 +846,7 @@ bool KviActionEditor::actionExists(const QString &szName)
}
-void KviActionEditor::currentChanged(QListViewItem * i)
+void KviActionEditor::currentChanged(KviTalListViewItem * i)
{
if(m_pSingleActionEditor->actionData())
{
diff --git a/src/modules/actioneditor/actioneditor.h b/src/modules/actioneditor/actioneditor.h
index 3417e92cd..bd6cf38c4 100644
--- a/src/modules/actioneditor/actioneditor.h
+++ b/src/modules/actioneditor/actioneditor.h
@@ -27,7 +27,7 @@
#include "kvi_window.h"
#include <qwidget.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
class KviActionEditorListViewItem;
@@ -71,16 +71,16 @@ class KviStyledCheckBox;
class QSimpleRichText;
class QPushButton;
-class KviActionEditorListViewItem : public QListViewItem
+class KviActionEditorListViewItem : public KviTalListViewItem
{
public:
- KviActionEditorListViewItem(QListView * v,KviActionData * a);
+ KviActionEditorListViewItem(KviTalListView * v,KviActionData * a);
~KviActionEditorListViewItem();
protected:
KviActionData * m_pActionData;
QSimpleRichText * m_pText;
QPixmap * m_pIcon;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QString m_szKey;
public:
KviActionData * actionData(){ return m_pActionData; };
@@ -92,7 +92,7 @@ public:
};
-class KviActionEditorListView : public QListView
+class KviActionEditorListView : public KviTalListView
{
Q_OBJECT
public:
@@ -170,7 +170,7 @@ protected:
int selectedCount();
QString nameForAutomaticAction(const QString &szTemplate);
protected slots:
- void currentChanged(QListViewItem * it);
+ void currentChanged(KviTalListViewItem * it);
void newAction();
void deleteActions();
void exportActions();
diff --git a/src/modules/addon/managementdialog.cpp b/src/modules/addon/managementdialog.cpp
index 69f0241ac..7b4ed078e 100644
--- a/src/modules/addon/managementdialog.cpp
+++ b/src/modules/addon/managementdialog.cpp
@@ -62,8 +62,8 @@ extern QRect g_rectManagementDialogGeometry;
#define LVI_MINIMUM_TEXT_WIDTH 300
#define LVI_MINIMUM_CELL_WIDTH (LVI_MINIMUM_TEXT_WIDTH + LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER)
-KviScriptAddonListViewItem::KviScriptAddonListViewItem(QListView * v,KviKvsScriptAddon * a)
-: QListViewItem(v,"")
+KviScriptAddonListViewItem::KviScriptAddonListViewItem(KviTalListView * v,KviKvsScriptAddon * a)
+: KviTalListViewItem(v,"")
{
m_pAddon = new KviKvsScriptAddon(*a);
m_pListView = v;
@@ -98,7 +98,7 @@ QString KviScriptAddonListViewItem::key(int,bool) const
void KviScriptAddonListViewItem::setup()
{
- QListViewItem::setup();
+ KviTalListViewItem::setup();
int iWidth = m_pListView->visibleWidth();
if(iWidth < LVI_MINIMUM_CELL_WIDTH)iWidth = LVI_MINIMUM_CELL_WIDTH;
iWidth -= LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING + LVI_BORDER;
@@ -110,7 +110,7 @@ void KviScriptAddonListViewItem::setup()
void KviScriptAddonListViewItem::paintCell(QPainter * p,const QColorGroup & cg,int column,int width,int align)
{
- QListViewItem::paintCell(p,cg,column,width,align);
+ KviTalListViewItem::paintCell(p,cg,column,width,align);
// p->fillRect(QRect(0,0,width,height()),isSelected() ? cg.highlight() : cg.base());
p->drawPixmap(LVI_BORDER,LVI_BORDER,*m_pIcon);
int afterIcon = LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING;
@@ -226,7 +226,7 @@ KviScriptManagementDialog::KviScriptManagementDialog(QWidget * p)
fillListView();
currentChanged(0);
- connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentChanged(QListViewItem *)));
+ connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentChanged(KviTalListViewItem *)));
//currentToolBarChanged();
if(g_rectManagementDialogGeometry.y() < 5)
@@ -261,7 +261,7 @@ void KviScriptManagementDialog::fillListView()
}
}
-void KviScriptManagementDialog::currentChanged(QListViewItem *)
+void KviScriptManagementDialog::currentChanged(KviTalListViewItem *)
{
KviScriptAddonListViewItem * it = (KviScriptAddonListViewItem *)m_pListView->currentItem();
if(!it)
diff --git a/src/modules/addon/managementdialog.h b/src/modules/addon/managementdialog.h
index 0c9a8fd23..9eeee79db 100644
--- a/src/modules/addon/managementdialog.h
+++ b/src/modules/addon/managementdialog.h
@@ -32,23 +32,23 @@
#include <qlabel.h>
#include <qdialog.h>
#include <qcolor.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
class QPushButton;
class QPixmap;
class QSimpleRichText;
class KviKvsScriptAddon;
-class KviScriptAddonListViewItem : public QListViewItem
+class KviScriptAddonListViewItem : public KviTalListViewItem
{
public:
- KviScriptAddonListViewItem(QListView * v,KviKvsScriptAddon * a);
+ KviScriptAddonListViewItem(KviTalListView * v,KviKvsScriptAddon * a);
~KviScriptAddonListViewItem();
protected:
KviKvsScriptAddon * m_pAddon;
QSimpleRichText * m_pText;
QPixmap * m_pIcon;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QString m_szKey;
public:
KviKvsScriptAddon * addon(){ return m_pAddon; };
@@ -92,7 +92,7 @@ protected:
virtual void showEvent(QShowEvent * e);
virtual void closeEvent(QCloseEvent *e);
protected slots:
- void currentChanged(QListViewItem *i);
+ void currentChanged(KviTalListViewItem *i);
void closeClicked();
void showScriptHelp();
void configureScript();
diff --git a/src/modules/aliaseditor/aliaseditor.cpp b/src/modules/aliaseditor/aliaseditor.cpp
index 826acef1d..9033004e4 100644
--- a/src/modules/aliaseditor/aliaseditor.cpp
+++ b/src/modules/aliaseditor/aliaseditor.cpp
@@ -53,14 +53,14 @@
extern KviAliasEditorWindow * g_pAliasEditorWindow;
extern KviModule * g_pAliasEditorModule;
-KviAliasEditorListViewItem::KviAliasEditorListViewItem(QListView * pListView,Type eType,const QString &szName)
-: QListViewItem(pListView), m_eType(eType), m_pParentNamespaceItem(0)
+KviAliasEditorListViewItem::KviAliasEditorListViewItem(KviTalListView * pListView,Type eType,const QString &szName)
+: KviTalListViewItem(pListView), m_eType(eType), m_pParentNamespaceItem(0)
{
setName(szName);
}
KviAliasEditorListViewItem::KviAliasEditorListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,Type eType,const QString &szName)
-: QListViewItem(pParentNamespaceItem), m_eType(eType), m_pParentNamespaceItem(pParentNamespaceItem)
+: KviTalListViewItem(pParentNamespaceItem), m_eType(eType), m_pParentNamespaceItem(pParentNamespaceItem)
{
setName(szName);
}
@@ -88,7 +88,7 @@ KviAliasListViewItem::KviAliasListViewItem(KviAliasNamespaceListViewItem * pPare
m_cPos=QPoint(0,0);
}
-KviAliasListViewItem::KviAliasListViewItem(QListView * pListView,const QString &szName)
+KviAliasListViewItem::KviAliasListViewItem(KviTalListView * pListView,const QString &szName)
: KviAliasEditorListViewItem(pListView,KviAliasEditorListViewItem::Alias,szName)
{
setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIAS)));
@@ -96,7 +96,7 @@ KviAliasListViewItem::KviAliasListViewItem(QListView * pListView,const QString &
}
-KviAliasNamespaceListViewItem::KviAliasNamespaceListViewItem(QListView * pListView,const QString &szName)
+KviAliasNamespaceListViewItem::KviAliasNamespaceListViewItem(KviTalListView * pListView,const QString &szName)
: KviAliasEditorListViewItem(pListView,KviAliasEditorListViewItem::Namespace,szName)
{
setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_NAMESPACE)));
@@ -214,9 +214,9 @@ KviAliasEditor::KviAliasEditor(QWidget * par)
l->addWidget(m_pSplitter,0,0);
KviTalVBox * box = new KviTalVBox(m_pSplitter);
- m_pListView = new QListView(box);
+ m_pListView = new KviTalListView(box);
m_pListView->addColumn(__tr2qs("Alias"));
- m_pListView->setSelectionMode(QListView::Extended);
+ m_pListView->setSelectionMode(KviTalListView::Extended);
m_pListView->setShowSortIndicator(true);
m_pListView->setRootIsDecorated(true);
@@ -379,12 +379,12 @@ void KviAliasEditor::oneTimeSetup()
++it;
}
- connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentItemChanged(QListViewItem *)));
- connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this,SLOT(itemPressed(QListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentItemChanged(KviTalListViewItem *)));
+ connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
+ this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int)));
}
-bool KviAliasEditor::hasSelectedItems(QListViewItem * it)
+bool KviAliasEditor::hasSelectedItems(KviTalListViewItem * it)
{
if(!it)return false;
if(it->isSelected())return true;
@@ -395,7 +395,7 @@ bool KviAliasEditor::hasSelectedItems(QListViewItem * it)
return hasSelectedItems(it->nextSibling());
}
-bool KviAliasEditor::itemExists(QListViewItem *pSearchFor,QListViewItem * pSearchAt)
+bool KviAliasEditor::itemExists(KviTalListViewItem *pSearchFor,KviTalListViewItem * pSearchAt)
{
if(!pSearchFor)return false;
if(!pSearchAt)return false;
@@ -405,7 +405,7 @@ bool KviAliasEditor::itemExists(QListViewItem *pSearchFor,QListViewItem * pSearc
}
-void KviAliasEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col)
+void KviAliasEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
{
m_pContextPopup->clear();
@@ -958,7 +958,7 @@ QString KviAliasEditor::askForNamespaceName(const QString &szAction,const QStrin
return szNewName;
}
-void KviAliasEditor::openParentItems(QListViewItem * it)
+void KviAliasEditor::openParentItems(KviTalListViewItem * it)
{
if(it->parent())
{
@@ -968,7 +968,7 @@ void KviAliasEditor::openParentItems(QListViewItem * it)
}
-void KviAliasEditor::selectOneItem(QListViewItem * it,QListViewItem *pStartFrom)
+void KviAliasEditor::selectOneItem(KviTalListViewItem * it,KviTalListViewItem *pStartFrom)
{
if(!pStartFrom)return;
if(pStartFrom == it)pStartFrom->setSelected(true);
@@ -978,7 +978,7 @@ void KviAliasEditor::selectOneItem(QListViewItem * it,QListViewItem *pStartFrom)
}
-void KviAliasEditor::activateItem(QListViewItem * it)
+void KviAliasEditor::activateItem(KviTalListViewItem * it)
{
openParentItems(it);
selectOneItem(it,m_pListView->firstChild());
@@ -1062,9 +1062,9 @@ void KviAliasEditor::renameItem()
}
// take child items, if any
- KviPtrList<QListViewItem> lChildren;
+ KviPtrList<KviTalListViewItem> lChildren;
lChildren.setAutoDelete(false);
- QListViewItem * it = m_pLastEditedItem->firstChild();
+ KviTalListViewItem * it = m_pLastEditedItem->firstChild();
while(it)
{
lChildren.append(it);
@@ -1116,7 +1116,7 @@ void KviAliasEditor::saveLastEditedItem()
((KviAliasListViewItem *)m_pLastEditedItem)->setCursorPosition(m_pEditor->getCursor());
}
-void KviAliasEditor::currentItemChanged(QListViewItem *it)
+void KviAliasEditor::currentItemChanged(KviTalListViewItem *it)
{
saveLastEditedItem();
diff --git a/src/modules/aliaseditor/aliaseditor.h b/src/modules/aliaseditor/aliaseditor.h
index 4b4e54d37..12e62e04a 100644
--- a/src/modules/aliaseditor/aliaseditor.h
+++ b/src/modules/aliaseditor/aliaseditor.h
@@ -30,7 +30,7 @@
#include <qwidget.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qlineedit.h>
#include "kvi_tal_popupmenu.h"
#include <qstringlist.h>
@@ -41,12 +41,12 @@ class KviScriptEditor;
class KviAliasNamespaceListViewItem;
-class KviAliasEditorListViewItem : public QListViewItem
+class KviAliasEditorListViewItem : public KviTalListViewItem
{
public:
enum Type { Alias, Namespace };
public:
- KviAliasEditorListViewItem(QListView * pListView,Type eType,const QString &szName);
+ KviAliasEditorListViewItem(KviTalListView * pListView,Type eType,const QString &szName);
KviAliasEditorListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,Type eType,const QString &szName);
~KviAliasEditorListViewItem(){};
protected:
@@ -69,7 +69,7 @@ class KviAliasListViewItem;
class KviAliasNamespaceListViewItem : public KviAliasEditorListViewItem
{
public:
- KviAliasNamespaceListViewItem(QListView * pListView,const QString &szName);
+ KviAliasNamespaceListViewItem(KviTalListView * pListView,const QString &szName);
KviAliasNamespaceListViewItem(KviAliasNamespaceListViewItem * pParentNamespace,const QString &szName);
~KviAliasNamespaceListViewItem(){};
public:
@@ -86,7 +86,7 @@ class KviAliasListViewItem : public KviAliasEditorListViewItem
{
public:
KviAliasListViewItem(KviAliasNamespaceListViewItem * pParentNamespace,const QString &szName);
- KviAliasListViewItem(QListView *pListView,const QString &szName);
+ KviAliasListViewItem(KviTalListView *pListView,const QString &szName);
~KviAliasListViewItem(){};
public:
QString m_szBuffer;
@@ -108,7 +108,7 @@ public:
~KviAliasEditor();
public:
KviScriptEditor * m_pEditor;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLabel * m_pNameLabel;
QPushButton * m_pRenameButton;
KviAliasEditorListViewItem * m_pLastEditedItem;
@@ -127,14 +127,14 @@ public:
void loadProperties(KviConfig *);
static void splitFullAliasOrNamespaceName(const QString &szFullName,QStringList &lNamespaces,QString &szName);
protected slots:
- void currentItemChanged(QListViewItem *it);
+ void currentItemChanged(KviTalListViewItem *it);
void newAlias();
void newNamespace();
void exportAll();
void exportSelectedSepFiles();
void exportSelected();
void removeSelectedItems();
- void itemPressed(QListViewItem *it,const QPoint &pnt,int col);
+ void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col);
void renameItem();
void slotFind();
void slotCollapseNamespaces();
@@ -148,18 +148,18 @@ protected:
void recursiveCommit(KviAliasEditorListViewItem * it);
void getExportAliasBuffer(QString &buffer,KviAliasListViewItem * it);
void oneTimeSetup();
- void selectOneItem(QListViewItem * it,QListViewItem *pStartFrom);
+ void selectOneItem(KviTalListViewItem * it,KviTalListViewItem *pStartFrom);
void saveLastEditedItem();
void getUniqueItemName(KviAliasEditorListViewItem *item,QString &buffer,KviAliasEditorListViewItem::Type eType);
void appendSelectedItems(KviPtrList<KviAliasEditorListViewItem> * l,KviAliasEditorListViewItem * pStartFrom,bool bIncludeChildrenOfSelected = false);
void appendAliasItems(KviPtrList<KviAliasListViewItem> * l,KviAliasEditorListViewItem * pStartFrom,bool bSelectedOnly);
bool removeItem(KviAliasEditorListViewItem *it,bool * pbYesToAll,bool bDeleteEmptyTree);
- void openParentItems(QListViewItem * it);
- void activateItem(QListViewItem * it);
+ void openParentItems(KviTalListViewItem * it);
+ void activateItem(KviTalListViewItem * it);
QString askForAliasName(const QString &szAction,const QString &szText,const QString &szInitialText);
QString askForNamespaceName(const QString &szAction,const QString &szText,const QString &szInitialText);
- bool itemExists(QListViewItem *pSearchFor,QListViewItem * pSearchAt);
- bool hasSelectedItems(QListViewItem * it);
+ bool itemExists(KviTalListViewItem *pSearchFor,KviTalListViewItem * pSearchAt);
+ bool hasSelectedItems(KviTalListViewItem * it);
KviAliasNamespaceListViewItem * findNamespaceItem(const QString &szName);
KviAliasNamespaceListViewItem * getNamespaceItem(const QString &szName);
KviAliasListViewItem * findAliasItem(const QString &szName);
diff --git a/src/modules/channelsjoin/channelsjoinwindow.cpp b/src/modules/channelsjoin/channelsjoinwindow.cpp
index c420bb6ed..ce46cbe79 100644
--- a/src/modules/channelsjoin/channelsjoinwindow.cpp
+++ b/src/modules/channelsjoin/channelsjoinwindow.cpp
@@ -37,7 +37,7 @@
#include <qlabel.h>
#include <qlineedit.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qgroupbox.h>
#include <qlayout.h>
#include <qcheckbox.h>
@@ -60,13 +60,13 @@ KviChannelsJoinWindow::KviChannelsJoinWindow(QWidget * par, const char * name)
QGridLayout * g = new QGridLayout(this,4,2,4,8);
- m_pListView = new QListView(this);
+ m_pListView = new KviTalListView(this);
m_pListView->addColumn(__tr2qs("Channel"));
m_pListView->setRootIsDecorated(true);
- m_pListView->setSelectionMode(QListView::Single);
+ m_pListView->setSelectionMode(KviTalListView::Single);
g->addMultiCellWidget(m_pListView,0,0,0,1);
- connect(m_pListView,SIGNAL(clicked(QListViewItem *)),this,SLOT(itemClicked(QListViewItem *)));
- connect(m_pListView,SIGNAL(doubleClicked(QListViewItem *)),this,SLOT(itemDoubleClicked(QListViewItem *)));
+ connect(m_pListView,SIGNAL(clicked(KviTalListViewItem *)),this,SLOT(itemClicked(KviTalListViewItem *)));
+ connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem *)),this,SLOT(itemDoubleClicked(KviTalListViewItem *)));
m_pGroupBox = new QGroupBox(2,QGroupBox::Horizontal,__tr2qs("Channel" ),this);
@@ -151,9 +151,9 @@ void KviChannelsJoinWindow::fillListView()
m_pListView->header()->hide();
- QListViewItem * par = new QListViewItem(m_pListView,__tr2qs("Recent Channels"));
+ KviTalListViewItem * par = new KviTalListViewItem(m_pListView,__tr2qs("Recent Channels"));
par->setOpen(true);
- QListViewItem * chld;
+ KviTalListViewItem * chld;
if(m_pConsole)
{
@@ -163,14 +163,14 @@ void KviChannelsJoinWindow::fillListView()
{
for(QStringList::Iterator it = pList->begin(); it != pList->end(); ++it)
{
- chld = new QListViewItem(par,*it);
+ chld = new KviTalListViewItem(par,*it);
chld->setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL)));
}
}
}
// FIXME: Registered channels go here!
- par = new QListViewItem(m_pListView,__tr2qs("Registered Channels"));
+ par = new KviTalListViewItem(m_pListView,__tr2qs("Registered Channels"));
par->setOpen(true);
KviAsciiDict<KviRegisteredChannelList> * d = g_pRegisteredChannelDataBase->channelDict();
@@ -179,7 +179,7 @@ void KviChannelsJoinWindow::fillListView()
KviAsciiDictIterator<KviRegisteredChannelList> it(*d);
while(it.current())
{
- chld = new QListViewItem(par,it.currentKey());
+ chld = new KviTalListViewItem(par,it.currentKey());
chld->setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL)));
++it;
}
@@ -188,7 +188,7 @@ void KviChannelsJoinWindow::fillListView()
}
-void KviChannelsJoinWindow::itemClicked(QListViewItem * it)
+void KviChannelsJoinWindow::itemClicked(KviTalListViewItem * it)
{
if(!it)return;
if(!it->parent())return;
@@ -197,7 +197,7 @@ void KviChannelsJoinWindow::itemClicked(QListViewItem * it)
enableJoin();
}
-void KviChannelsJoinWindow::itemDoubleClicked(QListViewItem * it)
+void KviChannelsJoinWindow::itemDoubleClicked(KviTalListViewItem * it)
{
if(!it)return;
if(!it->parent())return;
@@ -268,7 +268,7 @@ void KviChannelsJoinWindow::namesClicked()
if(!tmp.isEmpty())doCmd("raw names", tmp.ptr());
}
-void KviChannelsJoinWindow::itemDoubleClicked(QListBoxItem * it)
+void KviChannelsJoinWindow::itemDoubleClicked(KviTalListBoxItem * it)
{
if (it == 0)return;
KviStr tmp = it->text();
diff --git a/src/modules/channelsjoin/channelsjoinwindow.h b/src/modules/channelsjoin/channelsjoinwindow.h
index 4bc9a2588..5e76791a2 100644
--- a/src/modules/channelsjoin/channelsjoinwindow.h
+++ b/src/modules/channelsjoin/channelsjoinwindow.h
@@ -33,8 +33,8 @@ class QGroupBox;
class QPushButton;
class KviStyledCheckBox;
class QLineEdit;
-class QListView;
-class QListViewItem;
+
+#include "kvi_tal_listview.h"
class KviChannelsJoinWindow : public QDialog
{
@@ -44,7 +44,7 @@ public:
~KviChannelsJoinWindow();
protected:
QLineEdit * m_pChannelEdit;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QGroupBox * m_pGroupBox;
QLineEdit * m_pPass;
KviStyledCheckBox * m_pShowAtStartupCheck;
@@ -58,8 +58,8 @@ public:
void setConsole(KviConsole * pConsole);
protected slots:
void editTextChanged(const QString &);
- void itemClicked(QListViewItem *it);
- void itemDoubleClicked(QListViewItem *it);
+ void itemClicked(KviTalListViewItem *it);
+ void itemDoubleClicked(KviTalListViewItem *it);
void editReturnPressed();
void cancelClicked();
void joinClicked();
diff --git a/src/modules/editor/scripteditor.cpp b/src/modules/editor/scripteditor.cpp
index bd27cae06..c2068daa4 100644
--- a/src/modules/editor/scripteditor.cpp
+++ b/src/modules/editor/scripteditor.cpp
@@ -69,8 +69,8 @@ static QColor g_clrFind(187,221,255);
static QFont g_fntNormal("Fixed",12);
-KviCompletionBox::KviCompletionBox(QWidget * parent = 0, const char * name = 0, WFlags f = 0)
-: QListBox(parent,name,f)
+KviCompletionBox::KviCompletionBox(QWidget * parent = 0)
+: KviTalListBox(parent)
{
setPaletteForegroundColor(QColor(0,0,0));
setPaletteBackgroundColor(QColor(255,255,255));
@@ -80,7 +80,7 @@ KviCompletionBox::KviCompletionBox(QWidget * parent = 0, const char * name = 0,
setFont(listfont);
setVariableWidth(false);
setFixedWidth(200);
- //completelistbox->setColumnMode(QListBox::Variable);
+ //completelistbox->setColumnMode(KviTalListBox::Variable);
hide();
}
@@ -152,7 +152,7 @@ void KviCompletionBox::keyPressEvent(QKeyEvent * e)
}
}
- QListBox::keyPressEvent(e);
+ KviTalListBox::keyPressEvent(e);
}
KviScriptEditorWidgetColorOptions::KviScriptEditorWidgetColorOptions(QWidget * pParent)
@@ -223,7 +223,7 @@ KviScriptEditorWidget::KviScriptEditorWidget(QWidget * pParent)
m_szHelp="Nothing";
updateOptions();
m_szFind="";
- completelistbox=new KviCompletionBox(this,"completelistbox");
+ completelistbox=new KviCompletionBox(this);
connect (completelistbox,SIGNAL(selected(const QString &)),this,SLOT(slotComplete(const QString &)));
}
diff --git a/src/modules/editor/scripteditor.h b/src/modules/editor/scripteditor.h
index 914f9bd15..d0a278688 100644
--- a/src/modules/editor/scripteditor.h
+++ b/src/modules/editor/scripteditor.h
@@ -33,18 +33,18 @@
#include <qsyntaxhighlighter.h>
#include <qdialog.h>
#include <qcheckbox.h>
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
#include <qevent.h>
#include "kvi_list.h"
#include "kvi_selectors.h"
typedef KviPtrList<int> ColumnList;
-class KviCompletionBox: public QListBox
+class KviCompletionBox: public KviTalListBox
{
Q_OBJECT
public:
- KviCompletionBox(QWidget * parent, const char * name, WFlags f);
+ KviCompletionBox(QWidget * parent);
~KviCompletionBox(){};
void updateContents(QString word);
diff --git a/src/modules/eventeditor/eventeditor.cpp b/src/modules/eventeditor/eventeditor.cpp
index ca2dd5e3f..0d0d547ad 100644
--- a/src/modules/eventeditor/eventeditor.cpp
+++ b/src/modules/eventeditor/eventeditor.cpp
@@ -74,7 +74,7 @@ KviEventEditor::KviEventEditor(QWidget * par)
l->addWidget(spl,0,0);
KviTalVBox * boxi = new KviTalVBox(spl);
- m_pListView = new QListView(boxi);
+ m_pListView = new KviTalListView(boxi);
m_pListView->addColumn(__tr2qs("Event"));
m_pListView->setMultiSelection(false);
m_pListView->setShowSortIndicator(true);
@@ -127,12 +127,12 @@ void KviEventEditor::oneTimeSetup()
m_pContextPopup = new KviTalPopupMenu(this);
- connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(selectionChanged(QListViewItem *)));
- connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this,SLOT(itemPressed(QListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(selectionChanged(KviTalListViewItem *)));
+ connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
+ this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int)));
}
-void KviEventEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col)
+void KviEventEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
{
__range_valid(m_bOneTimeSetupDone);
@@ -205,14 +205,14 @@ void KviEventEditor::addHandlerForCurrentEvent()
{
__range_valid(m_pOneTimeSetupDone);
- QListViewItem * it = m_pListView->selectedItem();
+ KviTalListViewItem * it = m_pListView->selectedItem();
if(it)
{
if(it->parent() == 0)
{
QString buffer = __tr2qs("default");
getUniqueHandlerName((KviEventListViewItem *)it,buffer);
- QListViewItem * ch = new KviEventHandlerListViewItem(it,buffer,"",true);
+ KviTalListViewItem * ch = new KviEventHandlerListViewItem(it,buffer,"",true);
it->setOpen(true);
m_pListView->setSelected(ch,true);
}
@@ -224,7 +224,7 @@ void KviEventEditor::removeCurrentHandler()
__range_valid(m_pOneTimeSetupDone);
if(m_pLastEditedItem)
{
- QListViewItem * it = m_pLastEditedItem;
+ KviTalListViewItem * it = m_pLastEditedItem;
m_pLastEditedItem = 0;
delete it;
m_pEditor->setEnabled(false);
@@ -249,13 +249,13 @@ void KviEventEditor::commit()
saveLastEditedItem();
KviKvsEventManager::instance()->removeAllScriptAppHandlers();
- for(QListViewItem * it = m_pListView->firstChild();it;it = it->nextSibling())
+ for(KviTalListViewItem * it = m_pListView->firstChild();it;it = it->nextSibling())
{
if(it->firstChild())
{
QString szContext;
- for(QListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling())
+ for(KviTalListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling())
{
KviQString::sprintf(szContext,"%Q::%Q",&(((KviEventListViewItem *)it)->m_szName),&(((KviEventHandlerListViewItem *)ch)->m_szName));
@@ -292,7 +292,7 @@ void KviEventEditor::saveLastEditedItem()
m_pLastEditedItem->m_szBuffer = tmp;
}
-void KviEventEditor::selectionChanged(QListViewItem * it)
+void KviEventEditor::selectionChanged(KviTalListViewItem * it)
{
__range_valid(m_bOneTimeSetupDone);
saveLastEditedItem();
diff --git a/src/modules/eventeditor/eventeditor.h b/src/modules/eventeditor/eventeditor.h
index cfd2783fd..e9f94ff4d 100644
--- a/src/modules/eventeditor/eventeditor.h
+++ b/src/modules/eventeditor/eventeditor.h
@@ -26,35 +26,35 @@
#include "kvi_string.h"
#include <qwidget.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qlineedit.h>
class KviScriptEditor;
-class KviEventListViewItem : public QListViewItem
+class KviEventListViewItem : public KviTalListViewItem
{
public:
unsigned int m_uEventIdx;
QString m_szName;
QString m_szParams;
public:
- KviEventListViewItem(QListView * par,unsigned int uEvIdx,const QString &name,const QString &params)
- : QListViewItem(par), m_uEventIdx(uEvIdx), m_szName(name), m_szParams(params) {};
+ KviEventListViewItem(KviTalListView * par,unsigned int uEvIdx,const QString &name,const QString &params)
+ : KviTalListViewItem(par), m_uEventIdx(uEvIdx), m_szName(name), m_szParams(params) {};
~KviEventListViewItem() {};
public:
virtual QString text(int col) const { return m_szName; };
virtual const QPixmap * pixmap(int col) const;
};
-class KviEventHandlerListViewItem : public QListViewItem
+class KviEventHandlerListViewItem : public KviTalListViewItem
{
public:
QString m_szName;
QString m_szBuffer;
bool m_bEnabled;
public:
- KviEventHandlerListViewItem(QListViewItem * par,const QString &name,const QString &buffer,bool bEnabled)
- : QListViewItem(par), m_szName(name) , m_szBuffer(buffer) , m_bEnabled(bEnabled) {};
+ KviEventHandlerListViewItem(KviTalListViewItem * par,const QString &name,const QString &buffer,bool bEnabled)
+ : KviTalListViewItem(par), m_szName(name) , m_szBuffer(buffer) , m_bEnabled(bEnabled) {};
~KviEventHandlerListViewItem() {};
public:
virtual QString text(int col) const { return m_szName; };
@@ -71,7 +71,7 @@ public:
~KviEventEditor();
public:
KviScriptEditor * m_pEditor;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLineEdit * m_pNameEditor;
KviTalPopupMenu * m_pContextPopup;
KviEventHandlerListViewItem * m_pLastEditedItem;
@@ -82,8 +82,8 @@ public:
void getUniqueHandlerName(KviEventListViewItem *it,QString &buffer);
void getExportEventBuffer(QString &szBuffer,KviEventHandlerListViewItem * it);
protected slots:
- void selectionChanged(QListViewItem *it);
- void itemPressed(QListViewItem *it,const QPoint &pnt,int col);
+ void selectionChanged(KviTalListViewItem *it);
+ void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col);
void toggleCurrentHandlerEnabled();
void removeCurrentHandler();
void addHandlerForCurrentEvent();
diff --git a/src/modules/filetransferwindow/filetransferwindow.cpp b/src/modules/filetransferwindow/filetransferwindow.cpp
index 740790300..e410a028f 100644
--- a/src/modules/filetransferwindow/filetransferwindow.cpp
+++ b/src/modules/filetransferwindow/filetransferwindow.cpp
@@ -58,8 +58,8 @@
extern KviFileTransferWindow * g_pFileTransferWindow;
-KviFileTransferItem::KviFileTransferItem(QListView * v,KviFileTransfer * t)
-: QListViewItem(v)
+KviFileTransferItem::KviFileTransferItem(KviTalListView * v,KviFileTransfer * t)
+: KviTalListViewItem(v)
{
m_pTransfer = t;
m_pTransfer->setDisplayItem(this);
@@ -130,7 +130,7 @@ void KviFileTransferItem::paintCell(QPainter * p,const QColorGroup &cg,int colum
void KviFileTransferItem::setHeight(int h)
{
- QListViewItem::setHeight(m_pTransfer->displayHeight(g_pFileTransferWindow->lineSpacing()));
+ KviTalListViewItem::setHeight(m_pTransfer->displayHeight(g_pFileTransferWindow->lineSpacing()));
}
@@ -153,7 +153,7 @@ KviFileTransferWindow::KviFileTransferWindow(KviModuleExtensionDescriptor * d,Kv
m_pSplitter = new QSplitter(QSplitter::Horizontal,this,"splitter");
m_pVertSplitter = new QSplitter(QSplitter::Vertical,m_pSplitter,"vsplitter");
- m_pListView = new QListView(m_pVertSplitter);
+ m_pListView = new KviTalListView(m_pVertSplitter);
//m_pListView->header()->hide();
m_pListView->setAllColumnsShowFocus(true);
m_pListView->addColumn(__tr2qs_ctx("Type","filetransferwindow"),56);
@@ -166,8 +166,8 @@ KviFileTransferWindow::KviFileTransferWindow(KviModuleExtensionDescriptor * d,Kv
//m_pListView->setFocusPolicy(NoFocus);
//m_pListView->viewport()->setFocusPolicy(NoFocus);
- //connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- // this,SLOT(showHostPopup(QListViewItem *,const QPoint &,int)));
+ //connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
+ // this,SLOT(showHostPopup(KviTalListViewItem *,const QPoint &,int)));
QFontMetrics fm(font());
m_iLineSpacing = fm.lineSpacing();
@@ -175,8 +175,8 @@ KviFileTransferWindow::KviFileTransferWindow(KviModuleExtensionDescriptor * d,Kv
m_pIrcView = new KviIrcView(m_pVertSplitter,lpFrm,this);
m_pListView->installEventFilter(this);
- connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),this,SLOT(rightButtonPressed(QListViewItem *,const QPoint &,int)));
- connect(m_pListView,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),this,SLOT(doubleClicked(QListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),this,SLOT(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem *,const QPoint &,int)),this,SLOT(doubleClicked(KviTalListViewItem *,const QPoint &,int)));
fillTransferView();
connect(KviFileTransferManager::instance(),SIGNAL(transferRegistered(KviFileTransfer *)),this,SLOT(transferRegistered(KviFileTransfer *)));
@@ -268,13 +268,13 @@ void KviFileTransferWindow::transferUnregistering(KviFileTransfer * t)
it = 0;
}
-void KviFileTransferWindow::doubleClicked(QListViewItem *it,const QPoint &pnt,int col)
+void KviFileTransferWindow::doubleClicked(KviTalListViewItem *it,const QPoint &pnt,int col)
{
if(it)
openLocalFile();
}
-void KviFileTransferWindow::rightButtonPressed(QListViewItem *it,const QPoint &pnt,int col)
+void KviFileTransferWindow::rightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
{
if(!m_pContextPopup)m_pContextPopup = new KviTalPopupMenu(this);
if(!m_pLocalFilePopup)m_pLocalFilePopup = new KviTalPopupMenu(this);
@@ -410,7 +410,7 @@ void KviFileTransferWindow::rightButtonPressed(QListViewItem *it,const QPoint &p
KviFileTransfer * KviFileTransferWindow::selectedTransfer()
{
- QListViewItem * it = m_pListView->selectedItem();
+ KviTalListViewItem * it = m_pListView->selectedItem();
if(!it)return 0;
KviFileTransferItem * i = (KviFileTransferItem *)it;
return i->transfer();
@@ -622,8 +622,8 @@ void KviFileTransferWindow::heartbeat()
{
if(m_pListView->childCount() < 1)return;
- QListViewItem * i1;
- QListViewItem * i2;
+ KviTalListViewItem * i1;
+ KviTalListViewItem * i2;
i1 = m_pListView->itemAt(QPoint(1,1));
if(!i1)
diff --git a/src/modules/filetransferwindow/filetransferwindow.h b/src/modules/filetransferwindow/filetransferwindow.h
index 17eddb41a..7c79dcf7d 100644
--- a/src/modules/filetransferwindow/filetransferwindow.h
+++ b/src/modules/filetransferwindow/filetransferwindow.h
@@ -33,7 +33,7 @@
#include "kvi_filetransfer.h"
#include "kvi_dynamictooltip.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include "kvi_tal_popupmenu.h"
#include <qtoolbutton.h>
#include <qtimer.h>
@@ -41,10 +41,10 @@
-class KviFileTransferItem : public QListViewItem
+class KviFileTransferItem : public KviTalListViewItem
{
public:
- KviFileTransferItem(QListView * v,KviFileTransfer * t);
+ KviFileTransferItem(KviTalListView * v,KviFileTransfer * t);
~KviFileTransferItem();
protected:
KviFileTransfer * m_pTransfer;
@@ -65,7 +65,7 @@ public:
~KviFileTransferWindow();
protected:
QSplitter * m_pVertSplitter;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
KviTalPopupMenu * m_pContextPopup;
KviTalPopupMenu * m_pLocalFilePopup;
KviTalPopupMenu * m_pOpenFilePopup;
@@ -92,8 +92,8 @@ public:
protected slots:
void transferRegistered(KviFileTransfer *t);
void transferUnregistering(KviFileTransfer *t);
- void rightButtonPressed(QListViewItem *it,const QPoint &pnt,int col);
- void doubleClicked(QListViewItem *it,const QPoint &pnt,int col);
+ void rightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col);
+ void doubleClicked(KviTalListViewItem *it,const QPoint &pnt,int col);
void heartbeat();
void clearTerminated();
void clearAll();
diff --git a/src/modules/help/helpwindow.cpp b/src/modules/help/helpwindow.cpp
index c051ebbb8..eb40416ac 100644
--- a/src/modules/help/helpwindow.cpp
+++ b/src/modules/help/helpwindow.cpp
@@ -92,7 +92,7 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name)
connect(pBtnRefreshIndex,SIGNAL(clicked()),this,SLOT(refreshIndex()));
QToolTip::add( pBtnRefreshIndex, __tr2qs("Refresh index") );
- m_pIndexListBox = new QListBox(m_pIndexTab);
+ m_pIndexListBox = new KviTalListBox(m_pIndexTab);
QStringList docList=g_pDocIndex->titlesList();
m_pIndexListBox->insertStringList(docList);
connect(m_pIndexListBox,SIGNAL(selected(int)),this,SLOT(indexSelected ( int )));
@@ -107,7 +107,7 @@ KviHelpWindow::KviHelpWindow(KviFrame * lpFrm,const char * name)
connect( m_pTermsEdit, SIGNAL( returnPressed() ),
this, SLOT( startSearch() ) );
- m_pResultBox = new QListBox(m_pSearchTab);
+ m_pResultBox = new KviTalListBox(m_pSearchTab);
connect(m_pResultBox,SIGNAL(selected(int)),this,SLOT(searchSelected ( int )));
QValueList<int> li;
@@ -245,7 +245,7 @@ void KviHelpWindow::showIndexTopic()
void KviHelpWindow::searchInIndex( const QString &s )
{
- QListBoxItem *i = m_pIndexListBox->firstItem();
+ KviTalListBoxItem *i = m_pIndexListBox->firstItem();
QString sl = s.lower();
while ( i ) {
QString t = i->text();
diff --git a/src/modules/help/helpwindow.h b/src/modules/help/helpwindow.h
index 1a48cd73d..2f130eaaa 100644
--- a/src/modules/help/helpwindow.h
+++ b/src/modules/help/helpwindow.h
@@ -26,7 +26,7 @@
#include "kvi_string.h"
#include "kvi_tal_vbox.h"
#include <qtabwidget.h>
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
#include <qlineedit.h>
#include <qprogressdialog.h>
@@ -46,11 +46,11 @@ protected:
KviTalVBox * m_pIndexTab;
KviTalVBox * m_pSearchTab;
- QListBox * m_pIndexListBox;
+ KviTalListBox * m_pIndexListBox;
QLineEdit * m_pIndexSearch;
QStringList m_foundDocs;
QStringList m_terms;
- QListBox * m_pResultBox;
+ KviTalListBox * m_pResultBox;
QLineEdit * m_pTermsEdit;
public:
KviHelpWidget * helpWidget(){ return m_pHelpWidget; };
diff --git a/src/modules/links/linkswindow.cpp b/src/modules/links/linkswindow.cpp
index 35d76fa7a..e8e06fb84 100644
--- a/src/modules/links/linkswindow.cpp
+++ b/src/modules/links/linkswindow.cpp
@@ -66,14 +66,14 @@ KviLinksWindow::KviLinksWindow(KviFrame * lpFrm,KviConsole * lpConsole)
m_pSplitter = new QSplitter(QSplitter::Horizontal,this,"splitter");
m_pVertSplitter = new QSplitter(QSplitter::Vertical,m_pSplitter,"vsplitter");
- m_pListView = new QListView(m_pVertSplitter);
+ m_pListView = new KviTalListView(m_pVertSplitter);
m_pListView->addColumn(__tr2qs("Link"));
m_pListView->addColumn(__tr2qs("Hops"));
m_pListView->addColumn(__tr2qs("Description"));
m_pListView->setRootIsDecorated(true);
m_pListView->setAllColumnsShowFocus(true);
- connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this,SLOT(showHostPopup(QListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
+ this,SLOT(showHostPopup(KviTalListViewItem *,const QPoint &,int)));
m_pIrcView = new KviIrcView(m_pVertSplitter,lpFrm,this);
@@ -194,8 +194,8 @@ void KviLinksWindow::endOfLinks()
outputNoFmt(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Received end of links."));
outputNoFmt(KVI_OUT_SYSTEMMESSAGE,"======================");
- QListViewItem * it = 0;
- QListViewItem * root = 0;
+ KviTalListViewItem * it = 0;
+ KviTalListViewItem * root = 0;
int totalHosts = 0;
int totalHops = 0;
@@ -213,7 +213,7 @@ void KviLinksWindow::endOfLinks()
m_pListView->setUpdatesEnabled(false);
for(KviLink *l=m_pLinkList->first();l;l=m_pLinkList->next()){
totalHosts++;
- if(l->hops == 0)root = new QListViewItem(m_pListView,QString(l->host.ptr()),"0",QString(l->description.ptr()));
+ if(l->hops == 0)root = new KviTalListViewItem(m_pListView,QString(l->host.ptr()),"0",QString(l->description.ptr()));
else {
totalHops += l->hops;
if(l->hops < 4){
@@ -237,10 +237,10 @@ void KviLinksWindow::endOfLinks()
brokenLinks++;
KviStr tmp(KviStr::Format,__tr2qs("%s: Parent link %s"),l->description.ptr(),l->parent.ptr());
KviStr tmp2(KviStr::Format,"%d",l->hops);
- if(root)it = new QListViewItem(m_pListView,root,QString(l->host.ptr()),QString(tmp2.ptr()),QString(tmp.ptr()));
+ if(root)it = new KviTalListViewItem(m_pListView,root,QString(l->host.ptr()),QString(tmp2.ptr()),QString(tmp.ptr()));
else {
outputNoFmt(KVI_OUT_SYSTEMERROR,__tr2qs("Warning: No root link was sent by the server, the stats may be invalid."));
- it = new QListViewItem(m_pListView,QString(l->host.ptr()),QString(tmp2.ptr()),QString(tmp.ptr()));
+ it = new KviTalListViewItem(m_pListView,QString(l->host.ptr()),QString(tmp2.ptr()),QString(tmp.ptr()));
}
} else {
it = it->parent();
@@ -304,35 +304,35 @@ void KviLinksWindow::endOfLinks()
m_pListView->repaint();
}
-QListViewItem * KviLinksWindow::insertLink(KviLink *l)
+KviTalListViewItem * KviLinksWindow::insertLink(KviLink *l)
{
__range_valid(l->hops > 0);
- QListViewItem * i = getItemByHost(l->parent.ptr(),0);
- QListViewItem * it = 0;
+ KviTalListViewItem * i = getItemByHost(l->parent.ptr(),0);
+ KviTalListViewItem * it = 0;
if(!i)return 0;
else {
KviStr hops(KviStr::Format,"%d",l->hops);
- it = new QListViewItem(i,QString(l->host.ptr()),QString(hops.ptr()),QString(l->description.ptr()));
+ it = new KviTalListViewItem(i,QString(l->host.ptr()),QString(hops.ptr()),QString(l->description.ptr()));
i->setOpen(true);
}
return it;
}
-QListViewItem * KviLinksWindow::getItemByHost(const char *host,QListViewItem * par)
+KviTalListViewItem * KviLinksWindow::getItemByHost(const char *host,KviTalListViewItem * par)
{
- QListViewItem * i = (par ? par->firstChild() : m_pListView->firstChild());
+ KviTalListViewItem * i = (par ? par->firstChild() : m_pListView->firstChild());
if(!i)return 0;
while(i){
KviStr tmp = i->text(0);
if(kvi_strEqualCI(tmp.ptr(),host))return i;
- QListViewItem * ch = getItemByHost(host,i);
+ KviTalListViewItem * ch = getItemByHost(host,i);
if(ch)return ch;
i = i->nextSibling();
}
return 0;
}
-void KviLinksWindow::showHostPopup(QListViewItem *i,const QPoint &p,int)
+void KviLinksWindow::showHostPopup(KviTalListViewItem *i,const QPoint &p,int)
{
if(!i)return;
KviStr host=i->text(0);
diff --git a/src/modules/links/linkswindow.h b/src/modules/links/linkswindow.h
index 8de5b8be2..f89129b5a 100644
--- a/src/modules/links/linkswindow.h
+++ b/src/modules/links/linkswindow.h
@@ -29,7 +29,7 @@
#include "kvi_console.h"
#include "kvi_irccontext.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include "kvi_tal_popupmenu.h"
#include <qtoolbutton.h>
@@ -54,7 +54,7 @@ public:
protected:
QSplitter * m_pVertSplitter;
QSplitter * m_pTopSplitter;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
KviPtrList<KviLink> * m_pLinkList;
KviTalPopupMenu * m_pHostPopup;
QString m_szRootServer;
@@ -73,7 +73,7 @@ protected:
// virtual void setProperties(KviWindowProperty *p);
// virtual void saveProperties();
protected slots:
- void showHostPopup(QListViewItem *i,const QPoint &p,int c);
+ void showHostPopup(KviTalListViewItem *i,const QPoint &p,int c);
void hostPopupClicked(int id);
void requestLinks();
void connectionStateChange();
@@ -82,8 +82,8 @@ public:
private:
void reset();
void endOfLinks();
- QListViewItem * insertLink(KviLink * l);
- QListViewItem * getItemByHost(const char *host,QListViewItem * par);
+ KviTalListViewItem * insertLink(KviLink * l);
+ KviTalListViewItem * getItemByHost(const char *host,KviTalListViewItem * par);
};
#endif //_KVI_LINKSWINDOW_H_
diff --git a/src/modules/list/listwindow.cpp b/src/modules/list/listwindow.cpp
index 32d0be5d9..81254e647 100644
--- a/src/modules/list/listwindow.cpp
+++ b/src/modules/list/listwindow.cpp
@@ -69,8 +69,8 @@ KviChannelListViewItemData::~KviChannelListViewItemData()
-KviChannelListViewItem::KviChannelListViewItem(QListView * v,KviChannelListViewItemData * pData)
-: QListViewItem(v)
+KviChannelListViewItem::KviChannelListViewItem(KviTalListView * v,KviChannelListViewItemData * pData)
+: KviTalListViewItem(v)
{
m_pData = pData;
}
@@ -81,7 +81,7 @@ KviChannelListViewItem::~KviChannelListViewItem()
delete m_pData;
}
-int KviChannelListViewItem::width ( const QFontMetrics & fm, const QListView * lv, int column ) const
+int KviChannelListViewItem::width ( const QFontMetrics & fm, const KviTalListView * lv, int column ) const
{
QString szText;
@@ -109,7 +109,7 @@ void KviChannelListViewItem::paintCell(QPainter * p,const QColorGroup &cg,int co
default: szText = m_pData->m_szTopic; break;
}
- QListView* lv = listView();
+ KviTalListView* lv = (KviTalListView *)listView();
int marg = lv->itemMargin();
int r = marg;
@@ -194,14 +194,14 @@ KviListWindow::KviListWindow(KviFrame * lpFrm,KviConsole * lpConsole)
m_pInfoLabel = new KviThemedLabel(m_pTopSplitter,"info_label");
- m_pListView = new QListView(m_pVertSplitter);
+ m_pListView = new KviTalListView(m_pVertSplitter);
m_pListView->addColumn(__tr2qs("Channel"));
m_pListView->addColumn(__tr2qs("Users"));
m_pListView->addColumn(__tr2qs("Topic"));
m_pListView->setAllColumnsShowFocus(TRUE);
m_pListView->setSorting(100);
- connect(m_pListView,SIGNAL(doubleClicked(QListViewItem *)),this,SLOT(itemDoubleClicked(QListViewItem *)));
+ connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem *)),this,SLOT(itemDoubleClicked(KviTalListViewItem *)));
m_pIrcView = new KviIrcView(m_pVertSplitter,lpFrm,this);
@@ -388,7 +388,7 @@ void KviListWindow::flush()
m_pListView->viewport()->update();
}
-void KviListWindow::itemDoubleClicked(QListViewItem *it)
+void KviListWindow::itemDoubleClicked(KviTalListViewItem *it)
{
QString sz = ((KviChannelListViewItem *)it)->channel();
if(sz.isEmpty())return;
diff --git a/src/modules/list/listwindow.h b/src/modules/list/listwindow.h
index 4bce65750..009522662 100644
--- a/src/modules/list/listwindow.h
+++ b/src/modules/list/listwindow.h
@@ -32,7 +32,7 @@
#include "kvi_console.h"
#include "kvi_irccontext.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include "kvi_tal_popupmenu.h"
#include <qtoolbutton.h>
#include <qlineedit.h>
@@ -52,16 +52,16 @@ protected:
QString m_szUsersKey;
};
-class KviChannelListViewItem : public QListViewItem
+class KviChannelListViewItem : public KviTalListViewItem
{
public:
- KviChannelListViewItem(QListView * v,KviChannelListViewItemData * pData);
+ KviChannelListViewItem(KviTalListView * v,KviChannelListViewItemData * pData);
~KviChannelListViewItem();
protected:
KviChannelListViewItemData * m_pData;
public:
const QString & channel(){ return m_pData->m_szChan; };
- virtual int width ( const QFontMetrics & fm, const QListView * lv, int c ) const;
+ virtual int width ( const QFontMetrics & fm, const KviTalListView * lv, int c ) const;
protected:
virtual void paintCell(QPainter * p,const QColorGroup &cg,int col,int wdth,int align);
virtual QString key(int col,bool) const;
@@ -78,7 +78,7 @@ public:
protected:
QSplitter * m_pVertSplitter;
QSplitter * m_pTopSplitter;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLineEdit * m_pParamsEdit;
QToolButton * m_pRequestButton;
QToolButton * m_pStopListDownloadButton;
@@ -97,7 +97,7 @@ protected:
virtual void getBaseLogFileName(KviStr &buffer);
protected slots:
void flush();
- void itemDoubleClicked(QListViewItem *it);
+ void itemDoubleClicked(KviTalListViewItem *it);
void requestList();
void stoplistdownload();
void connectionStateChange();
diff --git a/src/modules/logview/logviewmdiwindow.cpp b/src/modules/logview/logviewmdiwindow.cpp
index 91be75ce1..951d33f8c 100644
--- a/src/modules/logview/logviewmdiwindow.cpp
+++ b/src/modules/logview/logviewmdiwindow.cpp
@@ -35,7 +35,7 @@
#include <qpixmap.h>
#include <qsplitter.h>
#include <qtoolbutton.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qfileinfo.h>
#include <qdir.h>
#include "kvi_tal_popupmenu.h"
@@ -59,15 +59,15 @@ KviLogViewMDIWindow::KviLogViewMDIWindow(KviModuleExtensionDescriptor * d,KviFra
m_pIndexTab = new KviTalVBox(m_pTabWidget);
m_pTabWidget->insertTab(m_pIndexTab,__tr2qs_ctx("Index","logview"));
- m_pListView = new QListView(m_pIndexTab);
+ m_pListView = new KviTalListView(m_pIndexTab);
m_pListView->addColumn(__tr2qs_ctx("Log File","logview"),135);
- m_pListView->setColumnWidthMode(0,QListView::Maximum);
+ m_pListView->setColumnWidthMode(0,KviTalListView::Maximum);
m_pListView->setAllColumnsShowFocus(true);
m_pListView->setMultiSelection(false);
m_pListView->setShowSortIndicator(true);
m_pListView->setRootIsDecorated(true);
- connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(itemSelected(QListViewItem *)));
- connect(m_pListView,SIGNAL(rightButtonClicked ( QListViewItem * , const QPoint &, int )),this,SLOT(rightButtonClicked ( QListViewItem * , const QPoint &, int )));
+ connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(itemSelected(KviTalListViewItem *)));
+ connect(m_pListView,SIGNAL(rightButtonClicked ( KviTalListViewItem * , const QPoint &, int )),this,SLOT(rightButtonClicked ( KviTalListViewItem * , const QPoint &, int )));
//m_pSearchTab = new KviTalVBox(m_pTabWidget);
//m_pTabWidget->insertTab(m_pSearchTab,__tr2qs_ctx("Search","logview"));
@@ -214,7 +214,7 @@ void KviLogViewMDIWindow::oneTimeSetup()
}
}
-void KviLogViewMDIWindow::itemSelected(QListViewItem * it)
+void KviLogViewMDIWindow::itemSelected(KviTalListViewItem * it)
{
bool bCompressed=0;
//A parent node
@@ -289,7 +289,7 @@ QStringList KviLogViewMDIWindow::getFileNames()
return logDir.entryList();
}
-void KviLogViewMDIWindow::rightButtonClicked ( QListViewItem * it, const QPoint &, int )
+void KviLogViewMDIWindow::rightButtonClicked ( KviTalListViewItem * it, const QPoint &, int )
{
if(!it) return;
if(((KviLogListViewItem *)it)->fileName(0).isEmpty()) return;
diff --git a/src/modules/logview/logviewmdiwindow.h b/src/modules/logview/logviewmdiwindow.h
index a106e98bf..02cb8a387 100644
--- a/src/modules/logview/logviewmdiwindow.h
+++ b/src/modules/logview/logviewmdiwindow.h
@@ -26,11 +26,11 @@
#include "kvi_moduleextension.h"
#include "kvi_tal_vbox.h"
+#include "kvi_tal_listview.h"
#include <qtabwidget.h>
-class QListView;
+class KviTalListView;
class QStringList;
-class QListViewItem;
class KviLogViewWidget;
class KviLogViewMDIWindow : public KviWindow , public KviModuleExtension
@@ -40,7 +40,7 @@ public:
KviLogViewMDIWindow(KviModuleExtensionDescriptor * d,KviFrame * lpFrm);
~KviLogViewMDIWindow();
protected:
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QStringList * m_pFileNames;
QString m_szLogDirectory;
QTabWidget * m_pTabWidget;
@@ -57,8 +57,8 @@ protected:
virtual void die();
virtual QSize sizeHint() const;
protected slots:
- void rightButtonClicked ( QListViewItem *, const QPoint &, int );
- void itemSelected(QListViewItem * it);
+ void rightButtonClicked ( KviTalListViewItem *, const QPoint &, int );
+ void itemSelected(KviTalListViewItem * it);
void deleteCurrent();
};
diff --git a/src/modules/logview/logviewwidget.h b/src/modules/logview/logviewwidget.h
index f97c98598..bc0ef146a 100644
--- a/src/modules/logview/logviewwidget.h
+++ b/src/modules/logview/logviewwidget.h
@@ -26,18 +26,18 @@
#include "kvi_window.h"
#include "kvi_scripteditor.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
class KviScriptEditor;
-class KviLogListViewItem : public QListViewItem
+class KviLogListViewItem : public KviTalListViewItem
{
public:
- KviLogListViewItem(QListViewItem * par, const QString & typeName, const QString & name)
- : QListViewItem(par), m_szTypeName(typeName), m_szName(name) {};
- KviLogListViewItem(QListView * par, const QString & typeName, const QString & name)
- : QListViewItem(par), m_szTypeName(typeName), m_szName(name) {};
+ KviLogListViewItem(KviTalListViewItem * par, const QString & typeName, const QString & name)
+ : KviTalListViewItem(par), m_szTypeName(typeName), m_szName(name) {};
+ KviLogListViewItem(KviTalListView * par, const QString & typeName, const QString & name)
+ : KviTalListViewItem(par), m_szTypeName(typeName), m_szName(name) {};
~KviLogListViewItem() {};
public:
QString m_szTypeName;
@@ -50,7 +50,7 @@ public:
class KviLogListViewItemType : public KviLogListViewItem
{
public:
- KviLogListViewItemType(QListView * par, const QString & typeName)
+ KviLogListViewItemType(KviTalListView * par, const QString & typeName)
: KviLogListViewItem(par,typeName,typeName) {};
~KviLogListViewItemType() {};
public:
@@ -61,7 +61,7 @@ public:
class KviLogListViewLog : public KviLogListViewItem
{
public:
- KviLogListViewLog(QListViewItem * par,const QString & date, const QString & fileName, const QString & owner)
+ KviLogListViewLog(KviTalListViewItem * par,const QString & date, const QString & fileName, const QString & owner)
: KviLogListViewItem(par,"",date), m_szFileName(fileName), m_szOwner(owner) {};
~KviLogListViewLog() {};
public:
diff --git a/src/modules/mediaplayer/mp_amarokinterface.cpp b/src/modules/mediaplayer/mp_amarokinterface.cpp
index ee996e54b..e12c9c2cb 100644
--- a/src/modules/mediaplayer/mp_amarokinterface.cpp
+++ b/src/modules/mediaplayer/mp_amarokinterface.cpp
@@ -48,7 +48,7 @@ MP_IMPLEMENT_DESCRIPTOR(
KviAmarokInterface::KviAmarokInterface()
-: KviMediaPlayerDCOPInterface("amarok")
+ : KviDCOPHelper(true, "amarok")
{
}
@@ -58,28 +58,28 @@ KviAmarokInterface::~KviAmarokInterface()
int KviAmarokInterface::detect(bool bStart){ return detectApp("amarok",bStart,95,99); }
-bool KviAmarokInterface::prev(){ return simpleDCOPCall("player","prev()"); }
-bool KviAmarokInterface::next(){ return simpleDCOPCall("player","next()"); }
-bool KviAmarokInterface::play(){ return simpleDCOPCall("player","play()"); }
-bool KviAmarokInterface::stop(){ return simpleDCOPCall("player","stop()"); }
-bool KviAmarokInterface::pause(){ return simpleDCOPCall("player","pause()"); }
-bool KviAmarokInterface::mute(){ return simpleDCOPCall("player","mute()"); }
-bool KviAmarokInterface::quit(){ return simpleDCOPCall("MainApplication-Interface","quit()"); }
+bool KviAmarokInterface::prev(){ return voidRetVoidDCOPCall("player","prev()"); }
+bool KviAmarokInterface::next(){ return voidRetVoidDCOPCall("player","next()"); }
+bool KviAmarokInterface::play(){ return voidRetVoidDCOPCall("player","play()"); }
+bool KviAmarokInterface::stop(){ return voidRetVoidDCOPCall("player","stop()"); }
+bool KviAmarokInterface::pause(){ return voidRetVoidDCOPCall("player","pause()"); }
+bool KviAmarokInterface::mute(){ return voidRetVoidDCOPCall("player","mute()"); }
+bool KviAmarokInterface::quit(){ return voidRetVoidDCOPCall("MainApplication-Interface","quit()"); }
bool KviAmarokInterface::jumpTo(int &iPos)
{
- return intDCOPCall("player","seek(int)",iPos/1000);
+ return voidRetIntDCOPCall("player","seek(int)",iPos/1000);
}
bool KviAmarokInterface::setVol(int &iVol)
{
- return intDCOPCall("player","setVolume(int)",100*iVol/255);
+ return voidRetIntDCOPCall("player","setVolume(int)",100*iVol/255);
}
#define MP_DCOP_STRING_CALL(_fncname,_iface,_fnc) \
QString KviAmarokInterface::_fncname() \
{ \
QString ret; \
- if(!stringRetDCOPCall(_iface,_fnc,ret))return false; \
+ if(!stringRetVoidDCOPCall(_iface,_fnc,ret))return false; \
return ret; \
}
@@ -94,59 +94,59 @@ MP_DCOP_STRING_CALL(album,"player","album()")
int KviAmarokInterface::getVol()
{
int ret;
- if(!intRetDCOPCall("player","getVolume()",ret))return false;
+ if(!intRetVoidDCOPCall("player","getVolume()",ret))return false;
return ret * 255 / 100;
}
int KviAmarokInterface::sampleRate()
{
int ret;
- if(!intRetDCOPCall("player","sampleRate()",ret))return false;
+ if(!intRetVoidDCOPCall("player","sampleRate()",ret))return false;
return ret;
}
int KviAmarokInterface::length()
{
int ret;
- if(!intRetDCOPCall("player","trackTotalTime()",ret))return false;
+ if(!intRetVoidDCOPCall("player","trackTotalTime()",ret))return false;
return ret * 1000;
}
int KviAmarokInterface::position()
{
int ret;
- if(!intRetDCOPCall("player","trackCurrentTime()",ret))return false;
+ if(!intRetVoidDCOPCall("player","trackCurrentTime()",ret))return false;
return ret * 1000;
}
bool KviAmarokInterface::getRepeat()
{
bool ret;
- if(!boolRetDCOPCall("player","repeatTrackStatus()",ret))return false;
+ if(!boolRetVoidDCOPCall("player","repeatTrackStatus()",ret))return false;
return ret;
}
bool KviAmarokInterface::getShuffle()
{
bool ret;
- if(!boolRetDCOPCall("player","randomModeStatus()",ret))return false;
+ if(!boolRetVoidDCOPCall("player","randomModeStatus()",ret))return false;
return ret;
}
bool KviAmarokInterface::setRepeat(bool &bVal)
{
- return boolDCOPCall("player","enableRepeatTrack(bool)",bVal);
+ return voidRetBoolDCOPCall("player","enableRepeatTrack(bool)",bVal);
}
bool KviAmarokInterface::setShuffle(bool &bVal)
{
- return boolDCOPCall("player","enableRandomMode(bool)",bVal);
+ return voidRetBoolDCOPCall("player","enableRandomMode(bool)",bVal);
}
KviMediaPlayerInterface::PlayerStatus KviAmarokInterface::status()
{
int ret;
- if(!intRetDCOPCall("player","status()",ret))return KviMediaPlayerInterface::Unknown;
+ if(!intRetVoidDCOPCall("player","status()",ret))return KviMediaPlayerInterface::Unknown;
switch(ret)
{
case 0:
@@ -168,7 +168,7 @@ KviMediaPlayerInterface::PlayerStatus KviAmarokInterface::status()
QString KviAmarokInterface::mrl()
{
QString ret;
- if(!stringRetDCOPCall("player","encodedURL()",ret))return false;
+ if(!stringRetVoidDCOPCall("player","encodedURL()",ret))return false;
KURL url(ret);
return url.prettyURL();
}
diff --git a/src/modules/mediaplayer/mp_amarokinterface.h b/src/modules/mediaplayer/mp_amarokinterface.h
index f19d07772..81463a382 100644
--- a/src/modules/mediaplayer/mp_amarokinterface.h
+++ b/src/modules/mediaplayer/mp_amarokinterface.h
@@ -28,9 +28,10 @@
#ifdef COMPILE_KDE_SUPPORT
- #include "mp_dcopinterface.h"
+ #include "kvi_dcophelper.h"
+ #include "mp_interface.h"
- class KviAmarokInterface : public KviMediaPlayerDCOPInterface
+ class KviAmarokInterface : public KviMediaPlayerInterface, private KviDCOPHelper
{
public:
KviAmarokInterface();
diff --git a/src/modules/mediaplayer/mp_jukinterface.cpp b/src/modules/mediaplayer/mp_jukinterface.cpp
index 0b31ebedf..3e89a408f 100644
--- a/src/modules/mediaplayer/mp_jukinterface.cpp
+++ b/src/modules/mediaplayer/mp_jukinterface.cpp
@@ -50,7 +50,7 @@ MP_IMPLEMENT_DESCRIPTOR(
KviJukInterface::KviJukInterface()
-: KviMediaPlayerDCOPInterface("amarok")
+ : KviDCOPHelper(true, "amarok")
{
}
@@ -60,27 +60,27 @@ KviJukInterface::~KviJukInterface()
int KviJukInterface::detect(bool bStart){ return detectApp("juk",bStart,90,96); }
-bool KviJukInterface::prev(){ return simpleDCOPCall("Player","forward()"); }
-bool KviJukInterface::next(){ return simpleDCOPCall("Player","back()"); }
-bool KviJukInterface::play(){ return simpleDCOPCall("Player","play()"); }
-bool KviJukInterface::stop(){ return simpleDCOPCall("Player","stop()"); }
-bool KviJukInterface::pause(){ return simpleDCOPCall("Player","pause()"); }
-bool KviJukInterface::quit(){ return simpleDCOPCall("MainApplication-Interface","quit()"); }
+bool KviJukInterface::prev(){ return voidRetVoidDCOPCall("Player","forward()"); }
+bool KviJukInterface::next(){ return voidRetVoidDCOPCall("Player","back()"); }
+bool KviJukInterface::play(){ return voidRetVoidDCOPCall("Player","play()"); }
+bool KviJukInterface::stop(){ return voidRetVoidDCOPCall("Player","stop()"); }
+bool KviJukInterface::pause(){ return voidRetVoidDCOPCall("Player","pause()"); }
+bool KviJukInterface::quit(){ return voidRetVoidDCOPCall("MainApplication-Interface","quit()"); }
bool KviJukInterface::setVol(int &iVol)
{
- return floatDCOPCall("player","setVolume(float)",(float)(iVol)/255.);
+ return voidRetFloatDCOPCall("player","setVolume(float)",(float)(iVol)/255.);
}
bool KviJukInterface::jumpTo(int &iPos)
{
- return intDCOPCall("player","seek(int)",iPos/1000);
+ return voidRetIntDCOPCall("player","seek(int)",iPos/1000);
}
bool KviJukInterface::getShuffle()
{
QString szMode;
- if(!stringRetDCOPCall("player","randomPlayMode()",szMode))return false;
+ if(!stringRetVoidDCOPCall("player","randomPlayMode()",szMode))return false;
return (szMode != "NoRandom");
}
@@ -93,7 +93,7 @@ bool KviJukInterface::setShuffle(bool &bVal)
} else {
szMode = "NoRandom";
}
- if(!stringDCOPCall("player","setRandomPlayMode(QString)",szMode))return false;
+ if(!voidRetStringDCOPCall("player","setRandomPlayMode(QString)",szMode))return false;
return true;
}
@@ -102,7 +102,7 @@ bool KviJukInterface::setShuffle(bool &bVal)
QString KviJukInterface::_fncname() \
{ \
QString ret; \
- if(!stringRetDCOPCall(_iface,_fnc,ret))return false; \
+ if(!stringRetVoidDCOPCall(_iface,_fnc,ret))return false; \
return ret; \
}
@@ -121,7 +121,7 @@ MP_DCOP_STRING_CALL(album,"player","album()")
int KviJukInterface::sampleRate()
{
int ret;
- if(!intRetDCOPCall("player","sampleRate()",ret))return false;
+ if(!intRetVoidDCOPCall("player","sampleRate()",ret))return false;
return ret;
}
*/
@@ -129,21 +129,21 @@ int KviJukInterface::sampleRate()
int KviJukInterface::length()
{
int ret;
- if(!intRetDCOPCall("player","totalTime()",ret))return false;
+ if(!intRetVoidDCOPCall("player","totalTime()",ret))return false;
return ret * 1000;
}
int KviJukInterface::position()
{
int ret;
- if(!intRetDCOPCall("player","currentTime()",ret))return false;
+ if(!intRetVoidDCOPCall("player","currentTime()",ret))return false;
return ret * 1000;
}
KviMediaPlayerInterface::PlayerStatus KviJukInterface::status()
{
int ret;
- if(!intRetDCOPCall("player","status()",ret))return KviMediaPlayerInterface::Unknown;
+ if(!intRetVoidDCOPCall("player","status()",ret))return KviMediaPlayerInterface::Unknown;
switch(ret)
{
case 0:
diff --git a/src/modules/mediaplayer/mp_jukinterface.h b/src/modules/mediaplayer/mp_jukinterface.h
index 61685d992..80b55dfdd 100644
--- a/src/modules/mediaplayer/mp_jukinterface.h
+++ b/src/modules/mediaplayer/mp_jukinterface.h
@@ -29,9 +29,10 @@
#ifdef COMPILE_KDE_SUPPORT
- #include "mp_dcopinterface.h"
+ #include "kvi_dcophelper.h"
+ #include "mp_interface.h"
- class KviJukInterface : public KviMediaPlayerDCOPInterface
+ class KviJukInterface : public KviMediaPlayerInterface, private KviDCOPHelper
{
public:
KviJukInterface();
diff --git a/src/modules/objects/class_listbox.cpp b/src/modules/objects/class_listbox.cpp
index efd576acd..56ce9d3ee 100644
--- a/src/modules/objects/class_listbox.cpp
+++ b/src/modules/objects/class_listbox.cpp
@@ -26,7 +26,7 @@
#include "kvi_debug.h"
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
#include "class_list.h"
#include "class_listbox.h"
@@ -149,12 +149,12 @@ KVSO_END_CONSTRUCTOR(KviKvsObject_listbox)
bool KviKvsObject_listbox::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams)
{
- QListBox * b = new QListBox(parentScriptWidget(), name());
- b->setSelectionMode(QListBox::Single);
+ KviTalListBox * b = new KviTalListBox(parentScriptWidget());
+ b->setSelectionMode(KviTalListBox::Single);
connect(b,SIGNAL(selectionChanged()),this,SLOT(selectionChanged()));
- connect(b,SIGNAL(currentChanged(QListBoxItem *)),this,SLOT(currentItemChanged(QListBoxItem *)));
+ connect(b,SIGNAL(currentChanged(KviTalListBoxItem *)),this,SLOT(currentItemChanged(KviTalListBoxItem *)));
- connect(b,SIGNAL(onItem(QListBoxItem *)),this,SLOT(onItem(QListBoxItem *)));
+ connect(b,SIGNAL(onItem(KviTalListBoxItem *)),this,SLOT(onItem(KviTalListBoxItem *)));
setObject(b,true);;
return true;
@@ -169,12 +169,12 @@ bool KviKvsObject_listbox::functioninsertItem(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("index",KVS_PT_INT,KVS_PF_OPTIONAL,iIndex)
KVSO_PARAMETERS_END(c)
if(widget())
- ((QListBox *)widget())->insertItem(szItem, iIndex);
+ ((KviTalListBox *)widget())->insertItem(szItem, iIndex);
return true;
}
bool KviKvsObject_listbox::functionclear(KviKvsObjectFunctionCall *c)
{
- if (widget()) ((QListBox *)widget())->clear();
+ if (widget()) ((KviTalListBox *)widget())->clear();
return true;
}
bool KviKvsObject_listbox::functionchangeItem(KviKvsObjectFunctionCall *c)
@@ -188,14 +188,14 @@ bool KviKvsObject_listbox::functionchangeItem(KviKvsObjectFunctionCall *c)
KVSO_PARAMETERS_END(c)
if(!widget()) return true;
if (szText.isEmpty()) c->warning(__tr2qs("No string parameter given - using empty string"));
- if(uIndex >= (cnt = ((QListBox *)widget())->count()))
+ if(uIndex >= (cnt = ((KviTalListBox *)widget())->count()))
{
c->warning(__tr2qs("Item index [%d] is too big - defaulting to " \
"$count() - 1 [%d]"), uIndex, cnt);
uIndex = cnt - 1;
}
- ((QListBox *)widget())->changeItem(szText, uIndex);
+ ((KviTalListBox *)widget())->changeItem(szText, uIndex);
return true;
@@ -208,14 +208,14 @@ bool KviKvsObject_listbox::functionremoveItem(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex)
KVSO_PARAMETERS_END(c)
if(!widget()) return true;
- if(uIndex >= (cnt = ((QListBox *)widget())->count()))
+ if(uIndex >= (cnt = ((KviTalListBox *)widget())->count()))
{
c->warning(__tr2qs("Item index [%d] is too big - defaulting to " \
"$count() - 1 [%d]"), uIndex, cnt);
uIndex = cnt - 1;
}
- ((QListBox *)widget())->removeItem(uIndex);
+ ((KviTalListBox *)widget())->removeItem(uIndex);
return true;
@@ -223,17 +223,17 @@ bool KviKvsObject_listbox::functionremoveItem(KviKvsObjectFunctionCall *c)
bool KviKvsObject_listbox::functioncount(KviKvsObjectFunctionCall *c)
{
- if (widget()) c->returnValue()->setInteger(((QListBox *)widget())->count());
+ if (widget()) c->returnValue()->setInteger(((KviTalListBox *)widget())->count());
return true;
}
bool KviKvsObject_listbox::functioncurrentText(KviKvsObjectFunctionCall *c)
{
- if (widget()) c->returnValue()->setString(((QListBox *)widget())->currentText().local8Bit().data());
+ if (widget()) c->returnValue()->setString(((KviTalListBox *)widget())->currentText().local8Bit().data());
return true;
}
bool KviKvsObject_listbox::functioncurrentItem(KviKvsObjectFunctionCall *c)
{
- if (widget()) c->returnValue()->setInteger(((QListBox *)widget())->currentItem());
+ if (widget()) c->returnValue()->setInteger(((KviTalListBox *)widget())->currentItem());
return true;
}
@@ -245,7 +245,7 @@ bool KviKvsObject_listbox::functiontextAt(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex)
KVSO_PARAMETERS_END(c)
if(widget())
- c->returnValue()->setString(((QListBox *)widget())->text(uIndex));
+ c->returnValue()->setString(((KviTalListBox *)widget())->text(uIndex));
return true;
}
bool KviKvsObject_listbox::functionsetCurrentItem(KviKvsObjectFunctionCall *c)
@@ -255,7 +255,7 @@ bool KviKvsObject_listbox::functionsetCurrentItem(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex)
KVSO_PARAMETERS_END(c)
if(widget())
- ((QListBox *)widget())->setCurrentItem(uIndex);
+ ((KviTalListBox *)widget())->setCurrentItem(uIndex);
return true;
}
bool KviKvsObject_listbox::functionsetSelectionMode(KviKvsObjectFunctionCall *c)
@@ -265,18 +265,18 @@ bool KviKvsObject_listbox::functionsetSelectionMode(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("selection_mode",KVS_PT_STRING,0,szMode)
KVSO_PARAMETERS_END(c)
if(!widget()) return true;
- QListBox::SelectionMode iMode = QListBox::Single;
+ KviTalListBox::SelectionMode iMode = KviTalListBox::Single;
- if(KviQString::equalCI(szMode,"single")) iMode = QListBox::Single;
+ if(KviQString::equalCI(szMode,"single")) iMode = KviTalListBox::Single;
- else if(KviQString::equalCI(szMode,"multi")) iMode = QListBox::Multi;
+ else if(KviQString::equalCI(szMode,"multi")) iMode = KviTalListBox::Multi;
- else if(KviQString::equalCI(szMode,"extended")) iMode = QListBox::Extended;
+ else if(KviQString::equalCI(szMode,"extended")) iMode = KviTalListBox::Extended;
- else if(KviQString::equalCI(szMode,"none")) iMode = QListBox::NoSelection;
+ else if(KviQString::equalCI(szMode,"none")) iMode = KviTalListBox::NoSelection;
else c->warning(__tr2qs("Invalid selection mode '%Q' assuming single"),&szMode);
- ((QListBox *)widget())->setSelectionMode(iMode);
+ ((KviTalListBox *)widget())->setSelectionMode(iMode);
return true;
}
@@ -284,12 +284,12 @@ bool KviKvsObject_listbox::functionselectionMode(KviKvsObjectFunctionCall *c)
{
if(!widget()) return true;
- switch(((QListBox *)widget())->selectionMode())
+ switch(((KviTalListBox *)widget())->selectionMode())
{
- case QListBox::Single: c->returnValue()->setString("single"); break;
- case QListBox::Multi: c->returnValue()->setString("multi"); break;
- case QListBox::Extended: c->returnValue()->setString("extended"); break;
- case QListBox::NoSelection: c->returnValue()->setString("none"); break;
+ case KviTalListBox::Single: c->returnValue()->setString("single"); break;
+ case KviTalListBox::Multi: c->returnValue()->setString("multi"); break;
+ case KviTalListBox::Extended: c->returnValue()->setString("extended"); break;
+ case KviTalListBox::NoSelection: c->returnValue()->setString("none"); break;
default: c->returnValue()->setString("single"); break;
}
return true;
@@ -302,7 +302,7 @@ bool KviKvsObject_listbox::functionisSelected(KviKvsObjectFunctionCall *c)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex)
KVSO_PARAMETERS_END(c)
- if(widget())c->returnValue()->setBoolean(((QListBox *)widget())->isSelected(uIndex));
+ if(widget())c->returnValue()->setBoolean(((KviTalListBox *)widget())->isSelected(uIndex));
return true;
}
bool KviKvsObject_listbox::functionsetSelected(KviKvsObjectFunctionCall *c)
@@ -313,7 +313,7 @@ bool KviKvsObject_listbox::functionsetSelected(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,uIndex)
KVSO_PARAMETER("benabled",KVS_PT_BOOLEAN,0,bSel)
KVSO_PARAMETERS_END(c)
- if(widget()) ((QListBox *)widget())->setSelected(uIndex,bSel);
+ if(widget()) ((KviTalListBox *)widget())->setSelected(uIndex,bSel);
return true;
}
bool KviKvsObject_listbox::functionitemAt(KviKvsObjectFunctionCall *c)
@@ -324,7 +324,7 @@ bool KviKvsObject_listbox::functionitemAt(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("uY",KVS_PT_UNSIGNEDINTEGER,0,uY)
KVSO_PARAMETERS_END(c)
if(widget())
- c->returnValue()->setInteger(((QListBox *)widget())->index(((QListBox *)widget())->itemAt(QPoint(uX,uY))));
+ c->returnValue()->setInteger(((KviTalListBox *)widget())->index(((KviTalListBox *)widget())->itemAt(QPoint(uX,uY))));
return true;
}
@@ -341,7 +341,7 @@ void KviKvsObject_listbox::selectionChanged()
callFunction(this,"selectionChangeEvent",0,0);
}
-void KviKvsObject_listbox::currentItemChanged(QListBoxItem *item)
+void KviKvsObject_listbox::currentItemChanged(KviTalListBoxItem *item)
{
if (!item) callFunction(this,"currentItemChangeEvent",0,0);
else
@@ -358,9 +358,9 @@ bool KviKvsObject_listbox::functiononItemEvent(KviKvsObjectFunctionCall *c)
return true;
}
-void KviKvsObject_listbox::onItem(QListBoxItem *item)
+void KviKvsObject_listbox::onItem(KviTalListBoxItem *item)
{
- QListBox *lbx(item->listBox());
+ KviTalListBox *lbx = (KviTalListBox *)(item->listBox());
KviKvsVariantList params(new KviKvsVariant((kvs_int_t)lbx->index(item)));
callFunction(this,"onItemEvent",0,&params);
}
@@ -374,7 +374,7 @@ kvs_uint_t uIndex;
KVSO_PARAMETERS_END(c)
if(widget())
{
- QRect rect=((QListBox *)widget())->itemRect(((QListBox *)widget())->item(uIndex));
+ QRect rect=((KviTalListBox *)widget())->itemRect(((KviTalListBox *)widget())->item(uIndex));
KviKvsArray * a = new KviKvsArray();
a->set(0,new KviKvsVariant((kvs_int_t)rect.left()));
a->set(1,new KviKvsVariant((kvs_int_t)rect.top()));
diff --git a/src/modules/objects/class_listbox.h b/src/modules/objects/class_listbox.h
index 30991927d..360f162bd 100644
--- a/src/modules/objects/class_listbox.h
+++ b/src/modules/objects/class_listbox.h
@@ -26,8 +26,8 @@
#include "class_widget.h"
-class QListBox;
-class QListBoxItem;
+class KviTalListBox;
+class KviTalListBoxItem;
#include "object_macros.h"
@@ -61,8 +61,8 @@ protected:
bool functionitemRect(KviKvsObjectFunctionCall *c);
protected slots:
void selectionChanged();
- void currentItemChanged(QListBoxItem *);
- void onItem(QListBoxItem *);
+ void currentItemChanged(KviTalListBoxItem *);
+ void onItem(KviTalListBoxItem *);
};
diff --git a/src/modules/objects/class_listview.cpp b/src/modules/objects/class_listview.cpp
index 347166d14..735a55384 100644
--- a/src/modules/objects/class_listview.cpp
+++ b/src/modules/objects/class_listview.cpp
@@ -25,7 +25,7 @@
//=================================================================================
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qheader.h>
#include "class_listview.h"
#include "kvi_error.h"
@@ -213,17 +213,17 @@ KVSO_END_CONSTRUCTOR(KviKvsObject_listview)
bool KviKvsObject_listview::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams)
{
setObject(new KviKvsMdmListView(parentScriptWidget(),name(),this),true);
- connect(widget(),SIGNAL(clicked(QListViewItem *)),this,SLOT(slotClicked(QListViewItem *)));
- connect(widget(),SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(slotSelectionChanged(QListViewItem *)));
+ connect(widget(),SIGNAL(clicked(KviTalListViewItem *)),this,SLOT(slotClicked(KviTalListViewItem *)));
+ connect(widget(),SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(slotSelectionChanged(KviTalListViewItem *)));
connect(widget(),SIGNAL(selectionChanged()),this,SLOT(slotMultipleSelectionChanged()));
- connect(widget(),SIGNAL(currentChanged(QListViewItem *)),this,SLOT(slotCurrentChanged(QListViewItem *)));
- connect(widget(),SIGNAL(returnPressed(QListViewItem *)),this,SLOT(slotReturnPressed(QListViewItem *)));
- connect(widget(),SIGNAL(spacePressed(QListViewItem *)),this,SLOT(slotSpacePressed(QListViewItem *)));
- connect(widget(),SIGNAL(onItem(QListViewItem *)),this,SLOT(slotOnItem(QListViewItem *)));
- connect(widget(),SIGNAL(expanded(QListViewItem *)),this,SLOT(slotItemExpanded(QListViewItem *)));
- connect(widget(),SIGNAL(collapsed(QListViewItem *)),this,SLOT(slotItemCollapsed(QListViewItem *)));
- connect(widget(),SIGNAL(rightButtonClicked(QListViewItem *,const QPoint &,int)),this,SLOT(slotRightButtonClicked(QListViewItem *,const QPoint &,int)));
- connect(widget(),SIGNAL(itemRenamed(QListViewItem *,int,const QString &)),this,SLOT(slotItemRenamed(QListViewItem *,int,const QString &)));
+ connect(widget(),SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(slotCurrentChanged(KviTalListViewItem *)));
+ connect(widget(),SIGNAL(returnPressed(KviTalListViewItem *)),this,SLOT(slotReturnPressed(KviTalListViewItem *)));
+ connect(widget(),SIGNAL(spacePressed(KviTalListViewItem *)),this,SLOT(slotSpacePressed(KviTalListViewItem *)));
+ connect(widget(),SIGNAL(onItem(KviTalListViewItem *)),this,SLOT(slotOnItem(KviTalListViewItem *)));
+ connect(widget(),SIGNAL(expanded(KviTalListViewItem *)),this,SLOT(slotItemExpanded(KviTalListViewItem *)));
+ connect(widget(),SIGNAL(collapsed(KviTalListViewItem *)),this,SLOT(slotItemCollapsed(KviTalListViewItem *)));
+ connect(widget(),SIGNAL(rightButtonClicked(KviTalListViewItem *,const QPoint &,int)),this,SLOT(slotRightButtonClicked(KviTalListViewItem *,const QPoint &,int)));
+ connect(widget(),SIGNAL(itemRenamed(KviTalListViewItem *,int,const QString &)),this,SLOT(slotItemRenamed(KviTalListViewItem *,int,const QString &)));
return true;
}
@@ -236,7 +236,7 @@ bool KviKvsObject_listview::function_addColumn(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("width",KVS_PT_INT,0,iW)
KVSO_PARAMETERS_END(c)
if (widget())
- ((QListView *)object())->addColumn(szLabel,iW);
+ ((KviTalListView *)object())->addColumn(szLabel,iW);
return true;
}
/*
@@ -247,21 +247,21 @@ bool KviKvsObject_listview::function_setAcceptDrops(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("bEnable",KVS_PT_BOOLEAN,0,bEnable)
KVSO_PARAMETERS_END(c)
if (widget())
- ((QListView *)object())->setAcceptDrops(bEnable);
+ ((KviTalListView *)object())->setAcceptDrops(bEnable);
return true;
}
*/
bool KviKvsObject_listview::function_clear(KviKvsObjectFunctionCall *c)
{
if (widget())
- ((QListView *)object())->clear();
+ ((KviTalListView *)object())->clear();
return true;
}
bool KviKvsObject_listview::function_selectedItem(KviKvsObjectFunctionCall *c)
{
if(widget())
- c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((QListView *)widget())->selectedItem()));
+ c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((KviTalListView *)widget())->selectedItem()));
else
c->returnValue()->setHObject((kvs_hobject_t)0);
return true;
@@ -270,7 +270,7 @@ bool KviKvsObject_listview::function_selectedItem(KviKvsObjectFunctionCall *c)
bool KviKvsObject_listview::function_firstChild(KviKvsObjectFunctionCall *c)
{
if(widget())
- c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((QListView *)widget())->firstChild()));
+ c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((KviTalListView *)widget())->firstChild()));
else
c->returnValue()->setHObject((kvs_hobject_t)0);
return true;
@@ -279,7 +279,7 @@ bool KviKvsObject_listview::function_firstChild(KviKvsObjectFunctionCall *c)
bool KviKvsObject_listview::function_currentItem(KviKvsObjectFunctionCall *c)
{
if(widget())
- c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((QListView *)widget())->currentItem()));
+ c->returnValue()->setHObject(KviKvsObject_listviewitem::itemToHandle(((KviTalListView *)widget())->currentItem()));
else
c->returnValue()->setHObject((kvs_hobject_t)0);
return true;
@@ -293,7 +293,7 @@ bool KviKvsObject_listview::function_setColumnText(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("column",KVS_PT_UNSIGNEDINTEGER,0,uCol)
KVSO_PARAMETER("text",KVS_PT_STRING,0,szText)
KVSO_PARAMETERS_END(c)
- if (widget())((QListView *)widget())->setColumnText(uCol,szText);
+ if (widget())((KviTalListView *)widget())->setColumnText(uCol,szText);
return true;
}
@@ -305,13 +305,13 @@ bool KviKvsObject_listview::function_setSelectionMode(KviKvsObjectFunctionCall *
KVSO_PARAMETERS_END(c)
if(!widget())return true;
if(KviQString::equalCI(szMode,"NoSelection"))
- ((QListView *)widget())->setSelectionMode(QListView::NoSelection);
+ ((KviTalListView *)widget())->setSelectionMode(KviTalListView::NoSelection);
else if(KviQString::equalCI(szMode,"Multi"))
- ((QListView *)widget())->setSelectionMode(QListView::Multi);
+ ((KviTalListView *)widget())->setSelectionMode(KviTalListView::Multi);
else if(KviQString::equalCI(szMode,"Extended"))
- ((QListView *)widget())->setSelectionMode(QListView::Extended);
+ ((KviTalListView *)widget())->setSelectionMode(KviTalListView::Extended);
else if(KviQString::equalCI(szMode,"Single"))
- ((QListView *)widget())->setSelectionMode(QListView::Single);
+ ((KviTalListView *)widget())->setSelectionMode(KviTalListView::Single);
else c->warning(__tr2qs("Invalid selection mode 'Q'"),&szMode);
return true;
}
@@ -324,7 +324,7 @@ bool KviKvsObject_listview::function_setSorting(KviKvsObjectFunctionCall *c)
KVSO_PARAMETER("column",KVS_PT_INT,0,iCol)
KVSO_PARAMETER("benabled",KVS_PT_BOOL,0,bEnabled)
KVSO_PARAMETERS_END(c)
- if (widget()) ((QListView *)widget())->setSorting(iCol,bEnabled);
+ if (widget()) ((KviTalListView *)widget())->setSorting(iCol,bEnabled);
return true;
}
@@ -335,7 +335,7 @@ bool KviKvsObject_listview::function_setRootIsDecorated(KviKvsObjectFunctionCall
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled)
KVSO_PARAMETERS_END(c)
- if (widget()) ((QListView *)widget())->setRootIsDecorated(bEnabled);
+ if (widget()) ((KviTalListView *)widget())->setRootIsDecorated(bEnabled);
return true;
}
@@ -345,23 +345,23 @@ bool KviKvsObject_listview::function_setAllColumnsShowFocus(KviKvsObjectFunction
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("bAllColumnsShowFocus",KVS_PT_BOOL,0,bEnabled)
KVSO_PARAMETERS_END(c)
- if (widget())((QListView *)widget())->setAllColumnsShowFocus(bEnabled);
+ if (widget())((KviTalListView *)widget())->setAllColumnsShowFocus(bEnabled);
return true;
}
bool KviKvsObject_listview::function_hideListViewHeader(KviKvsObjectFunctionCall *c)
{
- ((QListView *)widget())->header()->hide();
+ ((KviTalListView *)widget())->header()->hide();
return true;
}
bool KviKvsObject_listview::function_showListViewHeader(KviKvsObjectFunctionCall *c)
{
- ((QListView *)widget())->header()->show();
+ ((KviTalListView *)widget())->header()->show();
return true;
}
bool KviKvsObject_listview::function_listViewHeaderIsVisible(KviKvsObjectFunctionCall *c)
{
- c->returnValue()->setBoolean(((QListView *)widget())->header()->isVisible());
+ c->returnValue()->setBoolean(((KviTalListView *)widget())->header()->isVisible());
return true;
}
@@ -371,7 +371,7 @@ bool KviKvsObject_listview::function_itemClickedEvent(KviKvsObjectFunctionCall *
return true;
}
-void KviKvsObject_listview::slotClicked(QListViewItem * i)
+void KviKvsObject_listview::slotClicked(KviTalListViewItem * i)
{
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i)));
callFunction(this,"itemClickedEvent",0,&params);
@@ -383,7 +383,7 @@ bool KviKvsObject_listview::function_selectionChangedEvent(KviKvsObjectFunctionC
return true;
}
-void KviKvsObject_listview::slotSelectionChanged(QListViewItem * i)
+void KviKvsObject_listview::slotSelectionChanged(KviTalListViewItem * i)
{
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i)));
callFunction(this,"selectionChangedEvent",0,&params);
@@ -402,7 +402,7 @@ bool KviKvsObject_listview::function_currentChangedEvent(KviKvsObjectFunctionCal
return true;
}
-void KviKvsObject_listview::slotCurrentChanged(QListViewItem * i)
+void KviKvsObject_listview::slotCurrentChanged(KviTalListViewItem * i)
{
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i)));
callFunction(this,"currentChangedEvent",0,&params);
@@ -415,7 +415,7 @@ bool KviKvsObject_listview::function_returnPressedEvent(KviKvsObjectFunctionCall
return true;
}
-void KviKvsObject_listview::slotReturnPressed(QListViewItem * i)
+void KviKvsObject_listview::slotReturnPressed(KviTalListViewItem * i)
{
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i)));
callFunction(this,"returnPressedEvent",0,&params);
@@ -427,7 +427,7 @@ bool KviKvsObject_listview::function_spacePressedEvent(KviKvsObjectFunctionCall
return true;
}
-void KviKvsObject_listview::slotSpacePressed(QListViewItem * i)
+void KviKvsObject_listview::slotSpacePressed(KviTalListViewItem * i)
{
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i)));
callFunction(this,"spacePressedEvent",0,&params);
@@ -439,7 +439,7 @@ bool KviKvsObject_listview::function_onItemEvent(KviKvsObjectFunctionCall *c)
return true;
}
-void KviKvsObject_listview::slotOnItem(QListViewItem * i)
+void KviKvsObject_listview::slotOnItem(KviTalListViewItem * i)
{
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i)));
callFunction(this,"onItemEvent",0,&params);
@@ -452,7 +452,7 @@ bool KviKvsObject_listview::function_itemExpandedEvent(KviKvsObjectFunctionCall
return true;
}
-void KviKvsObject_listview::slotItemExpanded(QListViewItem * i)
+void KviKvsObject_listview::slotItemExpanded(KviTalListViewItem * i)
{
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i)));
callFunction(this,"itemExpandedEvent",0,&params);
@@ -464,7 +464,7 @@ bool KviKvsObject_listview::function_itemCollapsedEvent(KviKvsObjectFunctionCall
return true;
}
-void KviKvsObject_listview::slotItemCollapsed(QListViewItem * i)
+void KviKvsObject_listview::slotItemCollapsed(KviTalListViewItem * i)
{
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(i)));
callFunction(this,"itemCollapsedEvent",0,&params);
@@ -476,7 +476,7 @@ bool KviKvsObject_listview::function_rightButtonClickedEvent(KviKvsObjectFunctio
return true;
}
-void KviKvsObject_listview::slotRightButtonClicked(QListViewItem * i,const QPoint &coor, int col)
+void KviKvsObject_listview::slotRightButtonClicked(KviTalListViewItem * i,const QPoint &coor, int col)
{
KviKvsVariant *xpos=new KviKvsVariant((kvs_int_t)coor.x());
KviKvsVariant *ypos=new KviKvsVariant((kvs_int_t)coor.y());
@@ -491,14 +491,14 @@ bool KviKvsObject_listview::function_itemRenamedEvent(KviKvsObjectFunctionCall *
return true;
}
-void KviKvsObject_listview::slotItemRenamed(QListViewItem *item,int col,const QString & szText)
+void KviKvsObject_listview::slotItemRenamed(KviTalListViewItem *item,int col,const QString & szText)
{
KviKvsVariant *column=new KviKvsVariant((kvs_int_t)col);
KviKvsVariant *txt=new KviKvsVariant(szText);
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(item)),column,txt);
callFunction(this,"itemRenamedEvent",0,&params);
}
-void KviKvsObject_listview::fileDropped(QString &szFile,QListViewItem *item)
+void KviKvsObject_listview::fileDropped(QString &szFile,KviTalListViewItem *item)
{
KviKvsVariant *file=new KviKvsVariant(szFile);
KviKvsVariantList params(new KviKvsVariant(KviKvsObject_listviewitem::itemToHandle(item)),file);
@@ -506,7 +506,7 @@ void KviKvsObject_listview::fileDropped(QString &szFile,QListViewItem *item)
}
KviKvsMdmListView::KviKvsMdmListView(QWidget * par,const char * name,KviKvsObject_listview *parent)
-:QListView( par,name)
+:KviTalListView(par)
{
m_pParentScript=parent;
setAcceptDrops(true);
@@ -543,7 +543,7 @@ void KviKvsMdmListView::contentsDropEvent(QDropEvent *e)
#ifndef COMPILE_ON_WINDOWS
if(tmp[0] != '/')tmp.prepend("/"); //HACK HACK HACK for Qt bug (?!?)
#endif
- QListViewItem *i = itemAt( contentsToViewport(e->pos()) );
+ KviTalListViewItem *i = itemAt( contentsToViewport(e->pos()) );
m_pParentScript->fileDropped(tmp,i);
}
}
diff --git a/src/modules/objects/class_listview.h b/src/modules/objects/class_listview.h
index dff661984..bd5f749cf 100644
--- a/src/modules/objects/class_listview.h
+++ b/src/modules/objects/class_listview.h
@@ -26,7 +26,7 @@
//
//=================================================================================
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qdragobject.h>
#include "class_widget.h"
#include "class_listviewitem.h"
@@ -41,7 +41,7 @@ public:
public:
QWidget * widget() { return (QWidget *)object(); };
- void fileDropped(QString &,QListViewItem *);
+ void fileDropped(QString &,KviTalListViewItem *);
protected:
virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams);
@@ -73,20 +73,20 @@ protected:
bool function_setAcceptDrops(KviKvsObjectFunctionCall *c);
protected slots:
- void slotClicked(QListViewItem *);
- void slotSelectionChanged(QListViewItem *);
+ void slotClicked(KviTalListViewItem *);
+ void slotSelectionChanged(KviTalListViewItem *);
void slotMultipleSelectionChanged();
- void slotCurrentChanged(QListViewItem *);
- void slotReturnPressed(QListViewItem *);
- void slotSpacePressed(QListViewItem *);
- void slotOnItem(QListViewItem *);
- void slotItemExpanded(QListViewItem *);
- void slotItemCollapsed(QListViewItem *);
- void slotItemRenamed(QListViewItem *,int,const QString &);
- void slotRightButtonClicked(QListViewItem * i,const QPoint &coor, int col);
+ void slotCurrentChanged(KviTalListViewItem *);
+ void slotReturnPressed(KviTalListViewItem *);
+ void slotSpacePressed(KviTalListViewItem *);
+ void slotOnItem(KviTalListViewItem *);
+ void slotItemExpanded(KviTalListViewItem *);
+ void slotItemCollapsed(KviTalListViewItem *);
+ void slotItemRenamed(KviTalListViewItem *,int,const QString &);
+ void slotRightButtonClicked(KviTalListViewItem * i,const QPoint &coor, int col);
};
-class KviKvsMdmListView : public QListView
+class KviKvsMdmListView : public KviTalListView
{
Q_OBJECT
public:
diff --git a/src/modules/objects/class_listviewitem.cpp b/src/modules/objects/class_listviewitem.cpp
index 98a17f3e3..f50ab4910 100644
--- a/src/modules/objects/class_listviewitem.cpp
+++ b/src/modules/objects/class_listviewitem.cpp
@@ -147,7 +147,7 @@ bool KviKvsObject_listviewitem::init(KviKvsRunTimeContext * pContext,KviKvsVaria
m_pListViewItem = new KviKvsMdmStandardListViewItem(this,((KviKvsObject_listviewitem *)parentObject())->m_pListViewItem);
} else {
if(parentObject()->inherits("KviKvsObject_listview"))
- m_pListViewItem = new KviKvsMdmStandardListViewItem(this,((QListView *)parentScriptWidget()));
+ m_pListViewItem = new KviKvsMdmStandardListViewItem(this,((KviTalListView *)parentScriptWidget()));
else {
pContext->error(__tr2qs("The parent of the listviewitem must be either another listviewitem or a listview"));
return false;
@@ -163,13 +163,13 @@ void KviKvsObject_listviewitem::childDestroyed()
die();
}
-KviKvsMdmStandardListViewItem::KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,QListView * par)
-:QListViewItem(par), m_pMasterObject(ob)
+KviKvsMdmStandardListViewItem::KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,KviTalListView * par)
+:KviTalListViewItem(par), m_pMasterObject(ob)
{
}
-KviKvsMdmStandardListViewItem::KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,QListViewItem * par)
-:QListViewItem(par), m_pMasterObject(ob)
+KviKvsMdmStandardListViewItem::KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,KviTalListViewItem * par)
+:KviTalListViewItem(par), m_pMasterObject(ob)
{
}
@@ -180,13 +180,13 @@ KviKvsMdmStandardListViewItem::~KviKvsMdmStandardListViewItem()
-KviKvsMdmCheckListViewItem::KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,QListView * par)
-:QCheckListItem(par,QString::null,QCheckListItem::CheckBox), m_pMasterObject(ob)
+KviKvsMdmCheckListViewItem::KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,KviTalListView * par)
+:KviTalCheckListItem(par,QString::null,KviTalCheckListItem::CheckBox), m_pMasterObject(ob)
{
}
-KviKvsMdmCheckListViewItem::KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,QListViewItem * par)
-:QCheckListItem(par,QString::null,QCheckListItem::CheckBox), m_pMasterObject(ob)
+KviKvsMdmCheckListViewItem::KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,KviTalListViewItem * par)
+:KviTalCheckListItem(par,QString::null,KviTalCheckListItem::CheckBox), m_pMasterObject(ob)
{
}
@@ -196,7 +196,7 @@ KviKvsMdmCheckListViewItem::~KviKvsMdmCheckListViewItem()
}
-kvs_hobject_t KviKvsObject_listviewitem::itemToHandle(QListViewItem * it)
+kvs_hobject_t KviKvsObject_listviewitem::itemToHandle(KviTalListViewItem * it)
{
if(!it)return (kvs_hobject_t)0;
KviKvsObject_listviewitem * pObject;
@@ -335,10 +335,10 @@ bool KviKvsObject_listviewitem::function_setCheckable(KviKvsObjectFunctionCall *
if(bCheckable)
{
if(m_pListViewItem->rtti() == 1)return true; // a QCheckListItem already
- QListViewItem * pParent = m_pListViewItem->parent();
- QListView * pLV = m_pListViewItem->listView();
+ KviTalListViewItem * pParent = m_pListViewItem->parent();
+ KviTalListView * pLV = (KviTalListView *)m_pListViewItem->listView();
// swap the items, so we don't die now
- QListViewItem * pThis = m_pListViewItem;
+ KviTalListViewItem * pThis = m_pListViewItem;
m_pListViewItem = 0;
delete pThis;
if(pParent)
@@ -347,10 +347,10 @@ bool KviKvsObject_listviewitem::function_setCheckable(KviKvsObjectFunctionCall *
m_pListViewItem = new KviKvsMdmCheckListViewItem(this,pLV);
} else {
if(m_pListViewItem->rtti() != 1)return true; // not a QCheckListItem yet
- QListViewItem * pParent = m_pListViewItem->parent();
- QListView * pLV = m_pListViewItem->listView();
+ KviTalListViewItem * pParent = m_pListViewItem->parent();
+ KviTalListView * pLV = (KviTalListView *)m_pListViewItem->listView();
// swap the items, so we don't die now
- QListViewItem * pThis = m_pListViewItem;
+ KviTalListViewItem * pThis = m_pListViewItem;
m_pListViewItem = 0;
delete pThis;
if(pParent)
diff --git a/src/modules/objects/class_listviewitem.h b/src/modules/objects/class_listviewitem.h
index 8d994a940..b7f0db217 100644
--- a/src/modules/objects/class_listviewitem.h
+++ b/src/modules/objects/class_listviewitem.h
@@ -22,7 +22,7 @@
// along with this program. If not, write to the Free Software Foundation,
// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include "class_widget.h"
@@ -36,7 +36,7 @@ public:
KVSO_DECLARE_OBJECT(KviKvsObject_listviewitem)
void childDestroyed();
protected:
- QListViewItem * m_pListViewItem;
+ KviTalListViewItem * m_pListViewItem;
protected:
virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams);
protected:
@@ -56,16 +56,16 @@ protected:
bool function_firstChild(KviKvsObjectFunctionCall *c);
bool function_nextSibling(KviKvsObjectFunctionCall *c);
public:
- static kvs_hobject_t itemToHandle(QListViewItem * it);
+ static kvs_hobject_t itemToHandle(KviTalListViewItem * it);
};
-class KviKvsMdmStandardListViewItem : public QListViewItem
+class KviKvsMdmStandardListViewItem : public KviTalListViewItem
{
public:
- KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,QListView * par);
- KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,QListViewItem * par);
+ KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,KviTalListView * par);
+ KviKvsMdmStandardListViewItem(KviKvsObject_listviewitem * ob,KviTalListViewItem * par);
virtual ~KviKvsMdmStandardListViewItem();
protected:
KviKvsObject_listviewitem * m_pMasterObject;
@@ -73,11 +73,11 @@ public:
KviKvsObject_listviewitem * masterObject(){ return m_pMasterObject; }
};
-class KviKvsMdmCheckListViewItem : public QCheckListItem
+class KviKvsMdmCheckListViewItem : public KviTalCheckListItem
{
public:
- KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,QListView * par);
- KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,QListViewItem * par);
+ KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,KviTalListView * par);
+ KviKvsMdmCheckListViewItem(KviKvsObject_listviewitem * ob,KviTalListViewItem * par);
virtual ~KviKvsMdmCheckListViewItem();
protected:
KviKvsObject_listviewitem * m_pMasterObject;
diff --git a/src/modules/objects/libkviobjects.cpp b/src/modules/objects/libkviobjects.cpp
index 4606c2083..e083be5ee 100644
--- a/src/modules/objects/libkviobjects.cpp
+++ b/src/modules/objects/libkviobjects.cpp
@@ -24,7 +24,7 @@
#include <qwidgetlist.h>
#include <qobjectlist.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qimage.h>
#include "kvi_iconmanager.h"
#include "kvi_window.h"
diff --git a/src/modules/options/dialog.cpp b/src/modules/options/dialog.cpp
index 79af2b671..7a938f665 100644
--- a/src/modules/options/dialog.cpp
+++ b/src/modules/options/dialog.cpp
@@ -75,8 +75,8 @@ KviGeneralOptionsFrontWidget::~KviGeneralOptionsFrontWidget()
-KviOptionsListViewItem::KviOptionsListViewItem(QListView *parent,KviOptionsWidgetInstanceEntry * e)
-:QListViewItem(parent,e->szName)
+KviOptionsListViewItem::KviOptionsListViewItem(KviTalListView *parent,KviOptionsWidgetInstanceEntry * e)
+:KviTalListViewItem(parent,e->szName)
{
m_pInstanceEntry = e;
m_pOptionsWidget = 0;
@@ -84,8 +84,8 @@ KviOptionsListViewItem::KviOptionsListViewItem(QListView *parent,KviOptionsWidge
setPixmap(0,*(g_pIconManager->getSmallIcon(e->iIcon)));
}
-KviOptionsListViewItem::KviOptionsListViewItem(QListViewItem *parent,KviOptionsWidgetInstanceEntry * e)
-:QListViewItem(parent,e->szName)
+KviOptionsListViewItem::KviOptionsListViewItem(KviTalListViewItem *parent,KviOptionsWidgetInstanceEntry * e)
+:KviTalListViewItem(parent,e->szName)
{
m_pInstanceEntry = e;
m_pOptionsWidget = 0;
@@ -105,9 +105,9 @@ void KviOptionsListViewItem::paintCell(QPainter * p,const QColorGroup & cg,int c
tmp.setColor(QColorGroup::Base,Qt::red);
tmp.setColor(QColorGroup::Background,Qt::red);
tmp.setColor(QColorGroup::Text,Qt::yellow);
- QListViewItem::paintCell(p,tmp,column,width,align);
+ KviTalListViewItem::paintCell(p,tmp,column,width,align);
} else {
- QListViewItem::paintCell(p,cg,column,width,align);
+ KviTalListViewItem::paintCell(p,cg,column,width,align);
}
}
@@ -189,12 +189,12 @@ KviOptionsDialog::KviOptionsDialog(QWidget * par,const QString &szGroup)
vbox->setMargin(0);
// Controlling list view
- m_pListView = new QListView(vbox);
+ m_pListView = new KviTalListView(vbox);
m_pListView->addColumn("");
m_pListView->header()->hide();
m_pListView->setRootIsDecorated(true);
m_pListView->setSorting(-1);
- connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(listViewItemSelectionChanged(QListViewItem *)));
+ connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(listViewItemSelectionChanged(KviTalListViewItem *)));
KviTalHBox * hbox = new KviTalHBox(vbox);
vbox->setSpacing(2);
@@ -460,7 +460,7 @@ void KviOptionsDialog::searchClicked()
search(szTxt);
}
-void KviOptionsDialog::fillListView(QListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l,const QString &szGroup,bool bNotContainedOnly)
+void KviOptionsDialog::fillListView(KviTalListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l,const QString &szGroup,bool bNotContainedOnly)
{
if(!l)return;
@@ -516,12 +516,12 @@ void KviOptionsDialog::fillListView(QListViewItem * p,KviPtrList<KviOptionsWidge
}
}
-void KviOptionsDialog::listViewItemSelectionChanged(QListViewItem *it)
+void KviOptionsDialog::listViewItemSelectionChanged(KviTalListViewItem *it)
{
if(it)
{
QString str = it->text(0);
- QListViewItem * par = it->parent();
+ KviTalListViewItem * par = it->parent();
while(par)
{
diff --git a/src/modules/options/dialog.h b/src/modules/options/dialog.h
index 2263f829e..52867fbe2 100644
--- a/src/modules/options/dialog.h
+++ b/src/modules/options/dialog.h
@@ -27,7 +27,7 @@
#include <qdialog.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qstringlist.h>
#include "kvi_optionswidget.h"
@@ -47,11 +47,11 @@ public:
~KviGeneralOptionsFrontWidget();
};
-class KviOptionsListViewItem : public QListViewItem
+class KviOptionsListViewItem : public KviTalListViewItem
{
public:
- KviOptionsListViewItem(QListView *parent,KviOptionsWidgetInstanceEntry * e);
- KviOptionsListViewItem(QListViewItem *parent,KviOptionsWidgetInstanceEntry * e);
+ KviOptionsListViewItem(KviTalListView *parent,KviOptionsWidgetInstanceEntry * e);
+ KviOptionsListViewItem(KviTalListViewItem *parent,KviOptionsWidgetInstanceEntry * e);
~KviOptionsListViewItem();
public:
KviOptionsWidgetInstanceEntry * m_pInstanceEntry;
@@ -70,7 +70,7 @@ public:
KviOptionsDialog(QWidget * par,const QString &szGroup);
~KviOptionsDialog();
private:
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLabel * m_pCategoryLabel;
KviTalWidgetStack * m_pWidgetStack;
KviGeneralOptionsFrontWidget* m_pFrontWidget;
@@ -79,11 +79,11 @@ private:
QToolButton * m_pSearchButton;
private:
void recursiveCommit(KviOptionsListViewItem *it);
- void fillListView(QListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l,const QString &szGroup,bool bNotContainedOnly = false);
- //KviOptionsListViewItem * showHiddenChildren(QListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l);
+ void fillListView(KviTalListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l,const QString &szGroup,bool bNotContainedOnly = false);
+ //KviOptionsListViewItem * showHiddenChildren(KviTalListViewItem * p,KviPtrList<KviOptionsWidgetInstanceEntry> * l);
KviOptionsListViewItem * findItemByPage(KviOptionsListViewItem *it,KviOptionsWidget * pPage);
private slots:
- void listViewItemSelectionChanged(QListViewItem *it);
+ void listViewItemSelectionChanged(KviTalListViewItem *it);
void applyClicked();
void okClicked();
void cancelClicked();
diff --git a/src/modules/options/optw_ircoutput.h b/src/modules/options/optw_ircoutput.h
index 567bacf73..41575950a 100644
--- a/src/modules/options/optw_ircoutput.h
+++ b/src/modules/options/optw_ircoutput.h
@@ -24,7 +24,7 @@
//
#include "kvi_optionswidget.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
class QComboBox;
diff --git a/src/modules/options/optw_mediatypes.cpp b/src/modules/options/optw_mediatypes.cpp
index b876bbb90..b00bb9fd6 100644
--- a/src/modules/options/optw_mediatypes.cpp
+++ b/src/modules/options/optw_mediatypes.cpp
@@ -44,8 +44,8 @@ static void copyMediaType(KviMediaType * dst,const KviMediaType * src)
dst->szIcon = src->szIcon;
}
-KviMediaTypeListViewItem::KviMediaTypeListViewItem(QListView * w,KviMediaType * t)
-: QListViewItem(w)
+KviMediaTypeListViewItem::KviMediaTypeListViewItem(KviTalListView * w,KviMediaType * t)
+: KviTalListViewItem(w)
{
copyData(t);
}
@@ -67,7 +67,7 @@ KviMediaTypesOptionsWidget::KviMediaTypesOptionsWidget(QWidget * parent)
{
createLayout(11,3);
- m_pListView = new QListView(this);
+ m_pListView = new KviTalListView(this);
m_pListView->addColumn(__tr2qs_ctx("Pattern","options"));
m_pListView->addColumn(__tr2qs_ctx("MIME Type","options"));
m_pListView->addColumn(__tr2qs_ctx("Description","options"));
@@ -75,7 +75,7 @@ KviMediaTypesOptionsWidget::KviMediaTypesOptionsWidget(QWidget * parent)
- connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentItemChanged(QListViewItem *)));
+ connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentItemChanged(KviTalListViewItem *)));
layout()->addMultiCellWidget(m_pListView,0,0,0,2);
@@ -212,7 +212,7 @@ void KviMediaTypesOptionsWidget::setLineEdits()
m_pIcon->setText(m_pLastItem ? m_pLastItem->data()->szIcon.ptr() : "");
}
-void KviMediaTypesOptionsWidget::currentItemChanged(QListViewItem *it)
+void KviMediaTypesOptionsWidget::currentItemChanged(KviTalListViewItem *it)
{
saveLastItem();
m_pLastItem = (KviMediaTypeListViewItem *)it;
diff --git a/src/modules/options/optw_mediatypes.h b/src/modules/options/optw_mediatypes.h
index 30b3aed87..35fd41b9c 100644
--- a/src/modules/options/optw_mediatypes.h
+++ b/src/modules/options/optw_mediatypes.h
@@ -24,16 +24,16 @@
//
#include "kvi_optionswidget.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qlineedit.h>
#include <qpushbutton.h>
#include "kvi_mediatype.h"
-class KviMediaTypeListViewItem : public QListViewItem
+class KviMediaTypeListViewItem : public KviTalListViewItem
{
public:
- KviMediaTypeListViewItem(QListView * w,KviMediaType * t);
+ KviMediaTypeListViewItem(KviTalListView * w,KviMediaType * t);
~KviMediaTypeListViewItem();
private:
KviMediaType m_data;
@@ -56,7 +56,7 @@ public:
KviMediaTypesOptionsWidget(QWidget * parent);
~KviMediaTypesOptionsWidget();
private:
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLineEdit * m_pDescription;
QLineEdit * m_pIanaType;
QLineEdit * m_pFileMask;
@@ -73,7 +73,7 @@ private:
void enableOrDisable();
void setLineEdits();
private slots:
- void currentItemChanged(QListViewItem *it);
+ void currentItemChanged(KviTalListViewItem *it);
void newMediaType();
void delMediaType();
public:
diff --git a/src/modules/options/optw_messages.cpp b/src/modules/options/optw_messages.cpp
index 4c7fb0090..316aa18a1 100644
--- a/src/modules/options/optw_messages.cpp
+++ b/src/modules/options/optw_messages.cpp
@@ -192,7 +192,7 @@ KviStandardColorsOptionsWidget::~KviStandardColorsOptionsWidget()
KviMessageListView::KviMessageListView(QWidget * par)
-: QListView(par)
+: KviTalListView(par)
{
setItemMargin(2);
}
@@ -228,7 +228,7 @@ void KviMessageListView::paintEmptyAreaInternal(QPainter * p,const QRect &viewpo
void KviMessageListView::paintEmptyArea(QPainter * p,const QRect &rct)
{
paintEmptyAreaInternal(p,rct,rct);
- QListView::paintEmptyArea(p,rct);
+ KviTalListView::paintEmptyArea(p,rct);
}
@@ -236,8 +236,8 @@ void KviMessageListView::paintEmptyArea(QPainter * p,const QRect &rct)
-KviMessageListViewItem::KviMessageListViewItem(QListView * l,int optId)
-: QListViewItem(l)
+KviMessageListViewItem::KviMessageListViewItem(KviTalListView * l,int optId)
+: KviTalListViewItem(l)
{
m_iOptId = optId;
setText(0,"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW");
@@ -297,8 +297,8 @@ void KviMessageListViewItem::paintCell(QPainter * p,const QColorGroup &,int,int
}
-KviMessageColorListBoxItem::KviMessageColorListBoxItem(QListBox * b,const QColor &clr,int idx)
-: QListBoxText(b,QString::null)
+KviMessageColorListBoxItem::KviMessageColorListBoxItem(KviTalListBox * b,const QColor &clr,int idx)
+: KviTalListBoxText(b,QString::null)
{
m_clr = clr;
m_iClrIdx = idx;
@@ -313,13 +313,15 @@ void KviMessageColorListBoxItem::paint(QPainter * p)
{
QColor clr;
+ const KviTalListBox * lb = (const KviTalListBox *)listBox();
+
if((m_iClrIdx >= 0) && (m_iClrIdx <= 15))
{
- clr = listBox()->isEnabled() ? KVI_OPTION_MIRCCOLOR(m_iClrIdx) : Qt::gray;
- p->fillRect(0,0,width(listBox()),height(listBox()),clr);
+ clr = lb->isEnabled() ? KVI_OPTION_MIRCCOLOR(m_iClrIdx) : Qt::gray;
+ p->fillRect(0,0,width(lb),height(lb),clr);
} else {
clr = listBox()->colorGroup().background();
- QListBoxText::paint(p);
+ KviTalListBoxText::paint(p);
}
#if QT_VERSION >= 300
if(isSelected())
@@ -327,13 +329,13 @@ void KviMessageColorListBoxItem::paint(QPainter * p)
if(selected())
#endif
{
- p->drawWinFocusRect(0,0,width(listBox()),height(listBox()),clr);
- p->drawWinFocusRect(1,1,width(listBox()) - 2,height(listBox()) - 2,clr);
- p->drawWinFocusRect(2,2,width(listBox()) - 4,height(listBox()) - 4,clr);
+ p->drawWinFocusRect(0,0,width(lb),height(lb),clr);
+ p->drawWinFocusRect(1,1,width(lb) - 2,height(lb) - 2,clr);
+ p->drawWinFocusRect(2,2,width(lb) - 4,height(lb) - 4,clr);
}
}
/*
-int KviMessageColorListBoxItem::width(const QListBox * lb) const
+int KviMessageColorListBoxItem::width(const KviTalListBox * lb) const
{
int w = lb->width();
if(w < 30)w = 30;
@@ -341,7 +343,7 @@ int KviMessageColorListBoxItem::width(const QListBox * lb) const
return w;
}
-int KviMessageColorListBoxItem::height(const QListBox *) const
+int KviMessageColorListBoxItem::height(const KviTalListBox *) const
{
return 30;
}
@@ -374,7 +376,7 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent)
m_pListView = new KviMessageListView(this);
m_pListView->addColumn(__tr2qs_ctx("Message Type","options"));
m_pListView->setAllColumnsShowFocus(true);
- m_pListView->setSelectionMode(QListView::Single);
+ m_pListView->setSelectionMode(KviTalListView::Single);
m_pListView->setFont(KVI_OPTION_FONT(KviOption_fontIrcView));
m_pListView->setStaticBackground(true);
m_pListView->viewport()->setBackgroundMode(QWidget::NoBackground);
@@ -386,7 +388,7 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent)
QLabel * l = new QLabel(__tr2qs_ctx("Background:","options"),box);
- m_pBackListBox = new QListBox(box);
+ m_pBackListBox = new KviTalListBox(box);
m_pBackItems[16] = new KviMessageColorListBoxItem(m_pBackListBox,Qt::gray,KVI_TRANSPARENT);
for(i=0;i<16;i++)
{
@@ -395,7 +397,7 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent)
l = new QLabel(__tr2qs_ctx("Foreground:","options"),box);
- m_pForeListBox = new QListBox(box);
+ m_pForeListBox = new KviTalListBox(box);
for(i=0;i<16;i++)
{
m_pForeItems[i] = new KviMessageColorListBoxItem(m_pForeListBox,KVI_OPTION_MIRCCOLOR(i),i);
@@ -403,13 +405,13 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent)
l = new QLabel(__tr2qs_ctx("Alert level:","options"),box);
- m_pLevelListBox = new QListBox(box);
- QListBoxText * lbt;
+ m_pLevelListBox = new KviTalListBox(box);
+ KviTalListBoxText * lbt;
for(i=0;i<6;i++)
{
QString tmpn;
tmpn.setNum(i);
- lbt = new QListBoxText(m_pLevelListBox,tmpn);
+ lbt = new KviTalListBoxText(m_pLevelListBox,tmpn);
}
m_pIconButton = new KviStyledToolButton(box);
@@ -441,9 +443,9 @@ KviMessageColorsOptionsWidget::KviMessageColorsOptionsWidget(QWidget * parent)
layout()->setRowStretch(0,1);
layout()->setColStretch(0,1);
- connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(itemChanged(QListViewItem *)));
- connect(m_pForeListBox,SIGNAL(selectionChanged(QListBoxItem *)),this,SLOT(colorChanged(QListBoxItem *)));
- connect(m_pBackListBox,SIGNAL(selectionChanged(QListBoxItem *)),this,SLOT(colorChanged(QListBoxItem *)));
+ connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(itemChanged(KviTalListViewItem *)));
+ connect(m_pForeListBox,SIGNAL(selectionChanged(KviTalListBoxItem *)),this,SLOT(colorChanged(KviTalListBoxItem *)));
+ connect(m_pBackListBox,SIGNAL(selectionChanged(KviTalListBoxItem *)),this,SLOT(colorChanged(KviTalListBoxItem *)));
itemChanged(0);
}
@@ -487,7 +489,7 @@ void KviMessageColorsOptionsWidget::saveLastItem()
m_pListView->repaintItem(m_pLastItem);
}
-void KviMessageColorsOptionsWidget::itemChanged(QListViewItem * it)
+void KviMessageColorsOptionsWidget::itemChanged(KviTalListViewItem * it)
{
//debug("Item changed","options");
if(m_pLastItem)saveLastItem();
@@ -524,7 +526,7 @@ void KviMessageColorsOptionsWidget::itemChanged(QListViewItem * it)
}
-void KviMessageColorsOptionsWidget::colorChanged(QListBoxItem *)
+void KviMessageColorsOptionsWidget::colorChanged(KviTalListBoxItem *)
{
if(m_pLastItem)saveLastItem();
}
diff --git a/src/modules/options/optw_messages.h b/src/modules/options/optw_messages.h
index 4f6d59652..0219d74cd 100644
--- a/src/modules/options/optw_messages.h
+++ b/src/modules/options/optw_messages.h
@@ -27,8 +27,8 @@
#include "kvi_msgtype.h"
-#include <qlistview.h>
-#include <qlistbox.h>
+#include "kvi_tal_listview.h"
+#include "kvi_tal_listbox.h"
#include <qcheckbox.h>
#include <qtoolbutton.h>
#include "kvi_tal_popupmenu.h"
@@ -76,7 +76,7 @@ protected slots:
#define KVI_OPTIONS_WIDGET_PARENT_KviMessageColorsOptionsWidget KviMessageOptionsWidget
#define KVI_OPTIONS_WIDGET_PRIORITY_KviMessageColorsOptionsWidget 30
-class KviMessageListView : public QListView
+class KviMessageListView : public KviTalListView
{
Q_OBJECT
public:
@@ -89,10 +89,10 @@ public:
};
-class KviMessageListViewItem : public QListViewItem
+class KviMessageListViewItem : public KviTalListViewItem
{
public:
- KviMessageListViewItem(QListView * l,int optId);
+ KviMessageListViewItem(KviTalListView * l,int optId);
~KviMessageListViewItem();
private:
int m_iOptId;
@@ -104,17 +104,17 @@ public:
};
-class KviMessageColorListBoxItem : public QListBoxText
+class KviMessageColorListBoxItem : public KviTalListBoxText
{
public:
- KviMessageColorListBoxItem(QListBox * b,const QColor & clr,int idx);
+ KviMessageColorListBoxItem(KviTalListBox * b,const QColor & clr,int idx);
~KviMessageColorListBoxItem();
public:
int m_iClrIdx;
QColor m_clr;
public:
virtual void paint(QPainter * p);
- virtual int width(const QListBox * lv) const { return 120; };
+ virtual int width(const KviTalListBox * lv) const { return 120; };
};
@@ -128,9 +128,9 @@ public:
~KviMessageColorsOptionsWidget();
public:
KviMessageListView * m_pListView;
- QListBox * m_pForeListBox;
- QListBox * m_pBackListBox;
- QListBox * m_pLevelListBox;
+ KviTalListBox * m_pForeListBox;
+ KviTalListBox * m_pBackListBox;
+ KviTalListBox * m_pLevelListBox;
KviMessageColorListBoxItem * m_pForeItems[16];
KviMessageColorListBoxItem * m_pBackItems[17];
KviMessageListViewItem * m_pLastItem;
@@ -140,8 +140,8 @@ public:
public:
void saveLastItem();
protected slots:
- void itemChanged(QListViewItem * it);
- void colorChanged(QListBoxItem *);
+ void itemChanged(KviTalListViewItem * it);
+ void colorChanged(KviTalListBoxItem *);
void iconButtonClicked();
void newIconSelected(int iconId);
virtual void commit();
diff --git a/src/modules/options/optw_nickserv.cpp b/src/modules/options/optw_nickserv.cpp
index c7e6ce7a9..41f2a6d38 100644
--- a/src/modules/options/optw_nickserv.cpp
+++ b/src/modules/options/optw_nickserv.cpp
@@ -26,7 +26,7 @@
#include <qlayout.h>
#include <qtooltip.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
@@ -249,8 +249,8 @@ KviNickServOptionsWidget::KviNickServOptionsWidget(QWidget * parent)
#endif
m_pNickServCheck->setChecked(bNickServEnabled);
- m_pNickServListView = new QListView(this);
- m_pNickServListView->setSelectionMode(QListView::Single);
+ m_pNickServListView = new KviTalListView(this);
+ m_pNickServListView->setSelectionMode(KviTalListView::Single);
m_pNickServListView->setAllColumnsShowFocus(true);
m_pNickServListView->addColumn(__tr2qs_ctx("Nickname","options"));
m_pNickServListView->addColumn(__tr2qs_ctx("Server mask","options"));
@@ -292,7 +292,7 @@ KviNickServOptionsWidget::KviNickServOptionsWidget(QWidget * parent)
KviPtrList<KviNickServRule> * ll = rs->rules();
for(KviNickServRule * rule = ll->first();rule;rule = ll->next())
{
- (void)new QListViewItem(m_pNickServListView,rule->registeredNick(),rule->serverMask(),rule->nickServMask(),rule->messageRegexp(),rule->identifyCommand());
+ (void)new KviTalListViewItem(m_pNickServListView,rule->registeredNick(),rule->serverMask(),rule->nickServMask(),rule->messageRegexp(),rule->identifyCommand());
}
}
@@ -309,7 +309,7 @@ KviNickServOptionsWidget::~KviNickServOptionsWidget()
void KviNickServOptionsWidget::editNickServRule()
{
- QListViewItem * it = m_pNickServListView->currentItem();
+ KviTalListViewItem * it = m_pNickServListView->currentItem();
if(!it)return;
KviNickServRule r(it->text(0),it->text(2),it->text(3),it->text(4),it->text(1));
KviNickServRuleEditor ed(this,true);
@@ -328,12 +328,12 @@ void KviNickServOptionsWidget::addNickServRule()
KviNickServRule r;
KviNickServRuleEditor ed(this,true);
if(ed.editRule(&r))
- (void)new QListViewItem(m_pNickServListView,r.registeredNick(),r.serverMask(),r.nickServMask(),r.messageRegexp(),r.identifyCommand());
+ (void)new KviTalListViewItem(m_pNickServListView,r.registeredNick(),r.serverMask(),r.nickServMask(),r.messageRegexp(),r.identifyCommand());
}
void KviNickServOptionsWidget::delNickServRule()
{
- QListViewItem * it = m_pNickServListView->currentItem();
+ KviTalListViewItem * it = m_pNickServListView->currentItem();
if(!it)return;
delete it;
enableDisableNickServControls();
@@ -355,7 +355,7 @@ void KviNickServOptionsWidget::commit()
if(m_pNickServListView->childCount() > 0)
{
g_pNickServRuleSet->setEnabled(m_pNickServCheck->isChecked());
- QListViewItem * it = m_pNickServListView->firstChild();
+ KviTalListViewItem * it = m_pNickServListView->firstChild();
while(it)
{
g_pNickServRuleSet->addRule(KviNickServRule::createInstance(it->text(0),it->text(2),it->text(3),it->text(4),it->text(1)));
diff --git a/src/modules/options/optw_nickserv.h b/src/modules/options/optw_nickserv.h
index a0b1c4780..346955c4c 100644
--- a/src/modules/options/optw_nickserv.h
+++ b/src/modules/options/optw_nickserv.h
@@ -41,7 +41,7 @@
class QLineEdit;
class QPushButton;
class KviNickServRule;
-class QListView;
+class KviTalListView;
class QCheckBox;
class KviNickServRuleEditor : public QDialog
@@ -72,7 +72,7 @@ public:
KviNickServOptionsWidget(QWidget * parent);
~KviNickServOptionsWidget();
protected:
- QListView * m_pNickServListView;
+ KviTalListView * m_pNickServListView;
QCheckBox * m_pNickServCheck;
QPushButton * m_pAddRuleButton;
QPushButton * m_pDelRuleButton;
diff --git a/src/modules/options/optw_proxy.cpp b/src/modules/options/optw_proxy.cpp
index 9af3b7d6f..3aeb8dfc9 100644
--- a/src/modules/options/optw_proxy.cpp
+++ b/src/modules/options/optw_proxy.cpp
@@ -41,8 +41,8 @@
#include <qtoolbutton.h>
-KviProxyOptionsListViewItem::KviProxyOptionsListViewItem(QListView *parent,const QPixmap &pm,KviProxy * prx)
-: QListViewItem(parent,prx->m_szHostname.ptr())
+KviProxyOptionsListViewItem::KviProxyOptionsListViewItem(KviTalListView *parent,const QPixmap &pm,KviProxy * prx)
+: KviTalListViewItem(parent,prx->m_szHostname.ptr())
{
setPixmap(0,pm);
m_pProxyData = new KviProxy(*prx);
@@ -60,17 +60,17 @@ KviProxyOptionsWidget::KviProxyOptionsWidget(QWidget * parent)
addBoolSelector(0,0,1,0,__tr2qs_ctx("Use proxy","options"),KviOption_boolUseProxyHost);
- m_pListView = new QListView(this);
+ m_pListView = new KviTalListView(this);
addWidgetToLayout(m_pListView,0,1,0,1);
m_pListView->addColumn(__tr2qs_ctx("Proxy","options"));
m_pListView->setRootIsDecorated(true);
m_pListView->setAllColumnsShowFocus(true);
- m_pListView->setSelectionMode(QListView::Single);
+ m_pListView->setSelectionMode(KviTalListView::Single);
- connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),
- this,SLOT(listViewItemSelectionChanged(QListViewItem *)));
- connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this,SLOT(listViewRightButtonPressed(QListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),
+ this,SLOT(listViewItemSelectionChanged(KviTalListViewItem *)));
+ connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
+ this,SLOT(listViewRightButtonPressed(KviTalListViewItem *,const QPoint &,int)));
#ifdef COMPILE_INFO_TIPS
QString tiptxt = __tr2qs_ctx("<center>This is the list of available proxy servers.<br>" \
@@ -183,7 +183,7 @@ void KviProxyOptionsWidget::fillProxyList()
if(!(g_pProxyDataBase->currentProxy()))listViewItemSelectionChanged(0);
}
-void KviProxyOptionsWidget::listViewItemSelectionChanged(QListViewItem *it)
+void KviProxyOptionsWidget::listViewItemSelectionChanged(KviTalListViewItem *it)
{
if(m_pLastEditedItem)saveLastItem();
m_pLastEditedItem = (KviProxyOptionsListViewItem *)it;
@@ -330,7 +330,7 @@ void KviProxyOptionsWidget::commit()
KviOptionsWidget::commit();
}
-void KviProxyOptionsWidget::listViewRightButtonPressed(QListViewItem *it,const QPoint &pnt,int col)
+void KviProxyOptionsWidget::listViewRightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
{
m_pContextPopup->clear();
m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_PROXY)),__tr2qs_ctx("&New Proxy","options"),this,SLOT(newProxy()));
@@ -353,7 +353,7 @@ void KviProxyOptionsWidget::removeCurrent()
{
delete m_pLastEditedItem;
m_pLastEditedItem = 0;
- QListViewItem * it = m_pListView->firstChild();
+ KviTalListViewItem * it = m_pListView->firstChild();
if(it)
{
m_pListView->setSelected(it,true);
diff --git a/src/modules/options/optw_proxy.h b/src/modules/options/optw_proxy.h
index fe188869b..e39c31b2f 100644
--- a/src/modules/options/optw_proxy.h
+++ b/src/modules/options/optw_proxy.h
@@ -24,7 +24,7 @@
//
#include "kvi_optionswidget.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
class KviProxy;
@@ -32,10 +32,10 @@ class KviProxyDataBase;
extern KVIRC_API KviProxyDataBase * g_pProxyDataBase;
-class KviProxyOptionsListViewItem : public QListViewItem
+class KviProxyOptionsListViewItem : public KviTalListViewItem
{
public:
- KviProxyOptionsListViewItem(QListView *parent,const QPixmap &pm,KviProxy * prx);
+ KviProxyOptionsListViewItem(KviTalListView *parent,const QPixmap &pm,KviProxy * prx);
~KviProxyOptionsListViewItem();
public:
KviProxy * m_pProxyData;
@@ -61,7 +61,7 @@ public:
KviProxyOptionsWidget(QWidget * parent);
~KviProxyOptionsWidget();
protected:
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLabel * m_pProxyLabel;
QLineEdit * m_pProxyEdit;
QLabel * m_pIpLabel;
@@ -82,8 +82,8 @@ private:
void fillProxyList();
void saveLastItem();
protected slots:
- void listViewItemSelectionChanged(QListViewItem *it);
- void listViewRightButtonPressed(QListViewItem *it,const QPoint &pnt,int col);
+ void listViewItemSelectionChanged(KviTalListViewItem *it);
+ void listViewRightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col);
void newProxy();
void removeCurrent();
void ipV6CheckToggled(bool bEnabled);
diff --git a/src/modules/options/optw_servers.cpp b/src/modules/options/optw_servers.cpp
index 11ca4ac6e..c2ffae5e8 100644
--- a/src/modules/options/optw_servers.cpp
+++ b/src/modules/options/optw_servers.cpp
@@ -270,8 +270,8 @@ KviNetworkDetailsWidget::KviNetworkDetailsWidget(QWidget * par,KviIrcNetwork * n
#endif
m_pNickServCheck->setChecked(bNickServEnabled);
- m_pNickServListView = new QListView(tab);
- m_pNickServListView->setSelectionMode(QListView::Single);
+ m_pNickServListView = new KviTalListView(tab);
+ m_pNickServListView->setSelectionMode(KviTalListView::Single);
m_pNickServListView->setAllColumnsShowFocus(true);
m_pNickServListView->addColumn(__tr2qs_ctx("Nickname","options"));
m_pNickServListView->addColumn(__tr2qs_ctx("NickServ Mask","options"));
@@ -310,7 +310,7 @@ KviNetworkDetailsWidget::KviNetworkDetailsWidget(QWidget * par,KviIrcNetwork * n
KviPtrList<KviNickServRule> * ll = rs->rules();
for(KviNickServRule * rule = ll->first();rule;rule = ll->next())
{
- (void)new QListViewItem(m_pNickServListView,rule->registeredNick(),rule->nickServMask(),rule->messageRegexp(),rule->identifyCommand());
+ (void)new KviTalListViewItem(m_pNickServListView,rule->registeredNick(),rule->nickServMask(),rule->messageRegexp(),rule->identifyCommand());
}
}
@@ -348,7 +348,7 @@ KviNetworkDetailsWidget::~KviNetworkDetailsWidget()
void KviNetworkDetailsWidget::editNickServRule()
{
- QListViewItem * it = m_pNickServListView->currentItem();
+ KviTalListViewItem * it = m_pNickServListView->currentItem();
if(!it)return;
KviNickServRule r(it->text(0),it->text(1),it->text(2),it->text(3));
KviNickServRuleEditor ed(this,false);
@@ -366,12 +366,12 @@ void KviNetworkDetailsWidget::addNickServRule()
KviNickServRule r;
KviNickServRuleEditor ed(this,false);
if(ed.editRule(&r))
- (void)new QListViewItem(m_pNickServListView,r.registeredNick(),r.nickServMask(),r.messageRegexp(),r.identifyCommand());
+ (void)new KviTalListViewItem(m_pNickServListView,r.registeredNick(),r.nickServMask(),r.messageRegexp(),r.identifyCommand());
}
void KviNetworkDetailsWidget::delNickServRule()
{
- QListViewItem * it = m_pNickServListView->currentItem();
+ KviTalListViewItem * it = m_pNickServListView->currentItem();
if(!it)return;
delete it;
enableDisableNickServControls();
@@ -411,7 +411,7 @@ void KviNetworkDetailsWidget::fillData(KviIrcNetwork * n)
{
KviNickServRuleSet * rs = KviNickServRuleSet::createInstance();
rs->setEnabled(m_pNickServCheck->isChecked());
- QListViewItem * it = m_pNickServListView->firstChild();
+ KviTalListViewItem * it = m_pNickServListView->firstChild();
while(it)
{
rs->addRule(KviNickServRule::createInstance(it->text(0),it->text(1),it->text(2),it->text(3)));
@@ -973,8 +973,8 @@ void KviServerDetailsWidget::useDefaultInitUModeToggled(bool b)
// kvi_app.cpp
extern KVIRC_API KviIrcServerDataBase * g_pIrcServerDataBase;
-KviServerOptionsListViewItem::KviServerOptionsListViewItem(QListView *parent,const QPixmap &pm,const KviIrcNetwork *n)
- : QListViewItem(parent)
+KviServerOptionsListViewItem::KviServerOptionsListViewItem(KviTalListView *parent,const QPixmap &pm,const KviIrcNetwork *n)
+ : KviTalListViewItem(parent)
{
setPixmap(0,pm);
m_pServerData = 0;
@@ -983,8 +983,8 @@ KviServerOptionsListViewItem::KviServerOptionsListViewItem(QListView *parent,con
setText(1,n->description());
}
-KviServerOptionsListViewItem::KviServerOptionsListViewItem(QListViewItem *parent,const QPixmap &pm,const KviIrcServer *s)
- : QListViewItem(parent)
+KviServerOptionsListViewItem::KviServerOptionsListViewItem(KviTalListViewItem *parent,const QPixmap &pm,const KviIrcServer *s)
+ : KviTalListViewItem(parent)
{
setPixmap(0,pm);
m_pServerData = new KviIrcServer(*s);
@@ -1036,18 +1036,18 @@ KviServerOptionsWidget::KviServerOptionsWidget(QWidget * parent)
m_pNetworkDetailsDialog = 0;
m_pImportFilter = 0;
- m_pListView = new QListView(this);
+ m_pListView = new KviTalListView(this);
addWidgetToLayout(m_pListView,0,0,0,0);
m_pListView->addColumn(__tr2qs_ctx("Server","options"));
m_pListView->addColumn(__tr2qs_ctx("Description","options"));
m_pListView->setRootIsDecorated(true);
m_pListView->setAllColumnsShowFocus(true);
- m_pListView->setSelectionMode(QListView::Single);
- connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),
- this,SLOT(listViewItemSelectionChanged(QListViewItem *)));
- connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this,SLOT(listViewRightButtonPressed(QListViewItem *,const QPoint &,int)));
- connect(m_pListView,SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int )),
+ m_pListView->setSelectionMode(KviTalListView::Single);
+ connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),
+ this,SLOT(listViewItemSelectionChanged(KviTalListViewItem *)));
+ connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
+ this,SLOT(listViewRightButtonPressed(KviTalListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem*, const QPoint&, int )),
this,SLOT(detailsClicked()));
#ifdef COMPILE_INFO_TIPS
@@ -1232,12 +1232,12 @@ void KviServerOptionsWidget::recentServersPopupClicked(int id)
kvi_u32_t uPort = port.toUInt(&bOk);
// we have the port too
- QListViewItem * pFoundNet = 0;
- QListViewItem * pFoundSrv = 0;
+ KviTalListViewItem * pFoundNet = 0;
+ KviTalListViewItem * pFoundSrv = 0;
- for(QListViewItem * net = m_pListView->firstChild();net;net = net->nextSibling())
+ for(KviTalListViewItem * net = m_pListView->firstChild();net;net = net->nextSibling())
{
- for(QListViewItem * srv = net->firstChild();srv;srv = srv->nextSibling())
+ for(KviTalListViewItem * srv = net->firstChild();srv;srv = srv->nextSibling())
{
KviStr tmp = ((KviServerOptionsListViewItem *)srv)->m_pServerData->hostName();
if(kvi_strEqualCI(tmp.ptr(),data.ptr()))
@@ -1311,7 +1311,7 @@ void KviServerOptionsWidget::fillServerList()
if(cur)m_pListView->ensureItemVisible(cur);
}
-void KviServerOptionsWidget::listViewItemSelectionChanged(QListViewItem *it)
+void KviServerOptionsWidget::listViewItemSelectionChanged(KviTalListViewItem *it)
{
saveLastItem();
m_pLastEditedItem = (KviServerOptionsListViewItem *)it;
@@ -1421,7 +1421,7 @@ void KviServerOptionsWidget::commit()
KviOptionsWidget::commit();
}
-void KviServerOptionsWidget::listViewRightButtonPressed(QListViewItem *it,const QPoint &pnt,int col)
+void KviServerOptionsWidget::listViewRightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
{
int id;
bool bServer = (it && ((KviServerOptionsListViewItem *)it)->m_pServerData);
@@ -1626,7 +1626,7 @@ void KviServerOptionsWidget::removeCurrent()
{
if(m_pLastEditedItem)
{
- QListViewItem * it = m_pLastEditedItem->itemAbove();
+ KviTalListViewItem * it = m_pLastEditedItem->itemAbove();
if(!it)it = m_pLastEditedItem->firstChild() ? m_pLastEditedItem->nextSibling() : m_pLastEditedItem->itemBelow();
delete m_pLastEditedItem;
m_pLastEditedItem = 0;
diff --git a/src/modules/options/optw_servers.h b/src/modules/options/optw_servers.h
index 17595b938..7fc996249 100644
--- a/src/modules/options/optw_servers.h
+++ b/src/modules/options/optw_servers.h
@@ -26,7 +26,7 @@
//=============================================================================
#include "kvi_optionswidget.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qdialog.h>
#include <qbuttongroup.h>
#include <qtabwidget.h>
@@ -38,11 +38,11 @@ class KviMexServerImport;
-class KviServerOptionsListViewItem : public QListViewItem
+class KviServerOptionsListViewItem : public KviTalListViewItem
{
public:
- KviServerOptionsListViewItem(QListView *parent,const QPixmap &pm,const KviIrcNetwork *n);
- KviServerOptionsListViewItem(QListViewItem *parent,const QPixmap &pm,const KviIrcServer *s);
+ KviServerOptionsListViewItem(KviTalListView *parent,const QPixmap &pm,const KviIrcNetwork *n);
+ KviServerOptionsListViewItem(KviTalListViewItem *parent,const QPixmap &pm,const KviIrcServer *s);
~KviServerOptionsListViewItem();
public:
KviIrcServer * m_pServerData;
@@ -85,7 +85,7 @@ protected:
QCheckBox * m_pAutoConnectCheck;
- QListView * m_pNickServListView;
+ KviTalListView * m_pNickServListView;
QCheckBox * m_pNickServCheck;
QPushButton * m_pAddRuleButton;
QPushButton * m_pDelRuleButton;
@@ -158,7 +158,7 @@ public:
KviServerOptionsWidget(QWidget * parent);
~KviServerOptionsWidget();
protected:
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLabel * m_pSrvNetLabel;
QLineEdit * m_pSrvNetEdit;
//QLabel * m_pPortLabel;
@@ -190,8 +190,8 @@ protected slots:
void importerDead();
void importServer(const KviIrcServer & s,const char * network);
void importPopupAboutToShow();
- void listViewItemSelectionChanged(QListViewItem *it);
- void listViewRightButtonPressed(QListViewItem *it,const QPoint &pnt,int col);
+ void listViewItemSelectionChanged(KviTalListViewItem *it);
+ void listViewRightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col);
void newNetwork();
void removeCurrent();
void newServer();
diff --git a/src/modules/options/optw_transport.h b/src/modules/options/optw_transport.h
index 9e5c20d5c..d0b17210b 100644
--- a/src/modules/options/optw_transport.h
+++ b/src/modules/options/optw_transport.h
@@ -24,6 +24,6 @@
//
#include "kvi_optionswidget.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#endif //!_OPTW_TRANSPORT_H_
diff --git a/src/modules/popupeditor/popupeditor.cpp b/src/modules/popupeditor/popupeditor.cpp
index 21d4fef81..06478ff3e 100644
--- a/src/modules/popupeditor/popupeditor.cpp
+++ b/src/modules/popupeditor/popupeditor.cpp
@@ -55,15 +55,15 @@ extern KviPopupEditorWindow * g_pPopupEditorWindow;
//KviPopupEntryItem
-KviPopupListViewItem::KviPopupListViewItem(QListView * pListView,KviPopupListViewItem * after,Type t)
-: QListViewItem(pListView,after)
+KviPopupListViewItem::KviPopupListViewItem(KviTalListView * pListView,KviPopupListViewItem * after,Type t)
+: KviTalListViewItem(pListView,after)
{
m_type = t;
init();
}
KviPopupListViewItem::KviPopupListViewItem(KviPopupListViewItem * parent,KviPopupListViewItem * after,Type t)
-: QListViewItem(parent,after)
+: KviTalListViewItem(parent,after)
{
m_type = t;
init();
@@ -205,7 +205,7 @@ KviSinglePopupEditor::KviSinglePopupEditor(QWidget * par)
QSplitter * spl = new QSplitter(QSplitter::Vertical,this);
- m_pListView = new QListView(spl);
+ m_pListView = new KviTalListView(spl);
m_pListView->addColumn(__tr2qs("Item"));
m_pListView->addColumn(__tr2qs("Type"));
m_pListView->setMultiSelection(false);
@@ -215,9 +215,9 @@ KviSinglePopupEditor::KviSinglePopupEditor(QWidget * par)
m_pListView->setSorting(-1);
- connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(selectionChanged(QListViewItem *)));
- connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this,SLOT(itemPressed(QListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(selectionChanged(KviTalListViewItem *)));
+ connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
+ this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int)));
m_pEditor = KviScriptEditor::createInstance(spl);
@@ -366,7 +366,7 @@ void KviSinglePopupEditor::testModeMenuItemClicked(KviKvsPopupMenuItem * it)
}
-void KviSinglePopupEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col)
+void KviSinglePopupEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
{
m_pContextPopup->clear();
@@ -799,7 +799,7 @@ KviKvsPopupMenu * KviSinglePopupEditor::getMenu()
return p;
}
-void KviSinglePopupEditor::selectionChanged(QListViewItem * it)
+void KviSinglePopupEditor::selectionChanged(KviTalListViewItem * it)
{
saveLastSelectedItem();
@@ -1000,8 +1000,8 @@ void KviSinglePopupEditor::edit(KviMenuListViewItem * it)
-KviMenuListViewItem::KviMenuListViewItem(QListView * par,KviKvsPopupMenu * popup)
-: QListViewItem(par)
+KviMenuListViewItem::KviMenuListViewItem(KviTalListView * par,KviKvsPopupMenu * popup)
+: KviTalListViewItem(par)
{
setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_POPUP)));
setText(0,popup->name());
@@ -1030,9 +1030,9 @@ KviPopupEditor::KviPopupEditor(QWidget * par)
KviTalVBox * box = new KviTalVBox(spl);
- m_pListView = new QListView(box);
+ m_pListView = new KviTalListView(box);
m_pListView->addColumn(__tr2qs("Popup"));
- m_pListView->setSelectionMode(QListView::Extended);
+ m_pListView->setSelectionMode(KviTalListView::Extended);
m_pListView->setShowSortIndicator(true);
QPushButton * pb = new QPushButton(__tr2qs("&Export All To..."),box);
@@ -1075,13 +1075,13 @@ void KviPopupEditor::oneTimeSetup()
++it;
}
- connect(m_pListView,SIGNAL(currentChanged(QListViewItem *)),this,SLOT(currentItemChanged(QListViewItem *)));
- connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this,SLOT(itemPressed(QListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentItemChanged(KviTalListViewItem *)));
+ connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
+ this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int)));
}
-void KviPopupEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col)
+void KviPopupEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
{
__range_valid(m_bOneTimeSetupDone);
m_pContextPopup->clear();
@@ -1154,7 +1154,7 @@ void KviPopupEditor::exportPopups(bool bSelectedOnly)
QString out;
int count=0;
- QListViewItemIterator itv( m_pListView );
+ KviTalListViewItemIterator itv( m_pListView );
while( itv.current() )
{
if ( (itv.current()->isSelected()) || (bSelectedOnly == true) )
@@ -1221,7 +1221,7 @@ void KviPopupEditor::saveLastEditedItem()
m_pLastEditedItem->setText(0,m->popupName());
}
-void KviPopupEditor::currentItemChanged(QListViewItem *it)
+void KviPopupEditor::currentItemChanged(KviTalListViewItem *it)
{
saveLastEditedItem();
diff --git a/src/modules/popupeditor/popupeditor.h b/src/modules/popupeditor/popupeditor.h
index d2795b961..d2047eca2 100644
--- a/src/modules/popupeditor/popupeditor.h
+++ b/src/modules/popupeditor/popupeditor.h
@@ -27,7 +27,7 @@
#include <qwidget.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qlineedit.h>
#include "kvi_tal_popupmenu.h"
#include <qpushbutton.h>
@@ -36,12 +36,12 @@ class KviKvsPopupMenu;
class KviKvsPopupMenuItem;
// KviPopupListViewItem
-class KviPopupListViewItem : public QListViewItem
+class KviPopupListViewItem : public KviTalListViewItem
{
public:
enum Type { Item , Menu , Separator , Label , Epilogue , Prologue , ExtMenu };
public:
- KviPopupListViewItem(QListView * pListView,KviPopupListViewItem * after,Type t);
+ KviPopupListViewItem(KviTalListView * pListView,KviPopupListViewItem * after,Type t);
KviPopupListViewItem(KviPopupListViewItem * parent,KviPopupListViewItem * after,Type t);
public:
Type m_type;
@@ -77,7 +77,7 @@ protected:
KviKvsPopupMenu * m_pClipboard;
KviKvsPopupMenu * m_pTestPopup;
KviPopupListViewItem * m_pLastSelectedItem;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLineEdit * m_pNameEditor;
KviScriptEditor * m_pEditor;
QLineEdit * m_pTextEditor;
@@ -125,18 +125,18 @@ protected slots:
void contextNewLabelInside();
void contextNewPrologue();
void contextNewEpilogue();
- void selectionChanged(QListViewItem * it);
- void itemPressed(QListViewItem *it,const QPoint &pnt,int col);
+ void selectionChanged(KviTalListViewItem * it);
+ void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col);
void testPopup();
void testModeMenuItemClicked(KviKvsPopupMenuItem * it);
};
-class KviMenuListViewItem : public QListViewItem
+class KviMenuListViewItem : public KviTalListViewItem
{
public:
- KviMenuListViewItem(QListView * par,KviKvsPopupMenu * popup);
+ KviMenuListViewItem(KviTalListView * par,KviKvsPopupMenu * popup);
~KviMenuListViewItem();
public:
KviKvsPopupMenu * m_pPopup;
@@ -155,7 +155,7 @@ public:
~KviPopupEditor();
public:
KviSinglePopupEditor * m_pEditor;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
KviMenuListViewItem * m_pLastEditedItem;
bool m_bOneTimeSetupDone;
KviTalPopupMenu * m_pContextPopup;
@@ -163,13 +163,13 @@ public:
void commit();
void exportPopups(bool);
protected slots:
- void currentItemChanged(QListViewItem *it);
+ void currentItemChanged(KviTalListViewItem *it);
void newPopup();
void exportAll();
void exportSelected();
void exportCurrentPopup();
void removeCurrentPopup();
- void itemPressed(QListViewItem *it,const QPoint &pnt,int col);
+ void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col);
protected:
void showEvent(QShowEvent *e);
void getExportPopupBuffer(QString &buffer,KviMenuListViewItem * it);
diff --git a/src/modules/raweditor/raweditor.cpp b/src/modules/raweditor/raweditor.cpp
index 7a3189a4f..3b2d2fdcd 100644
--- a/src/modules/raweditor/raweditor.cpp
+++ b/src/modules/raweditor/raweditor.cpp
@@ -49,8 +49,8 @@ extern KviRawEditorWindow * g_pRawEditorWindow;
-KviRawListViewItem::KviRawListViewItem(QListView *par,int idx)
-: QListViewItem(par)
+KviRawListViewItem::KviRawListViewItem(KviTalListView *par,int idx)
+: KviTalListViewItem(par)
{
m_iIdx = idx;
m_szName.setNum(idx);
@@ -80,7 +80,7 @@ KviRawEditor::KviRawEditor(QWidget * par)
l->addWidget(spl,0,0);
KviTalVBox * boxi = new KviTalVBox(spl);
- m_pListView = new QListView(boxi);
+ m_pListView = new KviTalListView(boxi);
m_pListView->addColumn(__tr2qs("Raw Event"));
m_pListView->setMultiSelection(false);
m_pListView->setShowSortIndicator(true);
@@ -132,12 +132,12 @@ void KviRawEditor::oneTimeSetup()
m_pContextPopup = new KviTalPopupMenu(this);
- connect(m_pListView,SIGNAL(selectionChanged(QListViewItem *)),this,SLOT(selectionChanged(QListViewItem *)));
- connect(m_pListView,SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)),
- this,SLOT(itemPressed(QListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(selectionChanged(KviTalListViewItem *)),this,SLOT(selectionChanged(KviTalListViewItem *)));
+ connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)),
+ this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int)));
}
-void KviRawEditor::itemPressed(QListViewItem *it,const QPoint &pnt,int col)
+void KviRawEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
{
__range_valid(m_bOneTimeSetupDone);
m_pContextPopup->clear();
@@ -239,14 +239,14 @@ void KviRawEditor::addHandlerForCurrentRaw()
{
__range_valid(m_pOneTimeSetupDone);
- QListViewItem * it = m_pListView->selectedItem();
+ KviTalListViewItem * it = m_pListView->selectedItem();
if(it)
{
if(it->parent() == 0)
{
QString buffer = __tr2qs("default");
getUniqueHandlerName((KviRawListViewItem *)it,buffer);
- QListViewItem * ch = new KviRawHandlerListViewItem(it,buffer,"",true);
+ KviTalListViewItem * ch = new KviRawHandlerListViewItem(it,buffer,"",true);
it->setOpen(true);
m_pListView->setSelected(ch,true);
}
@@ -258,7 +258,7 @@ void KviRawEditor::removeCurrentHandler()
__range_valid(m_pOneTimeSetupDone);
if(m_pLastEditedItem)
{
- QListViewItem * it = m_pLastEditedItem;
+ KviTalListViewItem * it = m_pLastEditedItem;
m_pLastEditedItem = 0;
delete it;
m_pEditor->setEnabled(false);
@@ -283,12 +283,12 @@ void KviRawEditor::commit()
saveLastEditedItem();
KviKvsEventManager::instance()->removeAllScriptRawHandlers();
- for(QListViewItem * it = m_pListView->firstChild();it;it = it->nextSibling())
+ for(KviTalListViewItem * it = m_pListView->firstChild();it;it = it->nextSibling())
{
if(it->firstChild())
{
QString szContext;
- for(QListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling())
+ for(KviTalListViewItem * ch = it->firstChild();ch;ch = ch->nextSibling())
{
KviQString::sprintf(szContext,"RawEvent%d::%Q",&(((KviRawListViewItem *)it)->m_iIdx),&(((KviRawHandlerListViewItem *)ch)->m_szName));
@@ -325,7 +325,7 @@ void KviRawEditor::saveLastEditedItem()
m_pLastEditedItem->m_szBuffer = tmp;
}
-void KviRawEditor::selectionChanged(QListViewItem * it)
+void KviRawEditor::selectionChanged(KviTalListViewItem * it)
{
__range_valid(m_bOneTimeSetupDone);
saveLastEditedItem();
diff --git a/src/modules/raweditor/raweditor.h b/src/modules/raweditor/raweditor.h
index 8e5759ef1..a228ab17b 100644
--- a/src/modules/raweditor/raweditor.h
+++ b/src/modules/raweditor/raweditor.h
@@ -26,29 +26,29 @@
#include "kvi_qstring.h"
#include <qwidget.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qlineedit.h>
class KviScriptEditor;
-class KviRawListViewItem : public QListViewItem
+class KviRawListViewItem : public KviTalListViewItem
{
public:
int m_iIdx;
QString m_szName;
public:
- KviRawListViewItem(QListView * par,int idx);
+ KviRawListViewItem(KviTalListView * par,int idx);
~KviRawListViewItem() {};
public:
virtual QString text(int col) const { return m_szName; };
virtual const QPixmap * pixmap(int col) const;
};
-class KviRawHandlerListViewItem : public QListViewItem
+class KviRawHandlerListViewItem : public KviTalListViewItem
{
public:
- KviRawHandlerListViewItem(QListViewItem * par,const QString & name,const QString & buffer,bool bEnabled)
- : QListViewItem(par), m_szName(name) , m_szBuffer(buffer) , m_bEnabled(bEnabled) {};
+ KviRawHandlerListViewItem(KviTalListViewItem * par,const QString & name,const QString & buffer,bool bEnabled)
+ : KviTalListViewItem(par), m_szName(name) , m_szBuffer(buffer) , m_bEnabled(bEnabled) {};
~KviRawHandlerListViewItem() {};
public:
QString m_szName;
@@ -68,7 +68,7 @@ public:
~KviRawEditor();
public:
KviScriptEditor * m_pEditor;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QLineEdit * m_pNameEditor;
KviTalPopupMenu * m_pContextPopup;
KviRawHandlerListViewItem * m_pLastEditedItem;
@@ -79,8 +79,8 @@ public:
void getUniqueHandlerName(KviRawListViewItem *it,QString &buffer);
void getExportEventBuffer(QString &szBuffer,KviRawHandlerListViewItem * it);
protected slots:
- void selectionChanged(QListViewItem *it);
- void itemPressed(QListViewItem *it,const QPoint &pnt,int col);
+ void selectionChanged(KviTalListViewItem *it);
+ void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col);
void toggleCurrentHandlerEnabled();
void removeCurrentHandler();
void addHandlerForCurrentRaw();
diff --git a/src/modules/reguser/edituser.cpp b/src/modules/reguser/edituser.cpp
index 60e1cfeec..c923bdb36 100644
--- a/src/modules/reguser/edituser.cpp
+++ b/src/modules/reguser/edituser.cpp
@@ -343,8 +343,8 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste
l = new QLabel(__tr2qs("Masks:"),p1);
g->addMultiCellWidget(l,3,3,0,1);
- m_pMaskListBox = new QListBox(p1);
- connect(m_pMaskListBox,SIGNAL(currentChanged(QListBoxItem *)),this,SLOT(maskCurrentChanged(QListBoxItem *)));
+ m_pMaskListBox = new KviTalListBox(p1);
+ connect(m_pMaskListBox,SIGNAL(currentChanged(KviTalListBoxItem *)),this,SLOT(maskCurrentChanged(KviTalListBoxItem *)));
m_pMaskListBox->setMinimumSize(300,200);
g->addMultiCellWidget(m_pMaskListBox,4,4,0,1);
@@ -548,7 +548,7 @@ KviRegisteredUserEntryDialog::~KviRegisteredUserEntryDialog()
delete m_pCustomColor;
}
-void KviRegisteredUserEntryDialog::maskCurrentChanged(QListBoxItem *it)
+void KviRegisteredUserEntryDialog::maskCurrentChanged(KviTalListBoxItem *it)
{
m_pDelMaskButton->setEnabled(it);
m_pEditMaskButton->setEnabled(it);
@@ -773,7 +773,7 @@ void KviRegisteredUserEntryDialog::editAllPropertiesClicked()
}
-KviRegisteredUsersDialogItem::KviRegisteredUsersDialogItem(QListViewItem * par,KviRegisteredUser * u)
+KviRegisteredUsersDialogItem::KviRegisteredUsersDialogItem(KviTalListViewItem * par,KviRegisteredUser * u)
: KviRegisteredUsersDialogItemBase(User,par), m_pUser(u)
{
setText(0,u->name());
@@ -783,7 +783,7 @@ void KviRegisteredUsersDialogItem::paintCell(QPainter * p,const QColorGroup &cg,
{
if(column == 1)
{
- QListView *lv = listView();
+ KviTalListView *lv = (KviTalListView *)listView();
const BackgroundMode bgmode = lv->viewport()->backgroundMode();
const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode( bgmode );
p->fillRect(0,0,width,height(),isSelected() ? cg.brush(QColorGroup::Highlight) : cg.brush(crole));
@@ -810,7 +810,7 @@ void KviRegisteredUsersDialogItem::paintCell(QPainter * p,const QColorGroup &cg,
}
return;
}
- QListViewItem::paintCell(p,cg,column,width,align);
+ KviTalListViewItem::paintCell(p,cg,column,width,align);
}
@@ -828,14 +828,14 @@ KviRegisteredUsersDialog::KviRegisteredUsersDialog(QWidget * par)
QGridLayout * g = new QGridLayout(this,4,3,4,4);
- m_pListView = new QListView(this);
+ m_pListView = new KviTalListView(this);
m_pListView->addColumn(__tr2qs("Name"),200);
m_pListView->addColumn(__tr2qs("Notify"),130);
m_pListView->setAllColumnsShowFocus(true);
- m_pListView->setSelectionMode(QListView::Extended);
+ m_pListView->setSelectionMode(KviTalListView::Extended);
m_pListView->setRootIsDecorated(TRUE);
#ifdef COMPILE_INFO_TIPS
@@ -846,8 +846,8 @@ KviRegisteredUsersDialog::KviRegisteredUsersDialog(QWidget * par)
"Notify list fine-tuning can be performed by editing the entry properties.</center>"));
#endif // COMPILE_INFO_TIPS
- connect(m_pListView,SIGNAL(pressed(QListViewItem *,const QPoint &,int)),this,SLOT(itemPressed(QListViewItem *,const QPoint &,int)));
- connect(m_pListView,SIGNAL(doubleClicked(QListViewItem *)),this,SLOT(itemDoubleClicked(QListViewItem *)));
+ connect(m_pListView,SIGNAL(pressed(KviTalListViewItem *,const QPoint &,int)),this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int)));
+ connect(m_pListView,SIGNAL(doubleClicked(KviTalListViewItem *)),this,SLOT(itemDoubleClicked(KviTalListViewItem *)));
g->addMultiCellWidget(m_pListView,0,1,0,1);
@@ -938,7 +938,7 @@ KviRegisteredUsersDialog::KviRegisteredUsersDialog(QWidget * par)
g->setRowStretch(1,1);
connect(m_pListView,SIGNAL(selectionChanged()),this,SLOT(selectionChanged()));
- connect(m_pListView,SIGNAL(rightButtonClicked ( QListViewItem *, const QPoint &, int ) ),this,SLOT(listViewRightButtonClicked ( QListViewItem *, const QPoint &, int )));
+ connect(m_pListView,SIGNAL(rightButtonClicked ( KviTalListViewItem *, const QPoint &, int ) ),this,SLOT(listViewRightButtonClicked ( KviTalListViewItem *, const QPoint &, int )));
fillList();
@@ -971,7 +971,7 @@ KviRegisteredUsersDialog::~KviRegisteredUsersDialog()
g_pLocalRegisteredUserDataBase = 0;
}
-void KviRegisteredUsersDialog::itemPressed(QListViewItem *it,const QPoint &pnt,int c)
+void KviRegisteredUsersDialog::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int c)
{
if(!it)return;
KviRegisteredUsersDialogItemBase* b=(KviRegisteredUsersDialogItemBase*)it;
@@ -1017,7 +1017,7 @@ void KviRegisteredUsersDialog::itemPressed(QListViewItem *it,const QPoint &pnt,i
}
}
-void KviRegisteredUsersDialog::itemDoubleClicked(QListViewItem *it)
+void KviRegisteredUsersDialog::itemDoubleClicked(KviTalListViewItem *it)
{
if(!it)return;
KviRegisteredUsersDialogItemBase* b=(KviRegisteredUsersDialogItemBase*)it;
@@ -1071,7 +1071,7 @@ void KviRegisteredUsersDialog::editGroup(KviRegisteredUserGroup* group)
}
}
-void KviRegisteredUsersDialog::listViewRightButtonClicked ( QListViewItem * pItem, const QPoint & point, int )
+void KviRegisteredUsersDialog::listViewRightButtonClicked ( KviTalListViewItem * pItem, const QPoint & point, int )
{
if(pItem)
{
@@ -1102,7 +1102,7 @@ void KviRegisteredUsersDialog::listViewRightButtonClicked ( QListViewItem * pIte
void KviRegisteredUsersDialog::moveToGroupMenuClicked(int id)
{
QString szGroup=m_TmpDict.find(id)->name();
- QListViewItemIterator it( m_pListView, QListViewItemIterator::Selected );
+ KviTalListViewItemIterator it( m_pListView, KviTalListViewItemIterator::Selected );
while ( it.current() ) {
KviRegisteredUsersDialogItemBase* b=(KviRegisteredUsersDialogItemBase*)(it.current());
if(b->type()==KviRegisteredUsersDialogItemBase::User)
@@ -1207,7 +1207,7 @@ void KviRegisteredUsersDialog::addWizardClicked()
void KviRegisteredUsersDialog::removeClicked()
{
- QListViewItemIterator it( m_pListView, QListViewItemIterator::Selected );
+ KviTalListViewItemIterator it( m_pListView, KviTalListViewItemIterator::Selected );
while ( it.current() ) {
KviRegisteredUsersDialogItemBase* b=(KviRegisteredUsersDialogItemBase*)(it.current());
if(b->type()==KviRegisteredUsersDialogItemBase::User)
@@ -1274,7 +1274,7 @@ void KviRegisteredUsersDialog::editItem(KviRegisteredUsersDialogItem * i)
fillList();
// select the last edited item
- QListViewItem * i = m_pListView->firstChild();
+ KviTalListViewItem * i = m_pListView->firstChild();
while(i)
{
QString szTmp = i->text(0);
@@ -1319,7 +1319,7 @@ void KviRegisteredUsersDialog::exportClicked()
{
unsigned int nEntries = 0;
- QListViewItem * it;
+ KviTalListViewItem * it;
for(it = m_pListView->firstChild();it;it = it->nextSibling())
{
diff --git a/src/modules/reguser/edituser.h b/src/modules/reguser/edituser.h
index 2a98cffe5..5fa2af4be 100644
--- a/src/modules/reguser/edituser.h
+++ b/src/modules/reguser/edituser.h
@@ -31,8 +31,8 @@
#include <qwidget.h>
#include <qlineedit.h>
#include <qpushbutton.h>
-#include <qlistview.h>
-#include <qlistbox.h>
+#include "kvi_tal_listview.h"
+#include "kvi_tal_listbox.h"
#include "kvi_dict.h"
#include <qtabdialog.h>
#include <qtable.h>
@@ -79,17 +79,17 @@ protected slots:
void okClicked();
};
-class KviRegisteredUsersDialogItemBase : public QListViewItem
+class KviRegisteredUsersDialogItemBase : public KviTalListViewItem
{
public:
enum Types { User,Group };
protected:
- KviRegisteredUsersDialogItemBase(Types type,QListView * par)
- :QListViewItem(par),m_iType(type)
+ KviRegisteredUsersDialogItemBase(Types type,KviTalListView * par)
+ :KviTalListViewItem(par),m_iType(type)
{
};
- KviRegisteredUsersDialogItemBase(Types type,QListViewItem * par)
- :QListViewItem(par),m_iType(type)
+ KviRegisteredUsersDialogItemBase(Types type,KviTalListViewItem * par)
+ :KviTalListViewItem(par),m_iType(type)
{
};
~KviRegisteredUsersDialogItemBase()
@@ -107,7 +107,7 @@ class KviRegisteredUsersGroupItem : public KviRegisteredUsersDialogItemBase
protected:
KviRegisteredUserGroup * m_pGroup;
public:
- KviRegisteredUsersGroupItem(QListView * par,KviRegisteredUserGroup * g)
+ KviRegisteredUsersGroupItem(KviTalListView * par,KviRegisteredUserGroup * g)
:KviRegisteredUsersDialogItemBase(Group,par), m_pGroup(g)
{
setText(0,m_pGroup->name());
@@ -123,7 +123,7 @@ class KviRegisteredUsersDialogItem : public KviRegisteredUsersDialogItemBase
protected:
KviRegisteredUser * m_pUser;
public:
- KviRegisteredUsersDialogItem(QListViewItem * par,KviRegisteredUser * u);
+ KviRegisteredUsersDialogItem(KviTalListViewItem * par,KviRegisteredUser * u);
public:
KviRegisteredUser * user(){ return m_pUser; };
@@ -145,7 +145,7 @@ protected:
QLineEdit * m_pNameEdit;
QLineEdit * m_pCommentEdit;
- QListBox * m_pMaskListBox;
+ KviTalListBox * m_pMaskListBox;
QPushButton * m_pDelMaskButton;
QPushButton * m_pEditMaskButton;
@@ -181,7 +181,7 @@ protected slots:
void delMaskClicked();
void editMaskClicked();
void editAllPropertiesClicked();
- void maskCurrentChanged(QListBoxItem *it);
+ void maskCurrentChanged(KviTalListBoxItem *it);
};
@@ -192,7 +192,7 @@ public:
KviRegisteredUsersDialog(QWidget * par = 0);
~KviRegisteredUsersDialog();
public:
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QPushButton * m_pAddButton;
QPushButton * m_pWizardAddButton;
QPushButton * m_pRemoveButton;
@@ -203,8 +203,8 @@ public:
QIntDict<KviRegisteredUserGroup> m_TmpDict;
protected slots:
- void itemPressed(QListViewItem *it,const QPoint &pnt,int c);
- void itemDoubleClicked(QListViewItem *it);
+ void itemPressed(KviTalListViewItem *it,const QPoint &pnt,int c);
+ void itemDoubleClicked(KviTalListViewItem *it);
protected:
void fillList();
protected:
@@ -222,7 +222,7 @@ protected slots:
void exportClicked();
void addWizardClicked();
void addGroupClicked();
- void listViewRightButtonClicked ( QListViewItem *, const QPoint &, int );
+ void listViewRightButtonClicked ( KviTalListViewItem *, const QPoint &, int );
void moveToGroupMenuClicked(int);
};
diff --git a/src/modules/sharedfileswindow/sharedfileswindow.cpp b/src/modules/sharedfileswindow/sharedfileswindow.cpp
index 874a54f61..119ab0dc2 100644
--- a/src/modules/sharedfileswindow/sharedfileswindow.cpp
+++ b/src/modules/sharedfileswindow/sharedfileswindow.cpp
@@ -181,8 +181,8 @@ void KviSharedFileEditDialog::okClicked()
}
-KviSharedFilesListViewItem::KviSharedFilesListViewItem(QListView * lv,KviSharedFile * f)
-: QListViewItem(lv,f->name())
+KviSharedFilesListViewItem::KviSharedFilesListViewItem(KviTalListView * lv,KviSharedFile * f)
+: KviTalListViewItem(lv,f->name())
{
setText(1,f->absFilePath());
setText(2,f->userMask());
@@ -211,14 +211,14 @@ KviSharedFilesWindow::KviSharedFilesWindow(KviModuleExtensionDescriptor * d,KviF
KviTalVBox * vbox = new KviTalVBox(m_pSplitter);
- m_pListView = new QListView(vbox);
+ m_pListView = new KviTalListView(vbox);
//m_pListView->header()->hide();
m_pListView->setAllColumnsShowFocus(true);
m_pListView->addColumn(__tr2qs_ctx("Name","sharedfileswindow"),200);
m_pListView->addColumn(__tr2qs_ctx("Filename","sharedfileswindow"),300);
m_pListView->addColumn(__tr2qs_ctx("Mask","sharedfileswindow"),200);
m_pListView->addColumn(__tr2qs_ctx("Expires","sharedfileswindow"),200);
- m_pListView->setSelectionMode(QListView::Single);
+ m_pListView->setSelectionMode(KviTalListView::Single);
connect(m_pListView,SIGNAL(selectionChanged()),this,SLOT(enableButtons()));
connect(g_pSharedFilesManager,SIGNAL(sharedFilesChanged()),this,SLOT(fillFileView()));
@@ -244,7 +244,7 @@ KviSharedFilesWindow::~KviSharedFilesWindow()
void KviSharedFilesWindow::enableButtons()
{
- QListViewItem * it = m_pListView->currentItem();
+ KviTalListViewItem * it = m_pListView->currentItem();
m_pEditButton->setEnabled(it);
m_pRemoveButton->setEnabled(it);
}
@@ -311,7 +311,7 @@ void KviSharedFilesWindow::sharedFileAdded(KviSharedFile * f)
void KviSharedFilesWindow::sharedFileRemoved(KviSharedFile * f)
{
- QListViewItem * it = m_pListView->firstChild();
+ KviTalListViewItem * it = m_pListView->firstChild();
while(it)
{
if(((KviSharedFilesListViewItem *)it)->readOnlySharedFilePointer() == f)
@@ -374,7 +374,7 @@ void KviSharedFilesWindow::transferUnregistering(KviSharedFiles * t)
if(it)delete it;
}
-void KviSharedFilesWindow::rightButtonPressed(QListViewItem *it,const QPoint &pnt,int col)
+void KviSharedFilesWindow::rightButtonPressed(KviTalListViewItem *it,const QPoint &pnt,int col)
{
if(!m_pContextPopup)m_pContextPopup = new KviTalPopupMenu(this);
if(!m_pLocalFilePopup)m_pLocalFilePopup = new KviTalPopupMenu(this);
@@ -487,7 +487,7 @@ void KviSharedFilesWindow::rightButtonPressed(QListViewItem *it,const QPoint &pn
KviSharedFiles * KviSharedFilesWindow::selectedTransfer()
{
- QListViewItem * it = m_pListView->selectedItem();
+ KviTalListViewItem * it = m_pListView->selectedItem();
if(!it)return 0;
KviSharedFilesItem * i = (KviSharedFilesItem *)it;
return i->transfer();
@@ -623,8 +623,8 @@ void KviSharedFilesWindow::heartbeat()
{
if(m_pListView->childCount() < 1)return;
- QListViewItem * i1;
- QListViewItem * i2;
+ KviTalListViewItem * i1;
+ KviTalListViewItem * i2;
i1 = m_pListView->itemAt(QPoint(1,1));
if(!i1)
diff --git a/src/modules/sharedfileswindow/sharedfileswindow.h b/src/modules/sharedfileswindow/sharedfileswindow.h
index 663223e5b..23e941a3f 100644
--- a/src/modules/sharedfileswindow/sharedfileswindow.h
+++ b/src/modules/sharedfileswindow/sharedfileswindow.h
@@ -31,7 +31,7 @@
#include "kvi_moduleextension.h"
#include "kvi_sharedfiles.h"
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qdialog.h>
class QGridLayout;
@@ -41,10 +41,10 @@ class QLineEdit;
class QPushButton;
class KviStyledCheckBox;
-class KviSharedFilesListViewItem : public QListViewItem
+class KviSharedFilesListViewItem : public KviTalListViewItem
{
public:
- KviSharedFilesListViewItem(QListView * lv,KviSharedFile * f);
+ KviSharedFilesListViewItem(KviTalListView * lv,KviSharedFile * f);
~KviSharedFilesListViewItem();
protected:
KviSharedFile * m_pSharedFilePointer; // THIS IS READ ONLY!
@@ -87,7 +87,7 @@ public:
protected:
QSplitter * m_pVertSplitter;
- QListView * m_pListView;
+ KviTalListView * m_pListView;
QPushButton * m_pRemoveButton;
QPushButton * m_pEditButton;
diff --git a/src/modules/theme/managementdialog.cpp b/src/modules/theme/managementdialog.cpp
index d385e4746..a3c004c34 100644
--- a/src/modules/theme/managementdialog.cpp
+++ b/src/modules/theme/managementdialog.cpp
@@ -39,7 +39,7 @@
#include <qlayout.h>
#include <qpushbutton.h>
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
#include <qlineedit.h>
#include <qtextedit.h>
#include <qregexp.h>
@@ -78,8 +78,8 @@ extern QRect g_rectManagementDialogGeometry;
-KviThemeListBoxItem::KviThemeListBoxItem(QListBox * box,KviThemeInfo * inf)
-: QListBoxText(box)
+KviThemeListBoxItem::KviThemeListBoxItem(KviTalListBox * box,KviThemeInfo * inf)
+: KviTalListBoxText(box)
{
m_pThemeInfo = inf;
QString t;
@@ -120,7 +120,7 @@ KviThemeListBoxItem::~KviThemeListBoxItem()
void KviThemeListBoxItem::paint(QPainter * p)
{
- QListBoxText::paint(p);
+ KviTalListBoxText::paint(p);
p->drawPixmap(LVI_BORDER,LVI_BORDER, *(g_pIconManager->getBigIcon(QString(KVI_BIGICON_THEME))) );
int afterIcon = LVI_BORDER + LVI_ICON_SIZE + LVI_SPACING;
int www = p->window().width() - (afterIcon + LVI_BORDER);
@@ -128,7 +128,7 @@ void KviThemeListBoxItem::paint(QPainter * p)
m_pText->draw(p,afterIcon,LVI_BORDER,QRect(afterIcon,LVI_BORDER,www,p->window().height() - (LVI_BORDER * 2)),listBox()->viewport()->colorGroup());
}
-int KviThemeListBoxItem::height(const QListBox * lb) const
+int KviThemeListBoxItem::height(const KviTalListBox * lb) const
{
int iHeight = m_pText->height() + (2 * LVI_BORDER);
if(iHeight < (LVI_ICON_SIZE + (2 * LVI_BORDER)))iHeight = LVI_ICON_SIZE + (2 * LVI_BORDER);
@@ -197,13 +197,13 @@ KviThemeManagementDialog::KviThemeManagementDialog(QWidget * parent)
QWidget *w= new QWidget(hb);
w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
- m_pListBox = new QListBox(this);
+ m_pListBox = new KviTalListBox(this);
m_pListBox->setMinimumHeight(400);
m_pListBox->setMinimumWidth(400);
- m_pListBox->setSelectionMode(QListBox::Extended);
- connect(m_pListBox,SIGNAL(doubleClicked(QListBoxItem *)),this,SLOT(applyTheme(QListBoxItem *)));
- connect(m_pListBox,SIGNAL(contextMenuRequested(QListBoxItem *,const QPoint &)),
- this,SLOT(contextMenuRequested(QListBoxItem *,const QPoint &)));
+ m_pListBox->setSelectionMode(KviTalListBox::Extended);
+ connect(m_pListBox,SIGNAL(doubleClicked(KviTalListBoxItem *)),this,SLOT(applyTheme(KviTalListBoxItem *)));
+ connect(m_pListBox,SIGNAL(contextMenuRequested(KviTalListBoxItem *,const QPoint &)),
+ this,SLOT(contextMenuRequested(KviTalListBoxItem *,const QPoint &)));
connect(m_pListBox,SIGNAL(selectionChanged()),this,SLOT(enableDisableButtons()));
g->addMultiCellWidget(m_pListBox,1,1,0,1);
@@ -274,7 +274,7 @@ void KviThemeManagementDialog::packTheme()
}
-void KviThemeManagementDialog::contextMenuRequested(QListBoxItem * it,const QPoint & pos)
+void KviThemeManagementDialog::contextMenuRequested(KviTalListBoxItem * it,const QPoint & pos)
{
if(it)
{
@@ -286,7 +286,7 @@ void KviThemeManagementDialog::contextMenuRequested(QListBoxItem * it,const QPoi
}
}
-void KviThemeManagementDialog::applyTheme ( QListBoxItem * it)
+void KviThemeManagementDialog::applyTheme ( KviTalListBoxItem * it)
{
if(it)m_pListBox->setCurrentItem(it);
applyCurrentTheme();
@@ -407,7 +407,7 @@ void KviThemeManagementDialog::fillThemeBox()
bool KviThemeManagementDialog::hasSelectedItems()
{
- for(QListBoxItem * it = m_pListBox->firstItem();it;it = it->next())
+ for(KviTalListBoxItem * it = m_pListBox->firstItem();it;it = it->next())
{
if(it->isSelected())return true;
}
diff --git a/src/modules/theme/managementdialog.h b/src/modules/theme/managementdialog.h
index 25658a9dc..ef2fc37ec 100644
--- a/src/modules/theme/managementdialog.h
+++ b/src/modules/theme/managementdialog.h
@@ -30,7 +30,7 @@
#include <qdialog.h>
#include <qsimplerichtext.h>
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
#include <qcombobox.h>
#include "kvi_tal_popupmenu.h"
#include <qcursor.h>
@@ -48,17 +48,17 @@ class KviDynamicToolTip;
class KviStyledToolButton;
-class KviThemeListBoxItem : public QListBoxText
+class KviThemeListBoxItem : public KviTalListBoxText
{
public:
- KviThemeListBoxItem(QListBox * box,KviThemeInfo * inf);
+ KviThemeListBoxItem(KviTalListBox * box,KviThemeInfo * inf);
virtual ~KviThemeListBoxItem();
public:
KviThemeInfo * m_pThemeInfo;
QSimpleRichText * m_pText;
public:
KviThemeInfo * themeInfo(){ return m_pThemeInfo; };
- virtual int height ( const QListBox * lb ) const ;
+ virtual int height ( const KviTalListBox * lb ) const ;
protected:
virtual void paint ( QPainter * painter );
};
@@ -72,7 +72,7 @@ public:
virtual ~KviThemeManagementDialog();
protected:
static KviThemeManagementDialog * m_pInstance;
- QListBox * m_pListBox;
+ KviTalListBox * m_pListBox;
KviTalPopupMenu * m_pContextPopup;
KviStyledToolButton * m_pDeleteThemeButton;
KviStyledToolButton * m_pPackThemeButton;
@@ -92,10 +92,10 @@ protected slots:
void deleteTheme();
void closeClicked();
void packTheme();
- void applyTheme(QListBoxItem *);
+ void applyTheme(KviTalListBoxItem *);
void applyCurrentTheme();
void enableDisableButtons();
- void contextMenuRequested(QListBoxItem * item, const QPoint & pos);
+ void contextMenuRequested(KviTalListBoxItem * item, const QPoint & pos);
void tipRequest(KviDynamicToolTip *pTip,const QPoint &pnt);
};
diff --git a/src/modules/torrent/.svnignore b/src/modules/torrent/.svnignore
new file mode 100644
index 000000000..3ebe7fb0c
--- /dev/null
+++ b/src/modules/torrent/.svnignore
@@ -0,0 +1,10 @@
+Makefile.in
+Makefile
+.deps
+*.o
+*.lo
+*.la
+*.moc
+.libs
+.mospics
+.pics \ No newline at end of file
diff --git a/src/modules/torrent/Makefile.am b/src/modules/torrent/Makefile.am
new file mode 100644
index 000000000..c835d3ece
--- /dev/null
+++ b/src/modules/torrent/Makefile.am
@@ -0,0 +1,27 @@
+###############################################################################
+# KVirc IRC client Makefile - 10.03.2000 Szymon Stefanek <stefanek@tin.it>
+###############################################################################
+
+AM_CPPFLAGS = -I$(SS_TOPSRCDIR)/src/kvilib/include/ -I$(SS_TOPSRCDIR)/src/kvirc/include/ \
+$(SS_INCDIRS) $(SS_CPPFLAGS) -DGLOBAL_KVIRC_DIR=\"$(globalkvircdir)\"
+
+pluglib_LTLIBRARIES = libkvitorrent.la
+
+#%.moc: %.h
+# $(SS_QT_MOC) $< -o $@
+
+libkvitorrent_la_LDFLAGS = -avoid-version -module
+
+libkvitorrent_la_SOURCES = libkvitorrent.cpp \
+ tc_interface.cpp \
+ tc_ktorrentdcopinterface.cpp
+
+libkvitorrent_la_LIBADD = $(SS_LIBLINK) ../../kvilib/build/libkvilib.la
+
+noinst_HEADERS = tc_interface.h \
+ tc_ktorrentdcopinterface.h
+
+%.moc: %.h
+ $(SS_QT_MOC) $< -o $@
+
+tc_ktorrentdcopinterface.cpp: tc_ktorrentdcopinterface.moc
diff --git a/src/modules/torrent/libkvitorrent.cpp b/src/modules/torrent/libkvitorrent.cpp
new file mode 100644
index 000000000..fd516f1ac
--- /dev/null
+++ b/src/modules/torrent/libkvitorrent.cpp
@@ -0,0 +1,832 @@
+//=============================================================================
+//
+// File : libkvitorrent.cpp
+// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net)
+// Copyright (C) 2007 Alexander Stillich (torque at pltn dot 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_module.h"
+#include "kvi_options.h"
+
+#include "tc_interface.h"
+#include "tc_ktorrentdcopinterface.h"
+
+#include "kvi_locale.h"
+#include "kvi_out.h"
+
+
+static KviPtrList<KviTorrentInterfaceDescriptor> * g_pDescriptorList = 0;
+
+// selected torrent interface
+static KviTorrentInterface *g_pTcInterface = 0;
+
+//static KviMediaPlayerInterface * g_pMPInterface = 0;
+
+
+static KviTorrentInterface *auto_detect_torrent_client(KviWindow * pOut = 0)
+{
+ int iBest = 0;
+ KviTorrentInterface * pBest = 0;
+ KviTorrentInterfaceDescriptor * d;
+ KviTorrentInterfaceDescriptor * pDBest = 0;
+
+ for (d=g_pDescriptorList->first(); d!=0; d=g_pDescriptorList->next())
+ {
+// printf("detect %s\n%s\n", d->name().ascii(), d->description().ascii());
+
+ // instance gets deleted by descriptor later
+ KviTorrentInterface *i = d->instance();
+ if(i)
+ {
+// printf("detect %p\n", i);
+ int iScore = i->detect();
+ if(iScore > iBest)
+ {
+ iBest = iScore;
+ pBest = i;
+ pDBest = d;
+ }
+
+ if(pOut)
+ {
+ pOut->output(KVI_OUT_TORRENT,
+ __tr2qs_ctx("Trying torrent client interface \"%Q\": score %d", "torrent"),
+ &d->name(),
+ iScore);
+ }
+ }
+ }
+
+/* if(iBest < 90)
+ {
+ if(pOut)
+ pOut->outputNoFmt(KVI_OUT_MULTIMEDIA,__tr2qs_ctx("Not sure about the results, trying a second, more agressive detection pass","mediaplayer"));
+ // no sure player found... try again with a destructive test
+ for(d = g_pDescriptorList->first();d;d = g_pDescriptorList->next())
+ {
+ KviMediaPlayerInterface * i = d->instance();
+ if(i)
+ {
+ int iScore = i->detect(true);
+ if(iScore > iBest)
+ {
+ iBest = iScore;
+ pBest = i;
+ pDBest = d;
+ }
+ if(pOut)
+ {
+ QString szOut;
+ QString szNam = d->name();
+ KviQString::sprintf(szOut,__tr2qs_ctx("Trying media player interface \"%Q\": score %d","mediaplayer"),&(szNam),iScore);
+ pOut->output(KVI_OUT_MULTIMEDIA,szOut);
+ }
+ }
+ }
+ }
+*/
+ if(pDBest)
+ {
+ // TODO: what's this?
+// KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer) = pDBest->name();
+ if(pOut)
+ pOut->output(KVI_OUT_TORRENT,
+ __tr2qs_ctx("Choosing torrent client interface \"%Q\"", "torrent"),
+ &pDBest->name());
+
+ } else {
+ if(pOut)
+ pOut->outputNoFmt(KVI_OUT_TORRENT,
+ __tr2qs_ctx("Seems that there is no usable torrent client on this machine", "torrent"));
+
+ }
+
+ return pBest;
+}
+
+
+static bool torrent_test(KviKvsModuleCommandCall *c)
+{
+/* kvs_real_t dReal; \
+ KVSM_PARAMETERS_BEGIN(c) \
+ KVSM_PARAMETER("test1", KVS_PT_REAL, 0, dReal) \
+ KVSM_PARAMETERS_END(c) \
+ c->returnValue()->setReal(dReal); \
+
+ printf("test called %f\n", dReal);
+*/
+ if (!g_pTcInterface)
+ return false;
+
+ int count = g_pTcInterface->count();
+ for (int i=0; i<count; i++)
+ {
+ QString n = g_pTcInterface->name(i);
+ debug("%d: %s [%s]", i, n.ascii(), g_pTcInterface->state(i).ascii());
+ }
+
+ return true;
+}
+
+#define TC_KVS_FAIL_ON_NO_INTERFACE \
+ if (!g_pTcInterface) \
+ { \
+ c->warning(__tr2qs_ctx("No torrent client interface selected. Try /torrent.detect", "torrent")); \
+ return true; \
+ }
+
+#define TC_KVS_COMMAND(__name) static bool torrent_kvs_cmd_ ## __name (KviKvsModuleCommandCall * c)
+#define TC_KVS_FUNCTION(__name) static bool torrent_kvs_fnc_ ## __name (KviKvsModuleFunctionCall * c)
+
+#define TC_KVS_COMMAND_ERROR \
+ if (!c->hasSwitch('q',"quiet")) \
+ { \
+ c->warning(__tr2qs_ctx("The selected torrent client interface failed to execute the requested function", "torrent")); \
+ QString tmp = __tr2qs_ctx("Last interface error: ", "torrent"); \
+ tmp += g_pTcInterface->lastError(); \
+ c->warning(tmp); \
+ } \
+
+#define TC_KVS_SIMPLE_COMMAND(__name, __ifacecommand) \
+ TC_KVS_COMMAND(__name) \
+ { \
+ KVSM_PARAMETERS_BEGIN(c) \
+ KVSM_PARAMETERS_END(c) \
+ \
+ TC_KVS_FAIL_ON_NO_INTERFACE \
+ \
+ if (!g_pTcInterface->__ifacecommand()) \
+ { \
+ TC_KVS_COMMAND_ERROR \
+ } \
+ return true; \
+ }
+
+#define TC_KVS_INT_COMMAND(__name, __ifacecommand, __argname) \
+ TC_KVS_COMMAND(__name) \
+ { \
+ debug("TC_KVS_INT_COMMAND"); \
+ kvs_int_t arg; \
+ KVSM_PARAMETERS_BEGIN(c) \
+ KVSM_PARAMETER(__argname, KVS_PT_INT, 0, arg) \
+ KVSM_PARAMETERS_END(c) \
+ debug("TC_KVS_INT_COMMAND 2"); \
+ TC_KVS_FAIL_ON_NO_INTERFACE \
+ \
+ if (!g_pTcInterface->__ifacecommand(arg)) \
+ { \
+ debug("TC_KVS_INT_COMMAND 3"); \
+ TC_KVS_COMMAND_ERROR \
+ } \
+ debug("TC_KVS_INT_COMMAND 4"); \
+ return true; \
+ }
+
+#define TC_KVS_STRINGRET_FUNCTION(__name, __ifacecommand) \
+ TC_KVS_FUNCTION(__name) \
+ { \
+ TC_KVS_FAIL_ON_NO_INTERFACE \
+ QString szRet = g_pTcInterface->__ifacecommand(); \
+ c->returnValue()->setString(szRet); \
+ return true; \
+ }
+
+#define TC_KVS_INTRET_FUNCTION(__name, __ifacecommand) \
+ TC_KVS_FUNCTION(__name) \
+ { \
+ TC_KVS_FAIL_ON_NO_INTERFACE \
+ kvs_int_t ret = g_pTcInterface->__ifacecommand(); \
+ c->returnValue()->setInteger(ret); \
+ return true; \
+ }
+
+#define TC_KVS_FLOATRET_FUNCTION(__name, __ifacecommand) \
+ TC_KVS_FUNCTION(__name) \
+ { \
+ TC_KVS_FAIL_ON_NO_INTERFACE \
+ kvs_real_t ret = g_pTcInterface->__ifacecommand(); \
+ c->returnValue()->setReal(ret); \
+ return true; \
+ }
+
+#define TC_KVS_STRINGRET_INT_FUNCTION(__name, __ifacecommand, __argname) \
+ TC_KVS_FUNCTION(__name) \
+ { \
+ kvs_int_t arg; \
+ KVSM_PARAMETERS_BEGIN(c) \
+ KVSM_PARAMETER(__argname, KVS_PT_INT, 0, arg) \
+ KVSM_PARAMETERS_END(c) \
+ TC_KVS_FAIL_ON_NO_INTERFACE \
+ QString szRet = g_pTcInterface->__ifacecommand(arg); \
+ c->returnValue()->setString(szRet); \
+ return true; \
+ }
+
+/*
+#define MP_KVS_SIMPLE_INT_FUNCTION(__name,__ifacecommand) \
+MP_KVS_FUNCTION(__name) \
+{ \
+ MP_KVS_FAIL_ON_NO_INTERFACE \
+ int iRet = g_pMPInterface->__ifacecommand(); \
+ c->returnValue()->setInteger(iRet); \
+ return true; \
+}
+// FINDME!
+#define MP_KVS_SIMPLE_BOOL_FUNCTION(__name,__ifacecommand) \
+MP_KVS_FUNCTION(__name) \
+{ \
+ MP_KVS_FAIL_ON_NO_INTERFACE \
+ bool bRet = g_pMPInterface->__ifacecommand(); \
+ c->returnValue()->setBoolean(bRet); \
+ return true; \
+}
+*/
+
+TC_KVS_COMMAND(detect)
+{
+ g_pTcInterface = auto_detect_torrent_client(c->hasSwitch('q',"quiet") ? 0 : c->window());
+ return true;
+}
+
+/*
+ @doc: torrent.maxUploadSpeed
+ @type:
+ function
+ @title:
+ $torrent.maxUploadSpeed
+ @short:
+ Returns maximum upload speed set in client.
+ @syntax:
+ $torrent.maxUploadSpeed()
+ @description:
+ Returns maximum upload speed set in client.
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_INTRET_FUNCTION(maxUploadSpeed, maxUploadSpeed)
+
+
+/*
+ @doc: torrent.maxDownloadSpeed
+ @type:
+ function
+ @title:
+ $torrent.maxDownloadSpeed
+ @short:
+ Returns maximum download speed set in client.
+ @syntax:
+ $torrent.maxDownloadSpeed()
+ @description:
+ Returns maximum download speed set in client.
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_INTRET_FUNCTION(maxDownloadSpeed, maxDownloadSpeed)
+
+/*
+ @doc: torrent.setMaxUploadSpeed
+ @type:
+ command
+ @title:
+ torrent.setMaxUploadSpeed
+ @short:
+ Sets maximum upload speed
+ @syntax:
+ torrent.setMaxUploadSpeed <kbytes_per_sec>
+ @description:
+ Sets maximum upload speed
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_INT_COMMAND(setMaxUploadSpeed, setMaxUploadSpeed, "kbytes_per_sec")
+
+/*
+ @doc: torrent.setMaxDownloadSpeed
+ @type:
+ command
+ @title:
+ torrent.setMaxDownloadSpeed
+ @short:
+ Sets maximum download speed
+ @syntax:
+ torrent.setMaxDownloadSpeed <kbytes_per_sec>
+ @description:
+ Sets maximum download speed
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_INT_COMMAND(setMaxDownloadSpeed, setMaxDownloadSpeed, "kbytes_per_sec")
+
+/*
+ @doc: torrent.speedUp
+ @type:
+ function
+ @title:
+ $torrent.speedUp
+ @short:
+ Returns current total upload speed
+ @syntax:
+ $torrent.speedUp()
+ @description:
+ Returns current total upload speed
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_FLOATRET_FUNCTION(speedUp, speedUp)
+
+/*
+ @doc: torrent.speedDown
+ @type:
+ function
+ @title:
+ $torrent.speedDown
+ @short:
+ Returns current total download speed
+ @syntax:
+ $torrent.speedDown()
+ @description:
+ Returns current total download speed
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_FLOATRET_FUNCTION(speedDown, speedDown)
+
+/*
+ @doc: torrent.count
+ @type:
+ function
+ @title:
+ $torrent.count
+ @short:
+ Returns number of torrents in client
+ @syntax:
+ $torrent.name()
+ @description:
+ Returns number of torrents in client
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_INTRET_FUNCTION(count, count)
+
+/*
+ @doc: torrent.name
+ @type:
+ function
+ @title:
+ $torrent.name
+ @short:
+ Returns torrent name as displayed in client
+ @syntax:
+ $torrent.name(torrent_number)
+ @description:
+ Returns torrent name as displayed in client
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_STRINGRET_INT_FUNCTION(name, name, "torrent_number")
+
+/*
+ @doc: torrent.start
+ @type:
+ command
+ @title:
+ torrent.start
+ @short:
+ Starts downloading of torrent <torrent_number>
+ @syntax:
+ torrent.start <torrent_number>
+ @description:
+ Starts downloading of torrent <torrent_number>
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+ [cmd]torrent.stop[/cmd], [cmd]torrent.stopAll[/cmd], [cmd]torrent.startAll[/cmd]
+*/
+TC_KVS_INT_COMMAND(start, start, "torrent_number")
+
+/*
+ @doc: torrent.stop
+ @type:
+ command
+ @title:
+ torrent.stop
+ @short:
+ Stops downloading of torrent <torrent_number>
+ @syntax:
+ torrent.stop <torrent_number>
+ @description:
+ Stops downloading of torrent <torrent_number>
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+ [cmd]torrent.stopAll[/cmd], [cmd]torrent.startAll[/cmd], [cmd]torrent.start[/cmd]
+*/
+TC_KVS_INT_COMMAND(stop, stop, "torrent_number")
+
+/*
+ @doc: torrent.announce
+ @type:
+ command
+ @title:
+ torrent.announce
+ @short:
+ Manually announces torrent to tracker
+ @syntax:
+ torrent.announce <torrent_number>
+ @description:
+ Manually announces torrent to tracker
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_INT_COMMAND(announce, announce, "torrent_number")
+
+/*
+ @doc: torrent.startAll
+ @type:
+ command
+ @title:
+ torrent.startAll
+ @short:
+ Starts downloading of all torrents
+ @syntax:
+ torrent.startAll
+ @description:
+ Starts downloading of all torrents
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+ [cmd]torrent.stopAll[/cmd], [cmd]torrent.start[/cmd], [cmd]torrent.stop[/cmd]
+*/
+
+TC_KVS_SIMPLE_COMMAND(startAll, startAll)
+
+/*
+ @doc: torrent.stopAll
+ @type:
+ command
+ @title:
+ torrent.stopAll
+ @short:
+ Stops downloading of all torrents
+ @syntax:
+ torrent.stopAll
+ @description:
+ Stops downloading of all torrents
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+ [cmd]torrent.startAll[/cmd], [cmd]torrent.start[/cmd], [cmd]torrent.stop[/cmd]
+*/
+
+TC_KVS_SIMPLE_COMMAND(stopAll, stopAll)
+
+
+/*
+ @doc: torrent.list
+ @type:
+ function
+ @title:
+ torrent.list
+ @short:
+ Returns a list of all torrents
+ @syntax:
+ $torrent.list()
+ @description:
+ Returns a list of all torrents
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+ [cmd]torrent.startAll[/cmd], [cmd]torrent.start[/cmd], [cmd]torrent.stop[/cmd]
+*/
+
+//MP_KVS_SIMPLE_COMMAND(list,list)
+
+/*
+ @doc: torrent.status
+ @type:
+ function
+ @title:
+ torrent.status
+ @short:
+ Returns status of a torrent
+ @syntax:
+ $torrent.status(<torrent_number>)
+ @description:
+ Returns the status of torrent <torrent_number>
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+ [fnc]torrent.list[/fnc], [cmd]torrent.start[/cmd], [cmd]torrent.stop[/cmd], [cmd]torrent.startAll[/cmd], [cmd]torrent.stopAll[/cmd]
+*/
+
+//MP_KVS_SIMPLE_COMMAND(list,list)
+
+/*
+ @doc: torrent.setClient
+ @type:
+ command
+ @title:
+ torrent.setClient
+ @short:
+ Sets the torrent client interface
+ @syntax:
+ torrent.setClient <client_name>
+ @description:
+ Sets the torrent client interface to be used by the
+ torrent interface module. <interface_name> must be one
+ of the client names returned by [cmd]torrent.clientList[/cmd]
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+ [cmd]torrent.detect[/cmd], [fnc]$torrent.client()[/fnc]
+*/
+/*
+MP_KVS_COMMAND(setClient)
+{
+ QString szPlayer;
+
+ KVSM_PARAMETERS_BEGIN(c)
+ KVSM_PARAMETER("player",KVS_PT_STRING,0,szPlayer)
+ KVSM_PARAMETERS_END(c)
+
+ for(KviMediaPlayerInterfaceDescriptor * d = g_pDescriptorList->first();d;d = g_pDescriptorList->next())
+ {
+ if(d->name() == szPlayer)
+ {
+ g_pMPInterface = d->instance();
+ KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer) = szPlayer;
+ return true;
+ }
+ }
+
+ return true;
+}
+*/
+/*
+ @doc: torrent.client
+ @type:
+ function
+ @title:
+ $torrent.client
+ @short:
+ Returns the currently set torrent client interface
+ @syntax:
+ $torrent.client()
+ @description:
+ Returns the currently set torrent client interface.
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+ [cmd]torrent.detect[/cmd], [cmd]torrent.setClient[/cmd]
+*/
+
+/*MP_KVS_FUNCTION(client)
+{
+ c->returnValue()->setString(KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer));
+ return true;
+}
+*/
+/*
+ @doc: torrent.clientList
+ @type:
+ command
+ @title:
+ torrent.clientList
+ @short:
+ Returns a list of all supported clients
+ @syntax:
+ torrent.clientList
+ @description:
+ Returns a list of all supported clients
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+ [cmd]torrent.detect[/cmd], [cmd]torrent.setClient[/cmd], [cmd]torrent.client[/cmd]
+*/
+/*MP_KVS_FUNCTION(clientList)
+{
+ //c->returnValue()->setString(KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer));
+ return true;
+}
+*/
+
+/*
+ @doc: torrent.state
+ @type:
+ function
+ @title:
+ $torrent.state
+ @short:
+ Returns state of torrent (Stopped, Stalled, Seeding, Downloading)
+ @syntax:
+ $torrent.state <torrent_number>
+ @description:
+ Returns state of torrent (Stopped, Stalled, Seeding, Downloading)
+ Take a look at the [module:torrent]torrent client documentation[/module]
+ for more details about how it works.[br]
+ @seealso:
+ [module:torrent]torrent client documentation[/module],
+*/
+TC_KVS_STRINGRET_INT_FUNCTION(state, state, "torrent_number")
+
+static bool torrent_module_init(KviModule *m)
+{
+ #define TC_KVS_REGCMD(__name,__stringname) KVSM_REGISTER_SIMPLE_COMMAND(m, __stringname, torrent_kvs_cmd_ ## __name)
+ #define TC_KVS_REGFNC(__name,__stringname) KVSM_REGISTER_FUNCTION(m, __stringname, torrent_kvs_fnc_ ## __name)
+
+ KVSM_REGISTER_SIMPLE_COMMAND(m, "test", torrent_test);
+ TC_KVS_REGCMD(detect, "detect");
+ TC_KVS_REGCMD(start, "start")
+ TC_KVS_REGCMD(stop, "stop")
+ TC_KVS_REGCMD(announce, "announce")
+ TC_KVS_REGCMD(startAll, "startAll")
+ TC_KVS_REGCMD(stopAll, "stopAll")
+ TC_KVS_REGCMD(setMaxUploadSpeed, "setMaxUploadSpeed")
+ TC_KVS_REGCMD(setMaxDownloadSpeed, "setMaxDownloadSpeed")
+ TC_KVS_REGFNC(maxUploadSpeed, "maxUploadSpeed")
+ TC_KVS_REGFNC(maxDownloadSpeed, "maxDownloadSpeed")
+ TC_KVS_REGFNC(speedUp, "speedUp")
+ TC_KVS_REGFNC(speedDown, "speedDown")
+ TC_KVS_REGFNC(count, "count")
+ TC_KVS_REGFNC(name, "name")
+ TC_KVS_REGFNC(state, "state")
+
+ g_pDescriptorList = new KviPtrList<KviTorrentInterfaceDescriptor>;
+ g_pDescriptorList->setAutoDelete(true);
+
+#ifdef COMPILE_KDE_SUPPORT
+ g_pDescriptorList->append(new KviKTorrentDCOPInterfaceDescriptor);
+#endif // COMPILE_KDE_SUPPORT
+
+ g_pTcInterface = 0;
+
+/* if(KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer) == "auto")
+ {
+ g_pMPInterface = auto_detect_player();
+
+ } else
+ {
+ for (KviMediaPlayerInterfaceDescriptor *d=g_pDescriptorList->first(); d; d=g_pDescriptorList->next())
+ {
+ if (d->name() == KVI_OPTION_STRING(KviOption_stringPreferredMediaPlayer))
+ {
+ g_pMPInterface = d->instance();
+ }
+ }
+ }
+
+ // check for "auto" interface too!
+
+
+ #define MP_KVS_REGCMD(__name,__stringname) KVSM_REGISTER_SIMPLE_COMMAND(m,__stringname,mediaplayer_kvs_cmd_ ## __name)
+ #define MP_KVS_REGFNC(__name,__stringname) KVSM_REGISTER_FUNCTION(m,__stringname,mediaplayer_kvs_fnc_ ## __name)
+
+ MP_KVS_REGCMD(play,"play");
+ MP_KVS_REGCMD(stop,"stop");
+ MP_KVS_REGCMD(next,"next");
+ MP_KVS_REGCMD(prev,"prev");
+ MP_KVS_REGCMD(quit,"quit");
+ MP_KVS_REGCMD(pause,"pause");
+ MP_KVS_REGCMD(detect,"detect");
+ MP_KVS_REGCMD(playMrl,"playMrl");
+ MP_KVS_REGCMD(hide,"hide");
+ MP_KVS_REGCMD(show,"show");
+ MP_KVS_REGCMD(minimize,"minimize");
+ MP_KVS_REGCMD(jumpTo,"jumpTo");
+ MP_KVS_REGCMD(setPlayer,"setPlayer");
+ MP_KVS_REGCMD(setVol,"setVol");
+ MP_KVS_REGCMD(mute,"mute");
+ MP_KVS_REGCMD(setRepeat,"setRepeat");
+ MP_KVS_REGCMD(setShuffle,"setShuffle");
+ MP_KVS_REGCMD(setPlayListPos,"setPlayListPos");
+ MP_KVS_REGCMD(setEqData,"setEqData");
+
+ MP_KVS_REGFNC(nowPlaying,"nowPlaying");
+ MP_KVS_REGFNC(mrl,"mrl");
+ MP_KVS_REGFNC(title,"title");
+ MP_KVS_REGFNC(artist,"artist");
+ MP_KVS_REGFNC(genre,"genre");
+ MP_KVS_REGFNC(year,"year");
+ MP_KVS_REGFNC(comment,"comment");
+ MP_KVS_REGFNC(album,"album");
+ MP_KVS_REGFNC(mediaType,"mediaType");
+ MP_KVS_REGFNC(bitRate,"bitRate");
+ MP_KVS_REGFNC(sampleRate,"sampleRate");
+ MP_KVS_REGFNC(length,"length");
+ MP_KVS_REGFNC(position,"position");
+ MP_KVS_REGFNC(status,"status");
+ MP_KVS_REGFNC(player,"player");
+ MP_KVS_REGFNC(playerList,"playerList");
+ MP_KVS_REGFNC(localFile,"localFile");
+ MP_KVS_REGFNC(channels,"channels");
+ MP_KVS_REGFNC(getListLength,"getListLength");
+ MP_KVS_REGFNC(getPlayListPos,"getPlayListPos");
+ MP_KVS_REGFNC(getEqData,"getEqData");
+ MP_KVS_REGFNC(getRepeat,"getRepeat");
+ MP_KVS_REGFNC(getShuffle,"getShuffle");
+ MP_KVS_REGFNC(getVol,"getVol");
+
+*/
+/*
+ // Crissi
+ m->registerFunction( "getmp3tag_date", mediaplayer_fnc_getmp3tag_date );
+ m->registerFunction( "getmp3tag_version", mediaplayer_fnc_getmp3tag_version );
+ m->registerFunction( "getmp3tag_layer", mediaplayer_fnc_getmp3tag_layer );
+ m->registerFunction( "getmp3tag_crc", mediaplayer_fnc_getmp3tag_crc );
+ m->registerFunction( "getmp3tag_copyright", mediaplayer_fnc_getmp3tag_copyright );
+ m->registerFunction( "getmp3tag_original", mediaplayer_fnc_getmp3tag_original );
+ m->registerFunction( "getmp3tag_emphasis", mediaplayer_fnc_getmp3tag_emphasis );
+ m->registerFunction( "getmp3tag_tracknumber", mediaplayer_fnc_getmp3tag_tracknumber );
+*/
+ return true;
+}
+
+static bool torrent_module_cleanup( KviModule * m )
+{
+ delete g_pDescriptorList;
+ return true;
+}
+
+static bool torrent_module_can_unload( KviModule * m )
+{
+ return true;
+}
+
+static bool torrent_module_ctrl(KviModule * m,const char * operation,void * param)
+{
+/* if(kvi_strEqualCI(operation,"getAvailableMediaPlayers"))
+ {
+ // we expect param to be a pointer to QStringList
+ QStringList * l = (QStringList *)param;
+ for(KviMediaPlayerInterfaceDescriptor * d = g_pDescriptorList->first();d;d = g_pDescriptorList->next())
+ {
+ l->append(d->name());
+ }
+ return true;
+ }
+ if(kvi_strEqualCI(operation,"detectMediaPlayer"))
+ {
+ auto_detect_player(0);
+ return true;
+ }
+*/
+ return false;
+}
+
+
+
+KVIRC_MODULE(
+ "torrent",
+ "1.0.0",
+ "Copyright (C) 2007 Alexander Stillich (torque at pltn dot org)",
+ "Interface to various torrent clients",
+ torrent_module_init,
+ torrent_module_can_unload,
+ torrent_module_ctrl,
+ torrent_module_cleanup
+)
diff --git a/src/modules/torrent/tc_interface.cpp b/src/modules/torrent/tc_interface.cpp
new file mode 100644
index 000000000..b035a66ba
--- /dev/null
+++ b/src/modules/torrent/tc_interface.cpp
@@ -0,0 +1,30 @@
+//=============================================================================
+//
+// Common interface for BitTorrent clients.
+//
+// File : tc_interface.cpp
+// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net)
+// Copyright (C) 2007 Alexander Stillich (torque at pltn dot 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "tc_interface.h"
+#include "kvi_locale.h"
+
diff --git a/src/modules/torrent/tc_interface.h b/src/modules/torrent/tc_interface.h
new file mode 100644
index 000000000..ecf586b60
--- /dev/null
+++ b/src/modules/torrent/tc_interface.h
@@ -0,0 +1,160 @@
+#ifndef _TC_INTERFACE_H_
+#define _TC_INTERFACE_H_
+
+//=============================================================================
+//
+// Common interface for BitTorrent clients.
+//
+// File : tc_interface.h
+// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net)
+// Copyright (C) 2007 Alexander Stillich (torque at pltn dot 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_settings.h"
+#include "kvi_qstring.h"
+#include <qobject.h>
+
+class KviTorrentInterface : public QObject
+{
+
+public:
+
+ KviTorrentInterface() {}
+ virtual ~KviTorrentInterface() {}
+
+ virtual int detect() = 0;
+
+ // returns number of torrents in client
+ virtual int count()=0;
+
+/*
+ // path of torrent file
+ virtual QCString getTorrentFile(int i)=0;
+
+ // directory where data is downloaded to
+ virtual QCString getTorrentDataDir(int i)=0;
+
+ // number of files in torrent
+ virtual QCString getTorrentFileCount(int i)=0;
+ // name of file in torrent
+ virtual QCString getTorrentFileName(int i)=0;
+ virtual int getTorrentFilePriority(int i)=0;
+ virtual void setTorrentFilePriority(int i, int prio)=0;
+*/
+ virtual bool start(int i)=0;
+ virtual bool stop(int i)=0;
+
+ virtual bool announce(int i)=0;
+
+ virtual bool startAll()=0;
+ virtual bool stopAll()=0;
+/*
+ // manual announce to tracker
+ virtual bool announceTorrent(int i)=0;
+ // remove torrent from client
+ virtual bool removeTorrent(int i)=0;
+
+ virtual bool addTorrent(const QCString &mrl);
+*/
+ // returns state of torrent number i (Stopped, Stalled, Seeding, Downloading)
+ // this uses getTorrentInfo() to obtain the state and then
+ // returns it as string
+ virtual QString state(int i)=0;
+
+ // name of torrent as displayed in client
+ // uses getTorrentInfo()
+ virtual QString name(int i)=0;
+
+ virtual float speedUp()=0;
+ virtual float speedDown()=0;
+
+ virtual float trafficUp()=0;
+ virtual float trafficDown()=0;
+
+ virtual int maxUploadSpeed()=0;
+ virtual int maxDownloadSpeed()=0;
+
+ virtual bool setMaxUploadSpeed(int kbytes_per_sec)=0;
+ virtual bool setMaxDownloadSpeed(int kbytes_per_sec)=0;
+
+ QString lastError() { return m_lastError; }
+
+protected:
+
+ QString m_lastError;
+
+};
+
+class KviTorrentInterfaceDescriptor
+{
+public:
+ KviTorrentInterfaceDescriptor() {};
+ virtual ~KviTorrentInterfaceDescriptor() {};
+public:
+ virtual const QString & name() = 0;
+ virtual const QString & description() = 0;
+ virtual KviTorrentInterface * instance() = 0;
+};
+
+#define TORR_DECLARE_DESCRIPTOR(_interfaceclass) \
+ class _interfaceclass ## Descriptor : public KviTorrentInterfaceDescriptor \
+ { \
+ public: \
+ _interfaceclass ## Descriptor(); \
+ virtual ~_interfaceclass ## Descriptor(); \
+ protected: \
+ _interfaceclass * m_pInstance; \
+ QString m_szName; \
+ QString m_szDescription; \
+ public: \
+ virtual const QString & name(); \
+ virtual const QString & description(); \
+ virtual KviTorrentInterface * instance(); \
+ };
+
+#define TORR_IMPLEMENT_DESCRIPTOR(_interfaceclass,_name,_description) \
+ _interfaceclass ## Descriptor::_interfaceclass ## Descriptor() \
+ : KviTorrentInterfaceDescriptor() \
+ { \
+ m_pInstance = 0; \
+ m_szName = _name; \
+ m_szDescription = _description; \
+ } \
+ _interfaceclass ## Descriptor::~_interfaceclass ## Descriptor() \
+ { \
+ delete m_pInstance; \
+ } \
+ const QString & _interfaceclass ## Descriptor::name() \
+ { \
+ return m_szName; \
+ } \
+ const QString & _interfaceclass ## Descriptor::description() \
+ { \
+ return m_szDescription; \
+ } \
+ KviTorrentInterface * _interfaceclass ## Descriptor::instance() \
+ { \
+ if (!m_pInstance) m_pInstance = new _interfaceclass(); \
+ return m_pInstance; \
+ }
+
+#endif // _TC_INTERFACE_H_
+
diff --git a/src/modules/torrent/tc_ktorrentdcopinterface.cpp b/src/modules/torrent/tc_ktorrentdcopinterface.cpp
new file mode 100644
index 000000000..a76e3baa6
--- /dev/null
+++ b/src/modules/torrent/tc_ktorrentdcopinterface.cpp
@@ -0,0 +1,508 @@
+//=============================================================================
+//
+// Common interface for BitTorrent clients.
+//
+// File : torr_ktorrentdcopinterface.cpp
+// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net)
+// Copyright (C) 2007 Alexander Stillich (torque at pltn dot 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+#include "kvi_app.h"
+#include "dcopclient.h"
+
+#include "tc_ktorrentdcopinterface.h"
+
+#ifdef COMPILE_KDE_SUPPORT
+
+#include "kvi_locale.h"
+#include <qtimer.h>
+
+TORR_IMPLEMENT_DESCRIPTOR(
+ KviKTorrentDCOPInterface,
+ "ktorrentdcop",
+ __tr2qs_ctx(
+ "An interface to KDE's excellent KTorrent client.\n" \
+ "Download it from http://www.ktorrent.org\n",
+ "torrent"
+ )
+)
+
+#define ERROR_MSG \
+ QCString msg; \
+ if (!findRunningApp(m_szAppId)) \
+ msg = "KTorrent's isn't running!"; \
+ else \
+ msg = "Something's wrong here! KTorrent's DCOP interface has probably changed."; \
+ m_lastError = __tr2qs_ctx(QString(msg), "torrent"); \
+ debug("%s (%s:%d): %s", __PRETTY_FUNCTION__, __FILE__, __LINE__, (const char*)msg); \
+
+#define ERROR_MSG_RANGE \
+ KviQString::sprintf(m_lastError, __tr2qs_ctx("Index out of range: %d [0-%d]!", "torrent"), i, (m_ti.size()>0)?(m_ti.size()-1):0); \
+ debug("%s (%s:%d): Index out of range: %d [0-%d]!", __PRETTY_FUNCTION__ , __FILE__, __LINE__, i, (m_ti.size()>0)?(m_ti.size()-1):0);
+
+#define ERROR_RET_BOOL \
+ { \
+ ERROR_MSG \
+ return false; \
+ }
+
+#define ERROR_RET_NUM \
+ { \
+ ERROR_MSG \
+ return -1; \
+ }
+
+// TODO: unused?
+#define ERROR_RET_STRING \
+ { \
+ ERROR_MSG \
+ return ""; \
+ }
+
+#define ERROR_RET_VOID \
+ { \
+ ERROR_MSG \
+ return; \
+ }
+
+#define CHECK_RANGE_BOOL \
+ if (i<0 || i>=m_ti.size()) \
+ { \
+ ERROR_MSG_RANGE \
+ return false; \
+ }
+
+#define CHECK_RANGE_STRING \
+ if (i<0 || i>=m_ti.size()) \
+ { \
+ ERROR_MSG_RANGE \
+ return ""; \
+ }
+
+
+KviKTorrentDCOPInterface::KviKTorrentDCOPInterface()
+ : KviDCOPHelper(false, "ktorrent")
+{
+ printf("KviKTorrentDCOPInterface\n");
+
+ QTimer *timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(slotTimer()));
+ timer->start(250, FALSE);
+}
+
+KviKTorrentDCOPInterface::~KviKTorrentDCOPInterface()
+{
+ printf("~KviKTorrentDCOPInterface\n");
+}
+
+void KviKTorrentDCOPInterface::slotTimer()
+{
+ if (!findRunningApp(m_szAppId))
+ return;
+// debug("timer");
+
+ m_ti.clear();
+
+ KviValueList<int> ret;
+ if (!qvalueListIntRetIntDCOPCall("KTorrent", "getTorrentNumbers(int)", ret, 0))
+ ERROR_RET_VOID
+
+ for (int i=0; i<ret.size(); i++)
+ {
+ KviQCStringList info;
+ if (!qcstringListRetIntDCOPCall("KTorrent", "getTorrentInfo(int)", info, ret[i]))
+ ERROR_RET_VOID
+
+ if (info.size() == 0)
+ continue;
+
+// debug("i: %d, %d, %s %s", i, info.size(), (const char *)info[0], (const char*)info[1]);
+
+ TorrentInfo item;
+ if (!makeTorrentInfo(item, info))
+ return;
+// item.ti.name.sprintf("%s [%d]", (const char*)info[0], ret[i]);
+ item.num = ret[i];
+ m_ti.append(item);
+ }
+
+ qHeapSort(m_ti);
+
+
+/* for (int i=0; i<m_ti.size(); i++)
+ {
+ debug("sorted: %s", (const char *)m_ti[i].name);
+ }
+*/
+}
+
+int KviKTorrentDCOPInterface::detect()
+{
+ if (!findRunningApp(m_szAppId))
+ return 0;
+/*
+ ClientInfo ci;
+ if (getClientInfo(ci))
+ {
+ debug("tup: %f, tdown: %f\n"
+ "sup: %f, sdown: %f\n",
+ ci.transferredUp, ci.transferredDown,
+ ci.speedUp, ci.speedDown);
+ } else
+ {
+ debug("error\n");
+ }
+
+ TorrentInfo ti;
+ if (getTorrentInfo(0, ti))
+ {
+ debug("name: %s\n"
+ "state: %d\n"
+ "size: %f\n"
+ "tup: %f\n"
+ "tdown: %f\n"
+ "sup: %f\n"
+ "sdown: %f\n"
+ "perc: %f\n"
+ "peers: %d\n",
+ (const char *)ti.name,
+ ti.state,
+ ti.size,
+ ti.transferredUp,
+ ti.transferredDown,
+ ti.speedUp,
+ ti.speedDown,
+ ti.percent,
+ ti.peers);
+ } else
+ {
+ debug("error\n");
+ }
+*/
+
+ return 100;
+}
+
+bool makeSize(float &sz, const QString &s, const QString &u)
+{
+ bool ok;
+ sz = s.toFloat(&ok);
+ if (!ok)
+ return false;
+
+ if (u == "B")
+ ;
+ else
+ if (u == "KB")
+ sz = sz * 1024.0;
+ else
+ if (u == "MB")
+ sz = sz * 1024.0 * 1024.0;
+ else
+ if (u == "GB")
+ sz = sz * 1024.0 * 1024.0 * 1024.0;
+ else
+ return false;
+
+ return true;
+}
+
+/*bool KviKTorrentDCOPInterface::getClientInfo(ClientInfo &ci)
+{
+ KviQCStringList ret;
+ if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret))
+ ERROR_RET_BOOL
+
+ bool ok;
+ QStringList tmp;
+
+ tmp = QStringList::split(" ", ret[1]);
+ if (tmp.size() != 8)
+ ERROR_RET_BOOL
+
+ if (!makeSize(ci.trafficDown, tmp[2], tmp[3]))
+ ERROR_RET_BOOL
+ if (!makeSize(ci.trafficUp, tmp[6], tmp[7]))
+ ERROR_RET_BOOL
+
+ tmp = QStringList::split(" ", ret[2]);
+ if (tmp.size() != 8)
+ ERROR_RET_BOOL
+
+ ci.speedDown = tmp[2].toFloat(&ok);
+ if (!ok)
+ ERROR_RET_BOOL
+ ci.speedUp = tmp[6].toFloat(&ok);
+ if (!ok)
+ ERROR_RET_BOOL
+
+ return true;
+}
+
+/*
+bool KviKTorrentDCOPInterface::getTorrentInfo(int i, TorrentInfo &ti)
+{
+ CHECK_RANGE
+
+ ti = m_ti[i];
+ return true;
+}
+*/
+
+bool KviKTorrentDCOPInterface::start(int i)
+{
+ CHECK_RANGE_BOOL
+
+ debug("starting %s [%d]", (const char*)m_ti[i].name, m_ti[i].num);
+ if (!voidRetIntDCOPCall("KTorrent", "start(int)", m_ti[i].num))
+ ERROR_RET_BOOL
+
+ return true;
+}
+
+bool KviKTorrentDCOPInterface::stop(int i)
+{
+ CHECK_RANGE_BOOL
+
+ debug("stopping %s [%d]", (const char*)m_ti[i].name, m_ti[i].num);
+ if (!voidRetIntBoolDCOPCall("KTorrent", "stop(int, bool)", m_ti[i].num, true))
+ ERROR_RET_BOOL
+
+ return true;
+}
+
+bool KviKTorrentDCOPInterface::announce(int i)
+{
+ CHECK_RANGE_BOOL
+
+ debug("announcing %s [%d]", (const char*)m_ti[i].name, m_ti[i].num);
+ if (!voidRetIntDCOPCall("KTorrent", "announce(int)", m_ti[i].num))
+ ERROR_RET_BOOL
+ return true;
+}
+
+QString KviKTorrentDCOPInterface::state(int i)
+{
+ CHECK_RANGE_STRING
+
+ return m_ti[i].state;
+}
+
+QString KviKTorrentDCOPInterface::name(int i)
+{
+ CHECK_RANGE_STRING
+
+ return m_ti[i].name;
+}
+
+bool KviKTorrentDCOPInterface::startAll()
+{
+ if (!voidRetIntDCOPCall("KTorrent", "startAll(int)", 3))
+ ERROR_RET_BOOL
+
+ return true;
+}
+
+bool KviKTorrentDCOPInterface::stopAll()
+{
+ if (!voidRetIntDCOPCall("KTorrent", "stopAll(int)", 3))
+ ERROR_RET_BOOL
+
+ return true;
+}
+
+int KviKTorrentDCOPInterface::count()
+{
+ return m_ti.size();
+}
+
+float KviKTorrentDCOPInterface::speedUp()
+{
+ KviQCStringList ret;
+ if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret))
+ ERROR_RET_NUM
+
+ QStringList tmp = QStringList::split(" ", ret[2]);
+ if (tmp.size() != 8)
+ ERROR_RET_NUM
+
+ bool ok;
+ float f = tmp[6].toFloat(&ok);
+ if (!ok)
+ ERROR_RET_NUM
+
+ return f;
+}
+
+float KviKTorrentDCOPInterface::speedDown()
+{
+ KviQCStringList ret;
+ if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret))
+ ERROR_RET_NUM
+
+ QStringList tmp = QStringList::split(" ", ret[2]);
+ if (tmp.size() != 8)
+ ERROR_RET_NUM
+
+ bool ok;
+ float f = tmp[2].toFloat(&ok);
+ if (!ok)
+ ERROR_RET_NUM
+
+ return f;
+}
+
+float KviKTorrentDCOPInterface::trafficUp()
+{
+ KviQCStringList ret;
+ if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret))
+ ERROR_RET_NUM
+
+ QStringList tmp = QStringList::split(" ", ret[1]);
+ if (tmp.size() != 8)
+ ERROR_RET_NUM
+
+ float f;
+ if (!makeSize(f, tmp[6], tmp[7]))
+ ERROR_RET_NUM
+
+ return f;
+}
+
+float KviKTorrentDCOPInterface::trafficDown()
+{
+ KviQCStringList ret;
+ if (!qcstringListRetVoidDCOPCall("KTorrent", "getInfo()", ret))
+ ERROR_RET_NUM
+
+ QStringList tmp = QStringList::split(" ", ret[1]);
+ if (tmp.size() != 8)
+ ERROR_RET_NUM
+
+ float f;
+ if (!makeSize(f, tmp[2], tmp[3]))
+ ERROR_RET_NUM
+
+ return f;
+}
+
+bool KviKTorrentDCOPInterface::makeTorrentInfo(TorrentInfo &ti, const KviQCStringList &ret)
+{
+ if (ret.size() != 10)
+ ERROR_RET_BOOL
+
+ ti.name = ret[0];
+ if (ret[1] == "Seeding")
+ ti.state = "Seeding";
+ else
+ if (ret[1] == "Stalled")
+ ti.state = "Stalled";
+ else
+ if (ret[1] == "Downloading")
+ ti.state = "Downloading";
+ else
+ ti.state = "Stopped";
+
+
+ QStringList tmp;
+ tmp = QStringList::split(" ", ret[2]);
+ if (tmp.size()!=2 || !makeSize(ti.trafficDown, tmp[0], tmp[1]))
+ ERROR_RET_BOOL
+
+ tmp = QStringList::split(" ", ret[3]);
+ if (tmp.size()!=2 || !makeSize(ti.size, tmp[0], tmp[1]))
+ ERROR_RET_BOOL
+
+ tmp = QStringList::split(" ", ret[4]);
+ if (tmp.size()!=2 || !makeSize(ti.trafficUp, tmp[0], tmp[1]))
+ ERROR_RET_BOOL
+
+
+ bool ok;
+ tmp = QStringList::split(" ", ret[5]);
+ if (tmp.size()!=2)
+ ERROR_RET_BOOL
+ ti.speedDown = tmp[0].toFloat(&ok);
+ if (!ok)
+ ERROR_RET_BOOL
+
+ tmp = QStringList::split(" ", ret[6]);
+ if (tmp.size()!=2)
+ ERROR_RET_BOOL
+ ti.speedUp = tmp[0].toFloat(&ok);
+ if (!ok)
+ ERROR_RET_BOOL
+
+
+ // torrent name, status, downloaded, size, uploaded, down spd, up spd, none, peers, % complete
+ ti.peers = ret[8].toInt(&ok);
+ if (!ok)
+ ERROR_RET_BOOL
+
+ tmp = QStringList::split(" ", ret[9]);
+ if (tmp.size()!=2)
+ ERROR_RET_BOOL
+ ti.percent = tmp[0].toFloat(&ok);
+ if (!ok)
+ ERROR_RET_BOOL
+
+ return true;
+}
+
+int KviKTorrentDCOPInterface::maxUploadSpeed()
+{
+ int ret;
+ if (!intRetVoidDCOPCall("KTorrent", "maxUploadRate()", ret))
+ {
+ ERROR_MSG
+ return -1;
+ }
+ return ret;
+}
+
+int KviKTorrentDCOPInterface::maxDownloadSpeed()
+{
+ int ret;
+ if (!intRetVoidDCOPCall("KTorrent", "maxDownloadRate()", ret))
+ {
+ ERROR_MSG
+ return -1;
+ }
+ return ret;
+}
+
+bool KviKTorrentDCOPInterface::setMaxUploadSpeed(int kbytes_per_sec)
+{
+ if (!voidRetIntDCOPCall("KTorrent", "setMaxUploadSpeed(int)", kbytes_per_sec))
+ ERROR_RET_BOOL
+ return true;
+}
+
+bool KviKTorrentDCOPInterface::setMaxDownloadSpeed(int kbytes_per_sec)
+{
+ if (!voidRetIntDCOPCall("KTorrent", "setMaxDownloadSpeed(int)", kbytes_per_sec))
+ ERROR_RET_BOOL
+ return true;
+}
+
+#endif // COMPILE_KDE_SUPPORT
+
+#include "tc_ktorrentdcopinterface.moc"
diff --git a/src/modules/torrent/tc_ktorrentdcopinterface.h b/src/modules/torrent/tc_ktorrentdcopinterface.h
new file mode 100644
index 000000000..d752fcfea
--- /dev/null
+++ b/src/modules/torrent/tc_ktorrentdcopinterface.h
@@ -0,0 +1,126 @@
+#ifndef _TC_KTORRENTDCOPINTERFACE_H_
+#define _TC_KTORRENTDCOPINTERFACE_H_
+
+//=============================================================================
+//
+// DCOP interface for KTorrent client.
+//
+// File : torr_ktorrentdcopinterface.h
+// Creation date : Fri Jan 1 15:42:25 2007 GMT by Alexander Stillich
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 2001-2005 Szymon Stefanek (pragma at kvirc dot net)
+// Copyright (C) 2007 Alexander Stillich (torque at pltn dot 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 opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+//=============================================================================
+
+
+#include "tc_interface.h"
+
+#ifdef COMPILE_KDE_SUPPORT
+
+#include <kvi_dcophelper.h>
+
+// DCOP interface to KTorrent. this has 'DCOP' in its name
+// because in kde4 there will be a D-BUS interface.
+class KviKTorrentDCOPInterface : public KviTorrentInterface,
+ private KviDCOPHelper
+{
+ Q_OBJECT
+
+public:
+
+ KviKTorrentDCOPInterface();
+ virtual ~KviKTorrentDCOPInterface();
+
+ virtual int detect();
+
+ virtual int count();
+
+ virtual bool start(int i);
+ virtual bool stop(int i);
+ virtual bool announce(int i);
+ virtual QString state(int i);
+ virtual QString name(int i);
+
+ virtual bool startAll();
+ virtual bool stopAll();
+
+ virtual int maxUploadSpeed();
+ virtual int maxDownloadSpeed();
+
+ virtual bool setMaxUploadSpeed(int kbytes_per_sec);
+ virtual bool setMaxDownloadSpeed(int kbytes_per_sec);
+
+ virtual float speedUp();
+ virtual float speedDown();
+
+ virtual float trafficUp();
+ virtual float trafficDown();
+
+private slots:
+
+ // polls client and extracts information.
+ // this is done because the order of torrents returned changes
+ // each time a torrent's state changes.
+ // we want to present a consistent list (in terms of indices) to
+ // the user, so we extract the info and sort it by name.
+ // otherwise the user would have a hard time figuring out what's
+ // going on. we could sort each time a function working with
+ // torrents is called, but this would be horribly slow ...
+ void slotTimer();
+
+private:
+
+ struct TorrentInfo
+ {
+ // internal number
+ int num;
+ // name displayed in ktorrent
+ QString name;
+ // state of torrent
+ QString state;
+ // bytes
+ float size;
+ // bytes
+ float trafficUp;
+ // bytes
+ float trafficDown;
+ // KB/s
+ float speedUp;
+ // KB/s
+ float speedDown;
+ // percent complete
+ float percent;
+ // number of peers
+ int peers;
+
+ bool operator<(const TorrentInfo &ti) { return name < ti.name; }
+ };
+
+ QValueList<TorrentInfo> m_ti;
+
+private:
+
+ bool makeTorrentInfo(TorrentInfo &ti, const KviQCStringList &ret);
+};
+
+TORR_DECLARE_DESCRIPTOR(KviKTorrentDCOPInterface)
+
+#endif // COMPILE_KDE_SUPPORT
+
+#endif // _TC_KTORRENTDCOPINTERFACE_H_
diff --git a/src/modules/url/libkviurl.cpp b/src/modules/url/libkviurl.cpp
index 32ca7759d..9cff780f8 100644
--- a/src/modules/url/libkviurl.cpp
+++ b/src/modules/url/libkviurl.cpp
@@ -110,7 +110,7 @@ UrlDialog::UrlDialog(KviPtrList<KviUrl> *g_pList)
:KviWindow(KVI_WINDOW_TYPE_TOOL,g_pFrame,"URL List")
{
m_pMenuBar = new KviTalMenuBar(this,"url menu");
- m_pUrlList = new QListView(this,"list");
+ m_pUrlList = new KviTalListView(this);
//m_pUrlList = new KviListView(this,"list");
KviConfig cfg(szConfigPath.ptr(),KviConfig::Read);
@@ -140,8 +140,8 @@ UrlDialog::UrlDialog(KviPtrList<KviUrl> *g_pList)
m_pUrlList->setColumnWidth(2,cfg.readIntEntry("Count",70));
m_pUrlList->setColumnWidth(3,cfg.readIntEntry("Timestamp",70));
- connect(m_pUrlList,SIGNAL(doubleClicked(QListViewItem *)),SLOT(dblclk_url(QListViewItem *)));
- connect(m_pUrlList,SIGNAL(rightButtonPressed(QListViewItem *, const QPoint &, int)),SLOT(popup(QListViewItem *, const QPoint &, int)));
+ connect(m_pUrlList,SIGNAL(doubleClicked(KviTalListViewItem *)),SLOT(dblclk_url(KviTalListViewItem *)));
+ connect(m_pUrlList,SIGNAL(rightButtonPressed(KviTalListViewItem *, const QPoint &, int)),SLOT(popup(KviTalListViewItem *, const QPoint &, int)));
// setFocusHandlerNoChildren(m_pUrlList);
m_pUrlList->setFocusPolicy(QWidget::StrongFocus);
@@ -245,14 +245,14 @@ void UrlDialog::findtext()
*/
}
-void UrlDialog::dblclk_url(QListViewItem *item)
+void UrlDialog::dblclk_url(KviTalListViewItem *item)
{
QString cmd="openurl ";
cmd.append(item->text(0));
KviKvsScript::run(cmd,this);
}
-void UrlDialog::popup(QListViewItem *item, const QPoint &point, int col)
+void UrlDialog::popup(KviTalListViewItem *item, const QPoint &point, int col)
{
if (col == 0) {
m_szUrl = item->text(0);
@@ -295,7 +295,7 @@ QPixmap *UrlDialog::myIconPtr()
void UrlDialog::addUrl(QString url, QString window, QString count, QString timestamp)
{
- QListViewItem *UrlItem = new QListViewItem(m_pUrlList);
+ KviTalListViewItem *UrlItem = new KviTalListViewItem(m_pUrlList);
UrlItem->setText(0, url);
UrlItem->setText(1, window);
@@ -417,7 +417,7 @@ BanFrame::BanFrame(QWidget *parent, const char *name, bool banEnabled)
m_pEnable->setChecked(banEnabled);
g->addMultiCellWidget(m_pEnable,0,0,0,1);
- m_pBanList = new QListBox(this,"listbox");
+ m_pBanList = new KviTalListBox(this);
m_pBanList->setMinimumHeight(100);
loadBanList();
for(KviStr *tmp=g_pBanList->first();tmp;tmp=g_pBanList->next()) m_pBanList->insertItem(tmp->ptr()); // load ban list into listbox
@@ -705,7 +705,7 @@ int check_url(KviWindow *w,const QString &szUrl) // return 0 if no occurence of
for (UrlDlgList *tmpitem=g_pUrlDlgList->first();tmpitem;tmpitem=g_pUrlDlgList->next()) {
if (tmpitem->dlg) {
- QListViewItemIterator lvi(tmpitem->dlg->m_pUrlList);
+ KviTalListViewItemIterator lvi(tmpitem->dlg->m_pUrlList);
for(;lvi.current();++lvi)
{
if (lvi.current()->text(0) == szUrl) {
diff --git a/src/modules/url/libkviurl.h b/src/modules/url/libkviurl.h
index 56d635084..80e39697c 100644
--- a/src/modules/url/libkviurl.h
+++ b/src/modules/url/libkviurl.h
@@ -23,13 +23,13 @@
#include <qdialog.h>
#include <qlayout.h>
-#include <qlistview.h>
+#include "kvi_tal_listview.h"
#include <qstring.h>
#include <qpushbutton.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qcheckbox.h>
-#include <qlistbox.h>
+#include "kvi_tal_listbox.h"
#include <qmenubar.h>
#include <qinputdialog.h>
#include <qtoolbutton.h>
@@ -69,7 +69,7 @@ protected:
QPixmap *myIconPtr();
void resizeEvent(QResizeEvent *);
public:
- QListView *m_pUrlList;
+ KviTalListView *m_pUrlList;
void addUrl(QString url, QString window, QString count, QString timestamp);
// void saveProperties();
protected slots:
@@ -81,8 +81,8 @@ protected slots:
void close_slot();
void remove();
void findtext();
- void dblclk_url(QListViewItem *item);
- void popup(QListViewItem *item, const QPoint &p, int col);
+ void dblclk_url(KviTalListViewItem *item);
+ void popup(KviTalListViewItem *item, const QPoint &p, int col);
void sayToWin(int);
};
@@ -95,7 +95,7 @@ public:
void saveBans();
private:
KviStyledCheckBox *m_pEnable;
- QListBox *m_pBanList;
+ KviTalListBox *m_pBanList;
QPushButton *m_pAddBtn;
QPushButton *m_pRemoveBtn;
protected slots: