diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2019-06-04 12:34:32 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2019-06-04 12:34:32 +0200 |
commit | 1cf8018d1c583e13baf269078de99690c4457933 (patch) | |
tree | 3aea7f16bbd876b9af7bf33197d1a8d6b43d818b /tqt3integration/libtqttde | |
parent | 9d6d2fd57f260a4dd6c84bf6e8fab3b25422a479 (diff) | |
download | tdebase-1cf8018d1c583e13baf269078de99690c4457933.tar.gz tdebase-1cf8018d1c583e13baf269078de99690c4457933.zip |
Rename tqt-kde integration to tqt-tde.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'tqt3integration/libtqttde')
-rw-r--r-- | tqt3integration/libtqttde/CMakeLists.txt | 34 | ||||
-rw-r--r-- | tqt3integration/libtqttde/Makefile.am | 15 | ||||
-rw-r--r-- | tqt3integration/libtqttde/tqttde.cpp | 147 | ||||
-rw-r--r-- | tqt3integration/libtqttde/tqttde.h | 35 |
4 files changed, 231 insertions, 0 deletions
diff --git a/tqt3integration/libtqttde/CMakeLists.txt b/tqt3integration/libtqttde/CMakeLists.txt new file mode 100644 index 000000000..fc1e54e81 --- /dev/null +++ b/tqt3integration/libtqttde/CMakeLists.txt @@ -0,0 +1,34 @@ +################################################# +# +# (C) 2011 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/tqt3integration/utils/ + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### libtqttde (shared) #################### + +tde_add_library( tqttde SHARED AUTOMOC + SOURCES tqttde.cpp + VERSION 0.0.0 + LINK tdeui-shared + DEPENDENCIES generate_tqt3_bindings + DESTINATION "${TQT_PLUGINS_DIR}/integration/" +) diff --git a/tqt3integration/libtqttde/Makefile.am b/tqt3integration/libtqttde/Makefile.am new file mode 100644 index 000000000..aa143fec5 --- /dev/null +++ b/tqt3integration/libtqttde/Makefile.am @@ -0,0 +1,15 @@ +tqttdelib_LTLIBRARIES = libtqttde.la + +libtqttde_la_SOURCES = tqttde.cpp +libtqttde_la_LIBADD = -lDCOP +libtqttde_la_LDFLAGS = $(all_libraries) -module -no-undefined -avoid-version + +CLEANFILES = tqttde_functions.cpp + +INCLUDES = $(all_includes) +METASOURCES = AUTO + +tqttde.lo : tqttde_functions.cpp + +tqttde_functions.cpp : ../utils/tqttde_functions.cpp + cp -f ../utils/tqttde_functions.cpp . || exit 1 diff --git a/tqt3integration/libtqttde/tqttde.cpp b/tqt3integration/libtqttde/tqttde.cpp new file mode 100644 index 000000000..3647db8a2 --- /dev/null +++ b/tqt3integration/libtqttde/tqttde.cpp @@ -0,0 +1,147 @@ + /* + * This file is part of the Trinity Desktop Environment + * + * Original file taken from the OpenSUSE tdebase builds + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "tqttde.h" + +#include <assert.h> +#include <dcopclient.h> +#include <dcoptypes.h> +#include <tqapplication.h> +#include <tqregexp.h> +#include <tqstringlist.h> +#include <tqwidget.h> +#include <unistd.h> + +#include <X11/Xlib.h> + +extern Time tqt_x_time; + +static TQString convertFileFilter( const TQString& filter ) + { + if( filter.isEmpty()) + return filter; + TQString f2 = filter; + f2.replace( '\n', ";;" ); // TQt says separator is ";;", but it also silently accepts newline + f2.replace( '/', "\\/" ); // escape /'s for KFileDialog + TQStringList items = TQStringList::split( ";;", f2 ); + TQRegExp reg( "\\((.*)\\)" ); + for( TQStringList::Iterator it = items.begin(); + it != items.end(); + ++it ) + { + if( reg.search( *it )) + *it = reg.cap( 1 ) + '|' + *it; + } + return items.join( "\n" ); + } + +static TQString convertBackFileFilter( const TQString& filter ) + { + if( filter.isEmpty()) + return filter; + TQStringList items = TQStringList::split( "\n", filter ); + for( TQStringList::Iterator it = items.begin(); + it != items.end(); + ++it ) + { + int pos = (*it).find( '|' ); + if( pos >= 0 ) + (*it) = (*it).mid( pos + 1 ); + } + return items.join( ";;" ); + } + +static DCOPClient* dcopClient() + { + DCOPClient* dcop = DCOPClient::mainClient(); + if( dcop == NULL ) + { + static DCOPClient* dcop_private; + if( dcop_private == NULL ) + { + dcop_private = new DCOPClient; + dcop_private->attach(); + } + dcop = dcop_private; + } + static bool prepared = false; + if( !prepared ) + { + assert( tqApp != NULL ); // TODO + prepared = true; + dcop->bindToApp(); + if( !tqApp->inherits( "TDEApplication" )) // KApp takes care of input blocking + { + static tqttde_EventLoop* loop = new tqttde_EventLoop; + TQObject::connect( dcop, TQT_SIGNAL( blockUserInput( bool )), loop, TQT_SLOT( block( bool ))); + } + } + return dcop; + } + +// defined in qapplication_x11.cpp +typedef int (*QX11EventFilter) (XEvent*); +extern QX11EventFilter tqt_set_x11_event_filter (QX11EventFilter filter); + +static QX11EventFilter old_filter; + +static int input_filter( XEvent* e ) + { + switch( e->type ) + { + case ButtonPress: + case ButtonRelease: + case KeyPress: + case KeyRelease: + case MotionNotify: + case EnterNotify: + case LeaveNotify: + return true; + default: + break; + } + if( old_filter != NULL ) + return old_filter( e ); + return false; + } + +void tqttde_EventLoop::block( bool b ) + { + if( b ) + old_filter = tqt_set_x11_event_filter( input_filter ); + else + tqt_set_x11_event_filter( old_filter ); + } + +// duped in kded module +static TQString getHostname() + { + char hostname[ 256 ]; + if( gethostname( hostname, 255 ) == 0 ) + { + hostname[ 255 ] = '\0'; + return hostname; + } + return ""; + } + +#include "tqttde_functions.cpp" + +#include "tqttde.moc" diff --git a/tqt3integration/libtqttde/tqttde.h b/tqt3integration/libtqttde/tqttde.h new file mode 100644 index 000000000..2d634df07 --- /dev/null +++ b/tqt3integration/libtqttde/tqttde.h @@ -0,0 +1,35 @@ + /* + * This file is part of the Trinity Desktop Environment + * + * Original file taken from the OpenSUSE tdebase builds + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _TQTTDE_H +#define _TQTTDE_H + +#include <tqobject.h> + +class tqttde_EventLoop + : public TQObject + { + Q_OBJECT + + public slots: + void block( bool ); + }; + +#endif |