From c0b24fe164924298d7e6ae33964b3c65fadbcba3 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:06:29 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- buildtools/ada/adaglobaloptionsdlg.cpp | 2 +- buildtools/ada/adaproject_part.cpp | 2 +- buildtools/autotools/CMakeLists.txt | 2 +- buildtools/autotools/Makefile.am | 2 +- buildtools/autotools/addexistingdirectoriesdlg.cpp | 2 +- buildtools/autotools/addexistingdirectoriesdlg.h | 2 +- buildtools/autotools/addexistingfilesdlg.cpp | 2 +- buildtools/autotools/addexistingfilesdlg.h | 2 +- buildtools/autotools/addprefixdlg.cpp | 2 +- buildtools/autotools/addsubprojectdlg.cpp | 2 +- buildtools/autotools/autoprojectpart.cpp | 2 +- buildtools/autotools/autoprojectwidget.cpp | 4 +- buildtools/autotools/configureoptionswidget.cpp | 2 +- buildtools/autotools/fileselectorwidget.cpp | 12 +- buildtools/autotools/fileselectorwidget.h | 6 +- buildtools/autotools/kfilednddetailview.cpp | 212 --------------------- buildtools/autotools/kfilednddetailview.h | 137 ------------- buildtools/autotools/kfiledndiconview.cpp | 194 ------------------- buildtools/autotools/kfiledndiconview.h | 129 ------------- buildtools/autotools/kimporticonview.h | 2 +- buildtools/autotools/subprojectoptionsdlg.cpp | 2 +- buildtools/autotools/targetoptionsdlg.cpp | 2 +- buildtools/autotools/tdefilednddetailview.cpp | 212 +++++++++++++++++++++ buildtools/autotools/tdefilednddetailview.h | 137 +++++++++++++ buildtools/autotools/tdefiledndiconview.cpp | 194 +++++++++++++++++++ buildtools/autotools/tdefiledndiconview.h | 129 +++++++++++++ .../custommakefiles/custombuildoptionswidget.cpp | 2 +- buildtools/custommakefiles/custommanagerwidget.cpp | 2 +- buildtools/custommakefiles/customprojectpart.cpp | 2 +- .../lib/parsers/autotools/autotoolsdriver.cpp | 2 +- buildtools/lib/parsers/qmake/CMakeLists.txt | 2 +- buildtools/lib/parsers/qmake/qmakedriver.cpp | 2 +- buildtools/lib/widgets/addfilesdialog.h | 2 +- buildtools/lib/widgets/runoptionswidget.cpp | 2 +- buildtools/pascal/pascalglobaloptionsdlg.cpp | 2 +- buildtools/pascal/pascalproject_part.cpp | 2 +- buildtools/qmake/createscopedlg.cpp | 4 +- buildtools/qmake/newwidgetdlg.cpp | 2 +- buildtools/qmake/projectconfigurationdlg.cpp | 2 +- buildtools/qmake/trollprojectpart.cpp | 4 +- buildtools/qmake/trollprojectwidget.cpp | 4 +- 41 files changed, 716 insertions(+), 716 deletions(-) delete mode 100644 buildtools/autotools/kfilednddetailview.cpp delete mode 100644 buildtools/autotools/kfilednddetailview.h delete mode 100644 buildtools/autotools/kfiledndiconview.cpp delete mode 100644 buildtools/autotools/kfiledndiconview.h create mode 100644 buildtools/autotools/tdefilednddetailview.cpp create mode 100644 buildtools/autotools/tdefilednddetailview.h create mode 100644 buildtools/autotools/tdefiledndiconview.cpp create mode 100644 buildtools/autotools/tdefiledndiconview.h (limited to 'buildtools') diff --git a/buildtools/ada/adaglobaloptionsdlg.cpp b/buildtools/ada/adaglobaloptionsdlg.cpp index 33e432cf..a39c9c3f 100644 --- a/buildtools/ada/adaglobaloptionsdlg.cpp +++ b/buildtools/ada/adaglobaloptionsdlg.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include "kdevcompileroptions.h" diff --git a/buildtools/ada/adaproject_part.cpp b/buildtools/ada/adaproject_part.cpp index 96b01a51..e402d9a1 100644 --- a/buildtools/ada/adaproject_part.cpp +++ b/buildtools/ada/adaproject_part.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "domutil.h" #include "kdevcore.h" diff --git a/buildtools/autotools/CMakeLists.txt b/buildtools/autotools/CMakeLists.txt index d4e68654..f7af5bc6 100644 --- a/buildtools/autotools/CMakeLists.txt +++ b/buildtools/autotools/CMakeLists.txt @@ -50,7 +50,7 @@ tde_add_kpart( libkdevautoproject AUTOMOC addfiledlgbase.ui addfiledlg.cpp removefiledlgbase.ui removefiledlg.cpp addicondlgbase.ui addicondlg.cpp addtranslationdlg.cpp addprefixdlg.cpp - kfilednddetailview.cpp kfiledndiconview.cpp + tdefilednddetailview.cpp tdefiledndiconview.cpp fileselectorwidget.cpp misc.cpp addsubprojectdlgbase.ui removetargetdlg.cpp removetargetdlgbase.ui choosetargetdialog.cpp choosetargetdlgbase.ui diff --git a/buildtools/autotools/Makefile.am b/buildtools/autotools/Makefile.am index 8a21dc09..76bbffec 100644 --- a/buildtools/autotools/Makefile.am +++ b/buildtools/autotools/Makefile.am @@ -20,7 +20,7 @@ libkdevautoproject_la_SOURCES = autoprojectpart.cpp autoprojectwidget.cpp \ addservicedlgbase.ui addapplicationdlg.cpp addapplicationdlgbase.ui addtargetdlg.cpp \ addtargetdlgbase.ui addsubprojectdlg.cpp addfiledlgbase.ui addfiledlg.cpp \ removefiledlgbase.ui removefiledlg.cpp addicondlgbase.ui addicondlg.cpp \ - addtranslationdlg.cpp addprefixdlg.cpp kfilednddetailview.cpp kfiledndiconview.cpp \ + addtranslationdlg.cpp addprefixdlg.cpp tdefilednddetailview.cpp tdefiledndiconview.cpp \ fileselectorwidget.cpp misc.cpp addsubprojectdlgbase.ui removetargetdlg.cpp \ removetargetdlgbase.ui choosetargetdialog.cpp choosetargetdlgbase.ui addexistingdlgbase.ui \ addexistingfilesdlg.cpp addexistingdirectoriesdlg.cpp kimporticonview.cpp \ diff --git a/buildtools/autotools/addexistingdirectoriesdlg.cpp b/buildtools/autotools/addexistingdirectoriesdlg.cpp index 181f7c5b..d9168924 100644 --- a/buildtools/autotools/addexistingdirectoriesdlg.cpp +++ b/buildtools/autotools/addexistingdirectoriesdlg.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "autolistviewitems.h" diff --git a/buildtools/autotools/addexistingdirectoriesdlg.h b/buildtools/autotools/addexistingdirectoriesdlg.h index d09d53db..7b1d9c8e 100644 --- a/buildtools/autotools/addexistingdirectoriesdlg.h +++ b/buildtools/autotools/addexistingdirectoriesdlg.h @@ -20,7 +20,7 @@ #include "addexistingdlgbase.h" #include -#include +#include #include "misc.h" #include "fileselectorwidget.h" diff --git a/buildtools/autotools/addexistingfilesdlg.cpp b/buildtools/autotools/addexistingfilesdlg.cpp index b17eb118..0c3796d9 100644 --- a/buildtools/autotools/addexistingfilesdlg.cpp +++ b/buildtools/autotools/addexistingfilesdlg.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/buildtools/autotools/addexistingfilesdlg.h b/buildtools/autotools/addexistingfilesdlg.h index ea556226..2b44bba1 100644 --- a/buildtools/autotools/addexistingfilesdlg.h +++ b/buildtools/autotools/addexistingfilesdlg.h @@ -21,7 +21,7 @@ #define ADDEXISTINGFILESDLG_H #include -#include +#include #include "addexistingdlgbase.h" #include "fileselectorwidget.h" diff --git a/buildtools/autotools/addprefixdlg.cpp b/buildtools/autotools/addprefixdlg.cpp index 06aab18b..f37b6626 100644 --- a/buildtools/autotools/addprefixdlg.cpp +++ b/buildtools/autotools/addprefixdlg.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/buildtools/autotools/addsubprojectdlg.cpp b/buildtools/autotools/addsubprojectdlg.cpp index ea3d2b7a..373a3861 100644 --- a/buildtools/autotools/addsubprojectdlg.cpp +++ b/buildtools/autotools/addsubprojectdlg.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/buildtools/autotools/autoprojectpart.cpp b/buildtools/autotools/autoprojectpart.cpp index 0e665eb7..801d5234 100644 --- a/buildtools/autotools/autoprojectpart.cpp +++ b/buildtools/autotools/autoprojectpart.cpp @@ -32,7 +32,7 @@ #include -#include +#include #include #include #include diff --git a/buildtools/autotools/autoprojectwidget.cpp b/buildtools/autotools/autoprojectwidget.cpp index 7ffa0ef0..6ac797b9 100644 --- a/buildtools/autotools/autoprojectwidget.cpp +++ b/buildtools/autotools/autoprojectwidget.cpp @@ -33,12 +33,12 @@ #include #include -#include +#include #include #include #include #include -#include +#include #include #include diff --git a/buildtools/autotools/configureoptionswidget.cpp b/buildtools/autotools/configureoptionswidget.cpp index 5ff3e67e..e65d4a35 100644 --- a/buildtools/autotools/configureoptionswidget.cpp +++ b/buildtools/autotools/configureoptionswidget.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/buildtools/autotools/fileselectorwidget.cpp b/buildtools/autotools/fileselectorwidget.cpp index 2235f357..842358e4 100644 --- a/buildtools/autotools/fileselectorwidget.cpp +++ b/buildtools/autotools/fileselectorwidget.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -36,17 +36,17 @@ #include "fileselectorwidget.h" #include #include -#include -#include -#include +#include +#include +#include #include #include "autoprojectwidget.h" #include "autoprojectpart.h" #include "kdevlanguagesupport.h" -#include "kfilednddetailview.h" -#include "kfiledndiconview.h" +#include "tdefilednddetailview.h" +#include "tdefiledndiconview.h" KDnDDirOperator::KDnDDirOperator ( const KURL &urlName, TQWidget* parent, const char* name ) : KDirOperator ( urlName, parent, name ) { diff --git a/buildtools/autotools/fileselectorwidget.h b/buildtools/autotools/fileselectorwidget.h index 09d589de..a9b7abd7 100644 --- a/buildtools/autotools/fileselectorwidget.h +++ b/buildtools/autotools/fileselectorwidget.h @@ -22,14 +22,14 @@ #include #include #include -#include +#include #include #include #include #include -#include -#include +#include +#include #include diff --git a/buildtools/autotools/kfilednddetailview.cpp b/buildtools/autotools/kfilednddetailview.cpp deleted file mode 100644 index 405ff249..00000000 --- a/buildtools/autotools/kfilednddetailview.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/*************************************************************************** -* kfilednddetailview.cpp - description -* ------------------- -* begin : Wed Nov 1 2000 -* copyright : (C) 2000 by Bj�n Sahlstr� -* email : kbjorn@users.sourceforge.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 option) any later version. * -* * -***************************************************************************/ - -////////////////////////////////////////////////////// -// TQt specific includes -#include -#include -////////////////////////////////////////////////////// -// KDE specific includes -#include -#include -#include -////////////////////////////////////////////////////// -// Application specific includes -#include "kfilednddetailview.h" - -#ifndef AUTO_OPEN_TIME -#define AUTO_OPEN_TIME - static int autoOpenTime = 750; -#endif -//----------------------------------------------- -KFileDnDDetailView::KFileDnDDetailView(TQWidget *parent, const char *name ) - : KFileDetailView(parent,name), m_autoOpenTimer( this ), - m_autoOpenTime( autoOpenTime ), m_useAutoOpenTimer( true ), - m_dropItem(0), m_dndEnabled( true ) -{ - setAutoUpdate( true ); - setDnDEnabled( true ); - useAutoOpenTimer( true ); -} -//----------------------------------------------- -KFileDnDDetailView::~KFileDnDDetailView(){ -} -//----------------------------------------------- -void KFileDnDDetailView::readConfig( TDEConfig* config, const TQString& group ) { - TDEConfigGroupSaver cs( config, group ); - bool dnd = config->readBoolEntry("DragAndDrop", true ); - setDnDEnabled( dnd ); - KFileDetailView::readConfig( config, group ); -} -//----------------------------------------------- -void KFileDnDDetailView::writeConfig( TDEConfig* config, const TQString& group ) { - TDEConfigGroupSaver cs( config, group ); - config->writeEntry("DragAndDrop", m_dndEnabled ); - KFileDetailView::writeConfig( config, group ); -} -//----------------------------------------------- -void KFileDnDDetailView::slotOpenFolder(){ - if( m_useAutoOpenTimer ) { - m_autoOpenTimer.stop(); - if( !m_dropItem ) - return; - } - KFileItemListIterator it( * KFileView::items() ); - for( ; it.current() ;++it ){ - if( (*it)->name() == m_dropItem->text(0) ) { - if( (*it)->isFile() ) - return; - else if( (*it)->isDir() || (*it)->isLink()) { - sig->activate( (*it) ); - return; - } - } - } -} -//----------------------------------------------- -void KFileDnDDetailView::contentsDragEnterEvent( TQDragEnterEvent *e ) { - - kdDebug (9020) << "KFileDnDDetailView::contentsDragEnterEvent" << endl; - - if ( ! acceptDrag( e ) ) { - e->accept( false ); - return; - } - e->acceptAction(); - TQListViewItem *i = itemAt( contentsToViewport( e->pos() ) ); - if ( i && m_useAutoOpenTimer ) { - m_dropItem = i; - m_autoOpenTimer.start( m_autoOpenTime ); - } -} -//----------------------------------------------- -void KFileDnDDetailView::contentsDragMoveEvent( TQDragMoveEvent *e ) { - - kdDebug (9020) << "KFileDnDDetailView::contentsDragMoveEvent" << endl; - - if ( ! acceptDrag( e ) ) { - e->accept( false ); - return; - } - e->acceptAction(); - TQListViewItem *i = itemAt( contentsToViewport( e->pos() ) ); - if( ! m_useAutoOpenTimer ) - return; - if ( i ) { - if ( i != m_dropItem ) { - m_autoOpenTimer.stop(); - m_dropItem = i; - m_autoOpenTimer.start( m_autoOpenTime ); - } - } - else - m_autoOpenTimer.stop(); -} -//----------------------------------------------- -void KFileDnDDetailView::contentsDragLeaveEvent( TQDragLeaveEvent* ) { - - kdDebug (9020) << "KFileDnDDetailView::contentsDragLeaveEvent" << endl; - - if( m_useAutoOpenTimer ) { - m_autoOpenTimer.stop(); - m_dropItem = 0L; - } -} -//----------------------------------------------- -void KFileDnDDetailView::contentsDropEvent( TQDropEvent* e ) { - - kdDebug (9020) << "KFileDndDetailView::contentsDropEvent" << endl; - - if( m_useAutoOpenTimer ) { - m_autoOpenTimer.stop(); - m_dropItem = 0L; - } - if( ! acceptDrag( e ) ) { - e->acceptAction( false ); - return; - } - e->acceptAction(); - // the drop was accepted so lets emit this to the outside world - KURL::List urls; - KURLDrag::decode( e, urls ); - emit dropped( e ); - emit dropped( this, e ); - emit dropped( this, urls ); -} -//----------------------------------------------- -void KFileDnDDetailView::startDrag(){ - - kdDebug (9020) << "KFileDnDDetailView::startDrag()" << endl; - - // create a list of the URL:s that we want to drag - KURL::List urls; - KFileItemListIterator it( * KFileView::selectedItems() ); - for ( ; it.current(); ++it ){ - urls.append( (*it)->url() ); - } - TQPixmap pixmap; - if( urls.count() > 1 ){ - pixmap = DesktopIcon( "tdemultiple", 16 ); - } - if( pixmap.isNull() ) - pixmap = currentFileItem()->pixmap( 16 ); - TQPoint hotspot; - hotspot.setX( pixmap.width() / 2 ); - hotspot.setY( pixmap.height() / 2 ); - m_dragObject = KURLDrag::newDrag( urls, widget() ); - m_dragObject->setPixmap( pixmap, hotspot ); - m_dragObject->drag(); // start the drag -} -//----------------------------------------------- -TQDragObject* KFileDnDDetailView::dragObject() const { - return m_dragObject; -} -//----------------------------------------------- -bool KFileDnDDetailView::acceptDrag(TQDropEvent* e ) const { - return KURLDrag::canDecode( e ) && - ( e->action() == TQDropEvent::Copy - || e->action() == TQDropEvent::Move - || e->action() == TQDropEvent::Link ); -} -//----------------------------------------------- -void KFileDnDDetailView::setAutoOpenTime( const int& time ){ - m_autoOpenTime = time; - useAutoOpenTimer(); -} -//----------------------------------------------- -void KFileDnDDetailView::useAutoOpenTimer( bool use ){ - m_useAutoOpenTimer = use; - if( use ) - connect( &m_autoOpenTimer, TQT_SIGNAL( timeout() ),this, TQT_SLOT( slotOpenFolder() ) ); - else { - disconnect( &m_autoOpenTimer, TQT_SIGNAL( timeout() ),this, TQT_SLOT( slotOpenFolder() ) ); - m_dropItem = 0L; - m_autoOpenTimer.stop(); - } -} -//----------------------------------------------- -void KFileDnDDetailView::setDnDEnabled( bool useDnD ){ - m_dndEnabled = useDnD; - setDragEnabled( useDnD ); - setDropVisualizer( useDnD ); - setAcceptDrops( useDnD ); - viewport()->setAcceptDrops( useDnD ); -} -//----------------------------------------------- -#ifndef NO_INCLUDE_MOCFILES -#include "kfilednddetailview.moc" -#endif diff --git a/buildtools/autotools/kfilednddetailview.h b/buildtools/autotools/kfilednddetailview.h deleted file mode 100644 index a6dd87c0..00000000 --- a/buildtools/autotools/kfilednddetailview.h +++ /dev/null @@ -1,137 +0,0 @@ -/*************************************************************************** -* kfilednddetailview.h - description -* ------------------- -* begin : Wed Nov 1 2000 -* copyright : (C) 2000 by Björn Sahlström -* email : kbjorn@users.sourceforge.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 option) any later version. * -* * -**************************************************************************/ - -#ifndef KFILEDNDDETAILVIEW_H -#define KFILEDNDDETAILVIEW_H - -////////////////////////////////////////////////////////////////////// -// TQt specific include files -#include -#include -////////////////////////////////////////////////////////////////////// -// KDE specific include files -#include -#include - - -/** - *This is a fileview inherited from @ref KFileDetailView. - *It adds "drag and drop" handling to the view suitable for a @ref KFileDetailView. - * No special setup is needed, just connect to the @ref dropped signals - * and the view will take care of the rest. - *@short "Drag and drop" aware @ref KFileDetailView - *@author Björn Sahlström - */ - -class KFileDnDDetailView : public KFileDetailView -{ - Q_OBJECT - -public: - /** */ - KFileDnDDetailView( TQWidget *parent = 0, const char *name = 0 ); - /** */ - virtual ~KFileDnDDetailView(); - /** - * Set this to true if Drag'n drop should be enabled or not, default is enabled - */ - void setDnDEnabled( bool ); - /** - * @returns wether DnD is enabled or not. - */ - bool isDnDEnabled() const - { - return m_dndEnabled; - } - /** - *Sets the auto open time, which means the time that will - *elapse before a directory is automatically opened after entered by DnD. - *Only need to call this if you want to change the predefined time that is 750 ms. - *This also calls @ref #useAutoOpenTimer so no need to call this to. - */ - void setAutoOpenTime( const int& time ); - /** - *Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false. - *By default this is turned ON. - */ - void useAutoOpenTimer( bool on = true ); - /** - *@returns true if auto open functionallity is turned ON (default), otherwhise false - *@see #useAutoOpenTimer - *@see #setAutoOpenTime - */ - bool isAutoOpening() const - { - return m_useAutoOpenTimer; - } - /** */ - virtual void readConfig( TDEConfig*, const TQString& group = TQString() ); - /** */ - virtual void writeConfig( TDEConfig*, const TQString& group = TQString() ); -signals: // Signals - /** - * Emitted whenever an decodable item is dropped in the view. - * Note: The @ref TQDropEvent contains a @ref KURLDrag object. - */ - void dropped( TQDropEvent* ); - /** - * Emitted whenever an decodable item is dropped in the view - * Note: The @ref TQDropEvent contains a @ref KURLDrag object. - */ - void dropped( KFileView*, TQDropEvent* ); - /** - * Emitted whenever an decodable item is dropped in the view. - *@param urls contains a list of all dropped @ref KURL - */ - void dropped( KFileView*, KURL::List& urls ); -protected slots: // Protected slots - /** - * Called when the auto timer times out. Open the current folder. - */ - void slotOpenFolder(); -protected: //Protected Methods - /** */ - virtual void contentsDragEnterEvent( TQDragEnterEvent *e ); - /** */ - virtual void contentsDragMoveEvent( TQDragMoveEvent *e ); - /** */ - virtual void contentsDragLeaveEvent( TQDragLeaveEvent *e ); - /** */ - virtual void contentsDropEvent( TQDropEvent* e ); - /** - * Create dragobject encoding the current selection and starts the drag - */ - virtual void startDrag(); - /** - * @returns the dragObject - */ - virtual TQDragObject* dragObject() const; - /** - * @returns true if we can decode the drag and support the action - */ - virtual bool acceptDrag( TQDropEvent* event ) const; -protected: // Private attributes - TQTimer m_autoOpenTimer; - int m_autoOpenTime; - bool m_useAutoOpenTimer; - TQListViewItem* m_dropItem; - KURLDrag* m_dragObject; - bool m_dndEnabled; -}; - -#endif -// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/kfiledndiconview.cpp b/buildtools/autotools/kfiledndiconview.cpp deleted file mode 100644 index e7b727e5..00000000 --- a/buildtools/autotools/kfiledndiconview.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/*************************************************************************** -* kfiledndiconview.cpp - description -* ------------------- -* begin : Wed Nov 1 2000 -* copyright : (C) 2000 by Bj�rn Sahlstr�m -* email : kbjorn@users.sourceforge.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 option) any later version. * -* * -***************************************************************************/ - -////////////////////////////////////////////////////// -// TQt specific includes -#include -#include -////////////////////////////////////////////////////// -// KDE specific includes -#include -#include -#include -////////////////////////////////////////////////////// -// Application specific includes -#include "kfiledndiconview.h" - -#ifndef AUTO_OPEN_TIME -#define AUTO_OPEN_TIME - static int autoOpenTime = 750; -#endif -//----------------------------------------------- -KFileDnDIconView::KFileDnDIconView( TQWidget *parent, const char *name ) - : KFileIconView(parent,name), m_autoOpenTimer( this ), - m_autoOpenTime( autoOpenTime ), m_useAutoOpenTimer( true ), - m_dropItem(0), m_dndEnabled( true ) -{ - setDnDEnabled( true ); - setAutoUpdate( true ); - useAutoOpenTimer( true ); -} -//----------------------------------------------- -KFileDnDIconView::~KFileDnDIconView(){ -} -//----------------------------------------------- -void KFileDnDIconView::readConfig( TDEConfig* config, const TQString& group ) { - TDEConfigGroupSaver cs( config, group ); - bool dnd = config->readBoolEntry("EnableDND", true ); - setDnDEnabled( dnd ); - KFileIconView::readConfig( config, group ); -} -//----------------------------------------------- -void KFileDnDIconView::writeConfig( TDEConfig* config, const TQString& group ) { - TDEConfigGroupSaver cs( config, group ); - config->writeEntry("EnableDND", m_dndEnabled ); - KFileIconView::writeConfig( config, group ); -} -//----------------------------------------------- -void KFileDnDIconView::slotOpenFolder(){ - if( m_useAutoOpenTimer ) { - m_autoOpenTimer.stop(); - if( !m_dropItem ) - return; - } - KFileItemListIterator it( * KFileView::items() ); - for( ; it.current() ;++it ){ - if( (*it)->name() == m_dropItem->text() ) { - if( (*it)->isFile() ) - return; - else if( (*it)->isDir() || (*it)->isLink()) { - sig->activate( (*it) ); - return; - } - } - } -} -//----------------------------------------------- -void KFileDnDIconView::contentsDragEnterEvent( TQDragEnterEvent *e ) { - if ( ! acceptDrag( e ) ) { // can we decode this ? - e->accept( false ); // No - return; - } - e->acceptAction(); // Yes - TQIconViewItem *i = findItem( contentsToViewport( e->pos() ) ); - if ( i && m_useAutoOpenTimer) { // are we over an item ? - m_dropItem = i; // set new m_dropItem - m_autoOpenTimer.start( m_autoOpenTime ); // restart timer - } -} -//----------------------------------------------- -void KFileDnDIconView::contentsDragMoveEvent( TQDragMoveEvent *e ) { - if ( ! acceptDrag( e ) ) { // can we decode this ? - e->accept( false ); // No - return; - } - e->acceptAction(); // Yes - TQIconViewItem *i = findItem( contentsToViewport( e->pos() ) ); - if( ! m_useAutoOpenTimer ) - return; - if ( i ) { // are we over an item ? - if ( i != m_dropItem ) { // if so, is it a new one ? - m_autoOpenTimer.stop(); // stop timer - m_dropItem = i; // set new m_dropItem - m_autoOpenTimer.start( m_autoOpenTime ); // restart timer - } - } - else - m_autoOpenTimer.stop(); // stop timer -} -//----------------------------------------------- -void KFileDnDIconView::contentsDragLeaveEvent( TQDragLeaveEvent* ) { - if( m_useAutoOpenTimer ) { - m_autoOpenTimer.stop(); - m_dropItem = 0L; - } -} -//----------------------------------------------- -void KFileDnDIconView::contentsDropEvent( TQDropEvent* e ) { - if( m_useAutoOpenTimer ) { - m_autoOpenTimer.stop(); - m_dropItem = 0L; - } - if( ! acceptDrag( e ) ) { - e->acceptAction( false ); - return; - } - e->acceptAction(); - // the drop was accepted so lets emit this - KURL::List urls; - KURLDrag::decode( e, urls ); - emit dropped( e ); -} -//----------------------------------------------- -void KFileDnDIconView::startDrag(){ - if ( ! currentItem() ) // is there any selected items ? - return; // nope - dragObject()->dragCopy(); // start the drag -} -//----------------------------------------------- -TQDragObject* KFileDnDIconView::dragObject() { - // create a list of the URL:s that we want to drag - KURL::List urls; - KFileItemListIterator it( * KFileView::selectedItems() ); - for ( ; it.current(); ++it ){ - urls.append( (*it)->url() ); - } - TQPixmap pixmap; - if( urls.count() > 1 ) - pixmap = DesktopIcon( "tdemultiple", iconSize() ); - if( pixmap.isNull() ) - pixmap = currentFileItem()->pixmap( iconSize() ); - TQPoint hotspot; - hotspot.setX( pixmap.width() / 2 ); - hotspot.setY( pixmap.height() / 2 ); - TQDragObject* myDragObject = KURLDrag::newDrag( urls, widget() ); - myDragObject->setPixmap( pixmap, hotspot ); - return myDragObject; -} -//----------------------------------------------- -void KFileDnDIconView::setAutoOpenTime( const int& time ){ - m_autoOpenTime = time; - useAutoOpenTimer(); -} -//----------------------------------------------- -void KFileDnDIconView::useAutoOpenTimer( bool use ){ - m_useAutoOpenTimer = use; - if ( use ) - connect( &m_autoOpenTimer, TQT_SIGNAL( timeout() ),this, TQT_SLOT( slotOpenFolder() ) ); - else { - disconnect( &m_autoOpenTimer, TQT_SIGNAL( timeout() ),this, TQT_SLOT( slotOpenFolder() ) ); - m_dropItem = 0L; - m_autoOpenTimer.stop(); - } -} -//----------------------------------------------- -void KFileDnDIconView::setDnDEnabled( bool useDnD ){ - m_dndEnabled = useDnD; - setAcceptDrops( useDnD ); - viewport()->setAcceptDrops( useDnD ); -} -//----------------------------------------------- -bool KFileDnDIconView::acceptDrag(TQDropEvent* e ) const { - return KURLDrag::canDecode( e ) && - ( e->action() == TQDropEvent::Copy - || e->action() == TQDropEvent::Move - || e->action() == TQDropEvent::Link ); -} -//----------------------------------------------- -#ifndef NO_INCLUDE_MOCFILES -#include "kfiledndiconview.moc" -#endif diff --git a/buildtools/autotools/kfiledndiconview.h b/buildtools/autotools/kfiledndiconview.h deleted file mode 100644 index 0e45d174..00000000 --- a/buildtools/autotools/kfiledndiconview.h +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************** -* kfiledndiconview.h - description -* ------------------- -* begin : Wed Nov 1 2000 -* copyright : (C) 2000 by Björn Sahlström -* email : kbjorn@users.sourceforge.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 option) any later version. * -* * -**************************************************************************/ - -#ifndef KFILEDNDICONVIEW_H -#define KFILEDNDICONVIEW_H - -#include -#include -#include -#include - -/** - * This is a fileview inherited from @ref KFileIconView. - * It adds "drag and drop" suitable for a @ref KFileIconView - * No special setup is needed, just connect to the @ref dropped signals - * and the view will take care of the rest. - * @short Drag and drop" aware @ref KFileIconView - * @author Björn Sahlström -*/ - -class KFileDnDIconView : public KFileIconView -{ - Q_OBJECT - -public: // Public methods - - KFileDnDIconView( TQWidget *parent = 0, const char *name = 0 ); - virtual ~KFileDnDIconView(); - - /** - * Set if Drag'n drop should be enabled or not, default is enabled. - */ - void setDnDEnabled( bool ); - - /** - * @returns wether DnD is enabled or not. - */ - bool isDnDEnabled() const - { - return m_dndEnabled; - } - - /** - * Sets the auto open time, which means the time that will - * elapse before a directory is automatically opened after entered by DnD. - * Only need to call this if you want to change the predefined time that is 750 ms. - * This also calls @ref #useAutoOpenTimer so no need to call this to. - */ - void setAutoOpenTime( const int& time ); - - /** - * Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false. - * By default this is turned ON. - */ - void useAutoOpenTimer( bool on = true ); - - /** - * @returns true if auto open functionallity is turned ON (default), otherwhise false - * @see #useAutoOpenTimer - * @see #setAutoOpenTime - */ - bool isAutoOpening() const - { - return m_useAutoOpenTimer; - } - - virtual void readConfig( TDEConfig*, const TQString& group = TQString() ); - virtual void writeConfig( TDEConfig*, const TQString& group = TQString() ); -signals: - - /** - * Emitted whenever an decodable item is dropped in the view. - * Note: The @ref TQDropEvent contains a @ref KURLDrag object. - */ - void dropped( TQDropEvent* ); - -protected slots: - /** - * Called when the auto timer times out. Open the current folder. - */ - void slotOpenFolder(); - -protected: - virtual void contentsDragEnterEvent( TQDragEnterEvent *e ); - virtual void contentsDragMoveEvent( TQDragMoveEvent *e ); - virtual void contentsDragLeaveEvent( TQDragLeaveEvent *e ); - virtual void contentsDropEvent( TQDropEvent* e ); - - /** - * Creates a @ref TQDragObject containing all urls of the selected @ref KFileItem of the view, - * @returns the @ref TQDragObject - */ - virtual TQDragObject* dragObject(); - - /** - *Creates the drag item and starts the drag - */ - virtual void startDrag(); - - /** - *@returns true if we can decode the drag and support the action - */ - virtual bool acceptDrag( TQDropEvent* event ) const; - -protected: - - TQTimer m_autoOpenTimer; - int m_autoOpenTime; - bool m_useAutoOpenTimer; - TQIconViewItem* m_dropItem; - bool m_dndEnabled; -}; -#endif -// kate: indent-mode csands; tab-width 4; auto-insert-doxygen on; - diff --git a/buildtools/autotools/kimporticonview.h b/buildtools/autotools/kimporticonview.h index 430f430c..d66c74ba 100644 --- a/buildtools/autotools/kimporticonview.h +++ b/buildtools/autotools/kimporticonview.h @@ -19,7 +19,7 @@ #include -#include "kfiledndiconview.h" +#include "tdefiledndiconview.h" class KImportIconView : public KFileDnDIconView { diff --git a/buildtools/autotools/subprojectoptionsdlg.cpp b/buildtools/autotools/subprojectoptionsdlg.cpp index aabb4b5e..f25a3958 100644 --- a/buildtools/autotools/subprojectoptionsdlg.cpp +++ b/buildtools/autotools/subprojectoptionsdlg.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include "domutil.h" #include "misc.h" #include "addprefixdlg.h" diff --git a/buildtools/autotools/targetoptionsdlg.cpp b/buildtools/autotools/targetoptionsdlg.cpp index f462ee60..bc81ef30 100644 --- a/buildtools/autotools/targetoptionsdlg.cpp +++ b/buildtools/autotools/targetoptionsdlg.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "autolistviewitems.h" #include "misc.h" diff --git a/buildtools/autotools/tdefilednddetailview.cpp b/buildtools/autotools/tdefilednddetailview.cpp new file mode 100644 index 00000000..74492577 --- /dev/null +++ b/buildtools/autotools/tdefilednddetailview.cpp @@ -0,0 +1,212 @@ +/*************************************************************************** +* tdefilednddetailview.cpp - description +* ------------------- +* begin : Wed Nov 1 2000 +* copyright : (C) 2000 by Bj�n Sahlstr� +* email : kbjorn@users.sourceforge.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 option) any later version. * +* * +***************************************************************************/ + +////////////////////////////////////////////////////// +// TQt specific includes +#include +#include +////////////////////////////////////////////////////// +// KDE specific includes +#include +#include +#include +////////////////////////////////////////////////////// +// Application specific includes +#include "tdefilednddetailview.h" + +#ifndef AUTO_OPEN_TIME +#define AUTO_OPEN_TIME + static int autoOpenTime = 750; +#endif +//----------------------------------------------- +KFileDnDDetailView::KFileDnDDetailView(TQWidget *parent, const char *name ) + : KFileDetailView(parent,name), m_autoOpenTimer( this ), + m_autoOpenTime( autoOpenTime ), m_useAutoOpenTimer( true ), + m_dropItem(0), m_dndEnabled( true ) +{ + setAutoUpdate( true ); + setDnDEnabled( true ); + useAutoOpenTimer( true ); +} +//----------------------------------------------- +KFileDnDDetailView::~KFileDnDDetailView(){ +} +//----------------------------------------------- +void KFileDnDDetailView::readConfig( TDEConfig* config, const TQString& group ) { + TDEConfigGroupSaver cs( config, group ); + bool dnd = config->readBoolEntry("DragAndDrop", true ); + setDnDEnabled( dnd ); + KFileDetailView::readConfig( config, group ); +} +//----------------------------------------------- +void KFileDnDDetailView::writeConfig( TDEConfig* config, const TQString& group ) { + TDEConfigGroupSaver cs( config, group ); + config->writeEntry("DragAndDrop", m_dndEnabled ); + KFileDetailView::writeConfig( config, group ); +} +//----------------------------------------------- +void KFileDnDDetailView::slotOpenFolder(){ + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + if( !m_dropItem ) + return; + } + KFileItemListIterator it( * KFileView::items() ); + for( ; it.current() ;++it ){ + if( (*it)->name() == m_dropItem->text(0) ) { + if( (*it)->isFile() ) + return; + else if( (*it)->isDir() || (*it)->isLink()) { + sig->activate( (*it) ); + return; + } + } + } +} +//----------------------------------------------- +void KFileDnDDetailView::contentsDragEnterEvent( TQDragEnterEvent *e ) { + + kdDebug (9020) << "KFileDnDDetailView::contentsDragEnterEvent" << endl; + + if ( ! acceptDrag( e ) ) { + e->accept( false ); + return; + } + e->acceptAction(); + TQListViewItem *i = itemAt( contentsToViewport( e->pos() ) ); + if ( i && m_useAutoOpenTimer ) { + m_dropItem = i; + m_autoOpenTimer.start( m_autoOpenTime ); + } +} +//----------------------------------------------- +void KFileDnDDetailView::contentsDragMoveEvent( TQDragMoveEvent *e ) { + + kdDebug (9020) << "KFileDnDDetailView::contentsDragMoveEvent" << endl; + + if ( ! acceptDrag( e ) ) { + e->accept( false ); + return; + } + e->acceptAction(); + TQListViewItem *i = itemAt( contentsToViewport( e->pos() ) ); + if( ! m_useAutoOpenTimer ) + return; + if ( i ) { + if ( i != m_dropItem ) { + m_autoOpenTimer.stop(); + m_dropItem = i; + m_autoOpenTimer.start( m_autoOpenTime ); + } + } + else + m_autoOpenTimer.stop(); +} +//----------------------------------------------- +void KFileDnDDetailView::contentsDragLeaveEvent( TQDragLeaveEvent* ) { + + kdDebug (9020) << "KFileDnDDetailView::contentsDragLeaveEvent" << endl; + + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + m_dropItem = 0L; + } +} +//----------------------------------------------- +void KFileDnDDetailView::contentsDropEvent( TQDropEvent* e ) { + + kdDebug (9020) << "KFileDndDetailView::contentsDropEvent" << endl; + + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + m_dropItem = 0L; + } + if( ! acceptDrag( e ) ) { + e->acceptAction( false ); + return; + } + e->acceptAction(); + // the drop was accepted so lets emit this to the outside world + KURL::List urls; + KURLDrag::decode( e, urls ); + emit dropped( e ); + emit dropped( this, e ); + emit dropped( this, urls ); +} +//----------------------------------------------- +void KFileDnDDetailView::startDrag(){ + + kdDebug (9020) << "KFileDnDDetailView::startDrag()" << endl; + + // create a list of the URL:s that we want to drag + KURL::List urls; + KFileItemListIterator it( * KFileView::selectedItems() ); + for ( ; it.current(); ++it ){ + urls.append( (*it)->url() ); + } + TQPixmap pixmap; + if( urls.count() > 1 ){ + pixmap = DesktopIcon( "tdemultiple", 16 ); + } + if( pixmap.isNull() ) + pixmap = currentFileItem()->pixmap( 16 ); + TQPoint hotspot; + hotspot.setX( pixmap.width() / 2 ); + hotspot.setY( pixmap.height() / 2 ); + m_dragObject = KURLDrag::newDrag( urls, widget() ); + m_dragObject->setPixmap( pixmap, hotspot ); + m_dragObject->drag(); // start the drag +} +//----------------------------------------------- +TQDragObject* KFileDnDDetailView::dragObject() const { + return m_dragObject; +} +//----------------------------------------------- +bool KFileDnDDetailView::acceptDrag(TQDropEvent* e ) const { + return KURLDrag::canDecode( e ) && + ( e->action() == TQDropEvent::Copy + || e->action() == TQDropEvent::Move + || e->action() == TQDropEvent::Link ); +} +//----------------------------------------------- +void KFileDnDDetailView::setAutoOpenTime( const int& time ){ + m_autoOpenTime = time; + useAutoOpenTimer(); +} +//----------------------------------------------- +void KFileDnDDetailView::useAutoOpenTimer( bool use ){ + m_useAutoOpenTimer = use; + if( use ) + connect( &m_autoOpenTimer, TQT_SIGNAL( timeout() ),this, TQT_SLOT( slotOpenFolder() ) ); + else { + disconnect( &m_autoOpenTimer, TQT_SIGNAL( timeout() ),this, TQT_SLOT( slotOpenFolder() ) ); + m_dropItem = 0L; + m_autoOpenTimer.stop(); + } +} +//----------------------------------------------- +void KFileDnDDetailView::setDnDEnabled( bool useDnD ){ + m_dndEnabled = useDnD; + setDragEnabled( useDnD ); + setDropVisualizer( useDnD ); + setAcceptDrops( useDnD ); + viewport()->setAcceptDrops( useDnD ); +} +//----------------------------------------------- +#ifndef NO_INCLUDE_MOCFILES +#include "tdefilednddetailview.moc" +#endif diff --git a/buildtools/autotools/tdefilednddetailview.h b/buildtools/autotools/tdefilednddetailview.h new file mode 100644 index 00000000..95f7d663 --- /dev/null +++ b/buildtools/autotools/tdefilednddetailview.h @@ -0,0 +1,137 @@ +/*************************************************************************** +* tdefilednddetailview.h - description +* ------------------- +* begin : Wed Nov 1 2000 +* copyright : (C) 2000 by Björn Sahlström +* email : kbjorn@users.sourceforge.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 option) any later version. * +* * +**************************************************************************/ + +#ifndef KFILEDNDDETAILVIEW_H +#define KFILEDNDDETAILVIEW_H + +////////////////////////////////////////////////////////////////////// +// TQt specific include files +#include +#include +////////////////////////////////////////////////////////////////////// +// KDE specific include files +#include +#include + + +/** + *This is a fileview inherited from @ref KFileDetailView. + *It adds "drag and drop" handling to the view suitable for a @ref KFileDetailView. + * No special setup is needed, just connect to the @ref dropped signals + * and the view will take care of the rest. + *@short "Drag and drop" aware @ref KFileDetailView + *@author Björn Sahlström + */ + +class KFileDnDDetailView : public KFileDetailView +{ + Q_OBJECT + +public: + /** */ + KFileDnDDetailView( TQWidget *parent = 0, const char *name = 0 ); + /** */ + virtual ~KFileDnDDetailView(); + /** + * Set this to true if Drag'n drop should be enabled or not, default is enabled + */ + void setDnDEnabled( bool ); + /** + * @returns wether DnD is enabled or not. + */ + bool isDnDEnabled() const + { + return m_dndEnabled; + } + /** + *Sets the auto open time, which means the time that will + *elapse before a directory is automatically opened after entered by DnD. + *Only need to call this if you want to change the predefined time that is 750 ms. + *This also calls @ref #useAutoOpenTimer so no need to call this to. + */ + void setAutoOpenTime( const int& time ); + /** + *Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false. + *By default this is turned ON. + */ + void useAutoOpenTimer( bool on = true ); + /** + *@returns true if auto open functionallity is turned ON (default), otherwhise false + *@see #useAutoOpenTimer + *@see #setAutoOpenTime + */ + bool isAutoOpening() const + { + return m_useAutoOpenTimer; + } + /** */ + virtual void readConfig( TDEConfig*, const TQString& group = TQString() ); + /** */ + virtual void writeConfig( TDEConfig*, const TQString& group = TQString() ); +signals: // Signals + /** + * Emitted whenever an decodable item is dropped in the view. + * Note: The @ref TQDropEvent contains a @ref KURLDrag object. + */ + void dropped( TQDropEvent* ); + /** + * Emitted whenever an decodable item is dropped in the view + * Note: The @ref TQDropEvent contains a @ref KURLDrag object. + */ + void dropped( KFileView*, TQDropEvent* ); + /** + * Emitted whenever an decodable item is dropped in the view. + *@param urls contains a list of all dropped @ref KURL + */ + void dropped( KFileView*, KURL::List& urls ); +protected slots: // Protected slots + /** + * Called when the auto timer times out. Open the current folder. + */ + void slotOpenFolder(); +protected: //Protected Methods + /** */ + virtual void contentsDragEnterEvent( TQDragEnterEvent *e ); + /** */ + virtual void contentsDragMoveEvent( TQDragMoveEvent *e ); + /** */ + virtual void contentsDragLeaveEvent( TQDragLeaveEvent *e ); + /** */ + virtual void contentsDropEvent( TQDropEvent* e ); + /** + * Create dragobject encoding the current selection and starts the drag + */ + virtual void startDrag(); + /** + * @returns the dragObject + */ + virtual TQDragObject* dragObject() const; + /** + * @returns true if we can decode the drag and support the action + */ + virtual bool acceptDrag( TQDropEvent* event ) const; +protected: // Private attributes + TQTimer m_autoOpenTimer; + int m_autoOpenTime; + bool m_useAutoOpenTimer; + TQListViewItem* m_dropItem; + KURLDrag* m_dragObject; + bool m_dndEnabled; +}; + +#endif +// kate: indent-mode csands; tab-width 4; diff --git a/buildtools/autotools/tdefiledndiconview.cpp b/buildtools/autotools/tdefiledndiconview.cpp new file mode 100644 index 00000000..d192b3b0 --- /dev/null +++ b/buildtools/autotools/tdefiledndiconview.cpp @@ -0,0 +1,194 @@ +/*************************************************************************** +* tdefiledndiconview.cpp - description +* ------------------- +* begin : Wed Nov 1 2000 +* copyright : (C) 2000 by Bj�rn Sahlstr�m +* email : kbjorn@users.sourceforge.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 option) any later version. * +* * +***************************************************************************/ + +////////////////////////////////////////////////////// +// TQt specific includes +#include +#include +////////////////////////////////////////////////////// +// KDE specific includes +#include +#include +#include +////////////////////////////////////////////////////// +// Application specific includes +#include "tdefiledndiconview.h" + +#ifndef AUTO_OPEN_TIME +#define AUTO_OPEN_TIME + static int autoOpenTime = 750; +#endif +//----------------------------------------------- +KFileDnDIconView::KFileDnDIconView( TQWidget *parent, const char *name ) + : KFileIconView(parent,name), m_autoOpenTimer( this ), + m_autoOpenTime( autoOpenTime ), m_useAutoOpenTimer( true ), + m_dropItem(0), m_dndEnabled( true ) +{ + setDnDEnabled( true ); + setAutoUpdate( true ); + useAutoOpenTimer( true ); +} +//----------------------------------------------- +KFileDnDIconView::~KFileDnDIconView(){ +} +//----------------------------------------------- +void KFileDnDIconView::readConfig( TDEConfig* config, const TQString& group ) { + TDEConfigGroupSaver cs( config, group ); + bool dnd = config->readBoolEntry("EnableDND", true ); + setDnDEnabled( dnd ); + KFileIconView::readConfig( config, group ); +} +//----------------------------------------------- +void KFileDnDIconView::writeConfig( TDEConfig* config, const TQString& group ) { + TDEConfigGroupSaver cs( config, group ); + config->writeEntry("EnableDND", m_dndEnabled ); + KFileIconView::writeConfig( config, group ); +} +//----------------------------------------------- +void KFileDnDIconView::slotOpenFolder(){ + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + if( !m_dropItem ) + return; + } + KFileItemListIterator it( * KFileView::items() ); + for( ; it.current() ;++it ){ + if( (*it)->name() == m_dropItem->text() ) { + if( (*it)->isFile() ) + return; + else if( (*it)->isDir() || (*it)->isLink()) { + sig->activate( (*it) ); + return; + } + } + } +} +//----------------------------------------------- +void KFileDnDIconView::contentsDragEnterEvent( TQDragEnterEvent *e ) { + if ( ! acceptDrag( e ) ) { // can we decode this ? + e->accept( false ); // No + return; + } + e->acceptAction(); // Yes + TQIconViewItem *i = findItem( contentsToViewport( e->pos() ) ); + if ( i && m_useAutoOpenTimer) { // are we over an item ? + m_dropItem = i; // set new m_dropItem + m_autoOpenTimer.start( m_autoOpenTime ); // restart timer + } +} +//----------------------------------------------- +void KFileDnDIconView::contentsDragMoveEvent( TQDragMoveEvent *e ) { + if ( ! acceptDrag( e ) ) { // can we decode this ? + e->accept( false ); // No + return; + } + e->acceptAction(); // Yes + TQIconViewItem *i = findItem( contentsToViewport( e->pos() ) ); + if( ! m_useAutoOpenTimer ) + return; + if ( i ) { // are we over an item ? + if ( i != m_dropItem ) { // if so, is it a new one ? + m_autoOpenTimer.stop(); // stop timer + m_dropItem = i; // set new m_dropItem + m_autoOpenTimer.start( m_autoOpenTime ); // restart timer + } + } + else + m_autoOpenTimer.stop(); // stop timer +} +//----------------------------------------------- +void KFileDnDIconView::contentsDragLeaveEvent( TQDragLeaveEvent* ) { + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + m_dropItem = 0L; + } +} +//----------------------------------------------- +void KFileDnDIconView::contentsDropEvent( TQDropEvent* e ) { + if( m_useAutoOpenTimer ) { + m_autoOpenTimer.stop(); + m_dropItem = 0L; + } + if( ! acceptDrag( e ) ) { + e->acceptAction( false ); + return; + } + e->acceptAction(); + // the drop was accepted so lets emit this + KURL::List urls; + KURLDrag::decode( e, urls ); + emit dropped( e ); +} +//----------------------------------------------- +void KFileDnDIconView::startDrag(){ + if ( ! currentItem() ) // is there any selected items ? + return; // nope + dragObject()->dragCopy(); // start the drag +} +//----------------------------------------------- +TQDragObject* KFileDnDIconView::dragObject() { + // create a list of the URL:s that we want to drag + KURL::List urls; + KFileItemListIterator it( * KFileView::selectedItems() ); + for ( ; it.current(); ++it ){ + urls.append( (*it)->url() ); + } + TQPixmap pixmap; + if( urls.count() > 1 ) + pixmap = DesktopIcon( "tdemultiple", iconSize() ); + if( pixmap.isNull() ) + pixmap = currentFileItem()->pixmap( iconSize() ); + TQPoint hotspot; + hotspot.setX( pixmap.width() / 2 ); + hotspot.setY( pixmap.height() / 2 ); + TQDragObject* myDragObject = KURLDrag::newDrag( urls, widget() ); + myDragObject->setPixmap( pixmap, hotspot ); + return myDragObject; +} +//----------------------------------------------- +void KFileDnDIconView::setAutoOpenTime( const int& time ){ + m_autoOpenTime = time; + useAutoOpenTimer(); +} +//----------------------------------------------- +void KFileDnDIconView::useAutoOpenTimer( bool use ){ + m_useAutoOpenTimer = use; + if ( use ) + connect( &m_autoOpenTimer, TQT_SIGNAL( timeout() ),this, TQT_SLOT( slotOpenFolder() ) ); + else { + disconnect( &m_autoOpenTimer, TQT_SIGNAL( timeout() ),this, TQT_SLOT( slotOpenFolder() ) ); + m_dropItem = 0L; + m_autoOpenTimer.stop(); + } +} +//----------------------------------------------- +void KFileDnDIconView::setDnDEnabled( bool useDnD ){ + m_dndEnabled = useDnD; + setAcceptDrops( useDnD ); + viewport()->setAcceptDrops( useDnD ); +} +//----------------------------------------------- +bool KFileDnDIconView::acceptDrag(TQDropEvent* e ) const { + return KURLDrag::canDecode( e ) && + ( e->action() == TQDropEvent::Copy + || e->action() == TQDropEvent::Move + || e->action() == TQDropEvent::Link ); +} +//----------------------------------------------- +#ifndef NO_INCLUDE_MOCFILES +#include "tdefiledndiconview.moc" +#endif diff --git a/buildtools/autotools/tdefiledndiconview.h b/buildtools/autotools/tdefiledndiconview.h new file mode 100644 index 00000000..84148362 --- /dev/null +++ b/buildtools/autotools/tdefiledndiconview.h @@ -0,0 +1,129 @@ +/************************************************************************** +* tdefiledndiconview.h - description +* ------------------- +* begin : Wed Nov 1 2000 +* copyright : (C) 2000 by Björn Sahlström +* email : kbjorn@users.sourceforge.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 option) any later version. * +* * +**************************************************************************/ + +#ifndef KFILEDNDICONVIEW_H +#define KFILEDNDICONVIEW_H + +#include +#include +#include +#include + +/** + * This is a fileview inherited from @ref KFileIconView. + * It adds "drag and drop" suitable for a @ref KFileIconView + * No special setup is needed, just connect to the @ref dropped signals + * and the view will take care of the rest. + * @short Drag and drop" aware @ref KFileIconView + * @author Björn Sahlström +*/ + +class KFileDnDIconView : public KFileIconView +{ + Q_OBJECT + +public: // Public methods + + KFileDnDIconView( TQWidget *parent = 0, const char *name = 0 ); + virtual ~KFileDnDIconView(); + + /** + * Set if Drag'n drop should be enabled or not, default is enabled. + */ + void setDnDEnabled( bool ); + + /** + * @returns wether DnD is enabled or not. + */ + bool isDnDEnabled() const + { + return m_dndEnabled; + } + + /** + * Sets the auto open time, which means the time that will + * elapse before a directory is automatically opened after entered by DnD. + * Only need to call this if you want to change the predefined time that is 750 ms. + * This also calls @ref #useAutoOpenTimer so no need to call this to. + */ + void setAutoOpenTime( const int& time ); + + /** + * Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false. + * By default this is turned ON. + */ + void useAutoOpenTimer( bool on = true ); + + /** + * @returns true if auto open functionallity is turned ON (default), otherwhise false + * @see #useAutoOpenTimer + * @see #setAutoOpenTime + */ + bool isAutoOpening() const + { + return m_useAutoOpenTimer; + } + + virtual void readConfig( TDEConfig*, const TQString& group = TQString() ); + virtual void writeConfig( TDEConfig*, const TQString& group = TQString() ); +signals: + + /** + * Emitted whenever an decodable item is dropped in the view. + * Note: The @ref TQDropEvent contains a @ref KURLDrag object. + */ + void dropped( TQDropEvent* ); + +protected slots: + /** + * Called when the auto timer times out. Open the current folder. + */ + void slotOpenFolder(); + +protected: + virtual void contentsDragEnterEvent( TQDragEnterEvent *e ); + virtual void contentsDragMoveEvent( TQDragMoveEvent *e ); + virtual void contentsDragLeaveEvent( TQDragLeaveEvent *e ); + virtual void contentsDropEvent( TQDropEvent* e ); + + /** + * Creates a @ref TQDragObject containing all urls of the selected @ref KFileItem of the view, + * @returns the @ref TQDragObject + */ + virtual TQDragObject* dragObject(); + + /** + *Creates the drag item and starts the drag + */ + virtual void startDrag(); + + /** + *@returns true if we can decode the drag and support the action + */ + virtual bool acceptDrag( TQDropEvent* event ) const; + +protected: + + TQTimer m_autoOpenTimer; + int m_autoOpenTime; + bool m_useAutoOpenTimer; + TQIconViewItem* m_dropItem; + bool m_dndEnabled; +}; +#endif +// kate: indent-mode csands; tab-width 4; auto-insert-doxygen on; + diff --git a/buildtools/custommakefiles/custombuildoptionswidget.cpp b/buildtools/custommakefiles/custombuildoptionswidget.cpp index 920a0908..31f3161f 100644 --- a/buildtools/custommakefiles/custombuildoptionswidget.cpp +++ b/buildtools/custommakefiles/custombuildoptionswidget.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include "domutil.h" diff --git a/buildtools/custommakefiles/custommanagerwidget.cpp b/buildtools/custommakefiles/custommanagerwidget.cpp index 7062ab18..6c09541b 100644 --- a/buildtools/custommakefiles/custommanagerwidget.cpp +++ b/buildtools/custommakefiles/custommanagerwidget.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/buildtools/custommakefiles/customprojectpart.cpp b/buildtools/custommakefiles/customprojectpart.cpp index b39dc00f..6e5bc476 100644 --- a/buildtools/custommakefiles/customprojectpart.cpp +++ b/buildtools/custommakefiles/customprojectpart.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/buildtools/lib/parsers/autotools/autotoolsdriver.cpp b/buildtools/lib/parsers/autotools/autotoolsdriver.cpp index a9620598..c31a5574 100644 --- a/buildtools/lib/parsers/autotools/autotoolsdriver.cpp +++ b/buildtools/lib/parsers/autotools/autotoolsdriver.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include extern FILE *yyin, *yyout; extern int yyparse(); diff --git a/buildtools/lib/parsers/qmake/CMakeLists.txt b/buildtools/lib/parsers/qmake/CMakeLists.txt index 73296c7b..b8328a84 100644 --- a/buildtools/lib/parsers/qmake/CMakeLists.txt +++ b/buildtools/lib/parsers/qmake/CMakeLists.txt @@ -34,6 +34,6 @@ tde_add_library( kdevqmakeparser SHARED qmake_lex.cpp qmake_yacc.cpp qmakeast.cpp qmakeastvisitor.cpp qmakedriver.cpp VERSION 0.0.0 - LINK kio-shared + LINK tdeio-shared DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/buildtools/lib/parsers/qmake/qmakedriver.cpp b/buildtools/lib/parsers/qmake/qmakedriver.cpp index e5a8f994..8b73814d 100644 --- a/buildtools/lib/parsers/qmake/qmakedriver.cpp +++ b/buildtools/lib/parsers/qmake/qmakedriver.cpp @@ -21,7 +21,7 @@ #include "qmakeast.h" #include -#include +#include #include #include diff --git a/buildtools/lib/widgets/addfilesdialog.h b/buildtools/lib/widgets/addfilesdialog.h index edc5c7be..8a7ed5c9 100644 --- a/buildtools/lib/widgets/addfilesdialog.h +++ b/buildtools/lib/widgets/addfilesdialog.h @@ -20,7 +20,7 @@ #define ADDFILESDIALOG_H #include -#include +#include class TQComboBox; diff --git a/buildtools/lib/widgets/runoptionswidget.cpp b/buildtools/lib/widgets/runoptionswidget.cpp index 0985e037..079f436e 100644 --- a/buildtools/lib/widgets/runoptionswidget.cpp +++ b/buildtools/lib/widgets/runoptionswidget.cpp @@ -20,7 +20,7 @@ #include "runoptionswidget.h" #include -#include +#include #include #include #include diff --git a/buildtools/pascal/pascalglobaloptionsdlg.cpp b/buildtools/pascal/pascalglobaloptionsdlg.cpp index 62facc8d..cf9e42cf 100644 --- a/buildtools/pascal/pascalglobaloptionsdlg.cpp +++ b/buildtools/pascal/pascalglobaloptionsdlg.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include "kdevcompileroptions.h" diff --git a/buildtools/pascal/pascalproject_part.cpp b/buildtools/pascal/pascalproject_part.cpp index a2cb5723..4dd34709 100644 --- a/buildtools/pascal/pascalproject_part.cpp +++ b/buildtools/pascal/pascalproject_part.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/buildtools/qmake/createscopedlg.cpp b/buildtools/qmake/createscopedlg.cpp index 4f65dd17..267bd471 100644 --- a/buildtools/qmake/createscopedlg.cpp +++ b/buildtools/qmake/createscopedlg.cpp @@ -14,11 +14,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include #include "urlutil.h" diff --git a/buildtools/qmake/newwidgetdlg.cpp b/buildtools/qmake/newwidgetdlg.cpp index ab3e72f7..99d39a93 100644 --- a/buildtools/qmake/newwidgetdlg.cpp +++ b/buildtools/qmake/newwidgetdlg.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/buildtools/qmake/projectconfigurationdlg.cpp b/buildtools/qmake/projectconfigurationdlg.cpp index e5e80b2e..8f4ffc70 100644 --- a/buildtools/qmake/projectconfigurationdlg.cpp +++ b/buildtools/qmake/projectconfigurationdlg.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/buildtools/qmake/trollprojectpart.cpp b/buildtools/qmake/trollprojectpart.cpp index 58c4ba22..69c030b7 100644 --- a/buildtools/qmake/trollprojectpart.cpp +++ b/buildtools/qmake/trollprojectpart.cpp @@ -31,12 +31,12 @@ #include #include #include -#include +#include #include #include #include #include -#include +#include #include diff --git a/buildtools/qmake/trollprojectwidget.cpp b/buildtools/qmake/trollprojectwidget.cpp index 5b1f528b..77301f95 100644 --- a/buildtools/qmake/trollprojectwidget.cpp +++ b/buildtools/qmake/trollprojectwidget.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -57,7 +57,7 @@ #include #include #include -#include +#include #include #include "kdevcore.h" -- cgit v1.2.1