mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Repair copy/cut/paste from the folder tree.
Finally fix the konqsidebar_tree.h vs konq_sidebartree.h confusion (!). svn path=/trunk/KDE/kdebase/apps/; revision=1047092
This commit is contained in:
parent
580065ed25
commit
be612d4262
15 changed files with 202 additions and 176 deletions
|
@ -21,6 +21,15 @@
|
|||
#include "konqsidebarplugin.moc"
|
||||
#include <kdebug.h>
|
||||
|
||||
class KonqSidebarModulePrivate
|
||||
{
|
||||
public:
|
||||
KonqSidebarModulePrivate()
|
||||
: m_copy(false), m_cut(false), m_paste(false) {}
|
||||
bool m_copy;
|
||||
bool m_cut;
|
||||
bool m_paste;
|
||||
};
|
||||
|
||||
KonqSidebarModule::KonqSidebarModule(const KComponentData &componentData,
|
||||
QObject *parent,
|
||||
|
@ -28,11 +37,14 @@ KonqSidebarModule::KonqSidebarModule(const KComponentData &componentData,
|
|||
: QObject(parent),
|
||||
m_parentComponentData(componentData),
|
||||
m_configGroup(configGroup_),
|
||||
d(0)
|
||||
d(new KonqSidebarModulePrivate)
|
||||
{
|
||||
}
|
||||
|
||||
KonqSidebarModule::~KonqSidebarModule() { }
|
||||
KonqSidebarModule::~KonqSidebarModule()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
const KComponentData &KonqSidebarModule::parentComponentData() const { return m_parentComponentData; }
|
||||
|
||||
|
@ -59,3 +71,45 @@ KConfigGroup KonqSidebarModule::configGroup()
|
|||
{
|
||||
return m_configGroup;
|
||||
}
|
||||
|
||||
void KonqSidebarModule::enableCopy(bool enabled)
|
||||
{
|
||||
d->m_copy = enabled;
|
||||
emit enableAction(this, "copy", enabled);
|
||||
}
|
||||
|
||||
void KonqSidebarModule::enableCut(bool enabled)
|
||||
{
|
||||
d->m_cut = enabled;
|
||||
emit enableAction(this, "cut", enabled);
|
||||
}
|
||||
|
||||
void KonqSidebarModule::enablePaste(bool enabled)
|
||||
{
|
||||
d->m_paste = enabled;
|
||||
emit enableAction(this, "paste", enabled);
|
||||
}
|
||||
|
||||
bool KonqSidebarModule::isCopyEnabled() const
|
||||
{
|
||||
return d->m_copy;
|
||||
}
|
||||
|
||||
bool KonqSidebarModule::isCutEnabled() const
|
||||
{
|
||||
return d->m_cut;
|
||||
}
|
||||
|
||||
bool KonqSidebarModule::isPasteEnabled() const
|
||||
{
|
||||
return d->m_paste;
|
||||
}
|
||||
|
||||
void KonqSidebarModule::showPopupMenu(const QPoint &global, const KFileItemList &items,
|
||||
const KParts::OpenUrlArguments &args,
|
||||
const KParts::BrowserArguments &browserArgs,
|
||||
KParts::BrowserExtension::PopupFlags flags,
|
||||
const KParts::BrowserExtension::ActionGroupMap& actionGroups)
|
||||
{
|
||||
emit popupMenu(this, global, items, args, browserArgs, flags, actionGroups);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,23 @@ public:
|
|||
const KComponentData &parentComponentData() const;
|
||||
KConfigGroup configGroup();
|
||||
|
||||
/**
|
||||
* Enable/disable a standard konqueror action (cut, copy, paste, print)
|
||||
* See KParts::BrowserExtension::enableAction
|
||||
*/
|
||||
void enableCopy(bool enabled);
|
||||
void enableCut(bool enabled);
|
||||
void enablePaste(bool enabled);
|
||||
bool isCopyEnabled() const;
|
||||
bool isCutEnabled() const;
|
||||
bool isPasteEnabled() const;
|
||||
|
||||
void showPopupMenu(const QPoint &global, const KFileItemList &items,
|
||||
const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
|
||||
const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
|
||||
KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
|
||||
const KParts::BrowserExtension::ActionGroupMap& actionGroups = KParts::BrowserExtension::ActionGroupMap());
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Called by the sidebar's openUrl. Reimplement this in order to
|
||||
|
@ -73,13 +90,6 @@ protected:
|
|||
virtual void handlePreview(const KFileItemList & items);
|
||||
virtual void handlePreviewOnMouseOver(const KFileItem &items); //not used yet
|
||||
|
||||
Q_SIGNALS:
|
||||
void started(KIO::Job *);
|
||||
void completed();
|
||||
void setIcon(const QString& icon);
|
||||
void setCaption(const QString& caption);
|
||||
|
||||
|
||||
public Q_SLOTS:
|
||||
void openUrl(const KUrl& url);
|
||||
|
||||
|
@ -88,6 +98,11 @@ public Q_SLOTS:
|
|||
void openPreviewOnMouseOver(const KFileItem& item); // not used yet
|
||||
|
||||
Q_SIGNALS:
|
||||
void started(KIO::Job *);
|
||||
void completed();
|
||||
void setIcon(const QString& icon);
|
||||
void setCaption(const QString& caption);
|
||||
|
||||
/**
|
||||
* Ask konqueror to open @p url.
|
||||
*/
|
||||
|
@ -103,19 +118,17 @@ Q_SIGNALS:
|
|||
/**
|
||||
* Ask konqueror to show the standard popup menu for the given @p items.
|
||||
*/
|
||||
void popupMenu(const QPoint &global, const KFileItemList &items,
|
||||
void popupMenu(KonqSidebarModule* module,
|
||||
const QPoint &global, const KFileItemList &items,
|
||||
const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
|
||||
const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
|
||||
KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
|
||||
const KParts::BrowserExtension::ActionGroupMap& actionGroups = KParts::BrowserExtension::ActionGroupMap());
|
||||
|
||||
/* signals, which sidebar_widget.cpp connects by name. TODO: define the useful ones here, remove
|
||||
* the others
|
||||
void enableAction( const char * name, bool enabled );
|
||||
void started(KIO::Job *);
|
||||
void completed();
|
||||
// TODO
|
||||
void submitFormRequest(const char*,const QString&,const QByteArray&,const QString&,const QString&,const QString&);
|
||||
*/
|
||||
|
||||
void enableAction(KonqSidebarModule* module, const char* name, bool enabled);
|
||||
|
||||
private:
|
||||
KComponentData m_parentComponentData;
|
||||
|
|
|
@ -84,8 +84,8 @@ void KonqSidebarPart::customEvent(QEvent* ev)
|
|||
|
||||
////
|
||||
|
||||
KonqSidebarBrowserExtension::KonqSidebarBrowserExtension(KonqSidebarPart *part, Sidebar_Widget *widget)
|
||||
: KParts::BrowserExtension(part), widget(widget)
|
||||
KonqSidebarBrowserExtension::KonqSidebarBrowserExtension(KonqSidebarPart *part, Sidebar_Widget *widget_)
|
||||
: KParts::BrowserExtension(part), widget(widget_)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -28,18 +28,19 @@ class KonqSidebarBrowserExtension : public KParts::BrowserExtension
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KonqSidebarBrowserExtension(KonqSidebarPart *part_, Sidebar_Widget *widget_);
|
||||
KonqSidebarBrowserExtension(KonqSidebarPart *part, Sidebar_Widget *widget);
|
||||
~KonqSidebarBrowserExtension(){}
|
||||
|
||||
protected:
|
||||
QPointer<Sidebar_Widget> widget;
|
||||
|
||||
// The following slots are needed for konqueror's standard actions
|
||||
// ### Not really, since the sidebar never gets focus, currently.
|
||||
// They are called from the RMB popup menu
|
||||
protected Q_SLOTS:
|
||||
void copy() { if (widget) widget->stdAction("copy()"); }
|
||||
void cut() { if (widget) widget->stdAction("cut()"); }
|
||||
void paste() { if (widget) widget->stdAction("paste()"); }
|
||||
void copy() { if (widget) widget->stdAction("copy"); }
|
||||
void cut() { if (widget) widget->stdAction("cut"); }
|
||||
void paste() { if (widget) widget->stdAction("paste"); }
|
||||
void pasteTo(const KUrl&) { if (widget) widget->stdAction("pasteToSelection"); }
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -134,7 +134,7 @@ Sidebar_Widget::Sidebar_Widget(QWidget *parent, KParts::ReadOnlyPart *par, const
|
|||
m_noUpdate = false;
|
||||
m_layout = 0;
|
||||
m_currentButtonIndex = -1;
|
||||
//m_activeModule = 0; // TODO REMOVE?
|
||||
m_activeModule = 0;
|
||||
//m_userMovedSplitter = false;
|
||||
//kDebug() << "**** Sidebar_Widget:SidebarWidget()";
|
||||
m_hasStoredUrl = false;
|
||||
|
@ -366,20 +366,11 @@ void Sidebar_Widget::readConfig()
|
|||
|
||||
void Sidebar_Widget::stdAction(const char *handlestd)
|
||||
{
|
||||
// PENDING(kdab) Review
|
||||
#ifdef KDAB_TEMPORARILY_REMOVED
|
||||
ButtonInfo* mod = m_activeModule;
|
||||
|
||||
if (!mod || !mod->module)
|
||||
return;
|
||||
|
||||
kDebug() << "Try calling >active< module's (" << mod->module->metaObject()->className() << ") slot " << handlestd;
|
||||
|
||||
QMetaObject::invokeMethod( mod->module, handlestd );
|
||||
#else // KDAB_TEMPORARILY_REMOVED
|
||||
qWarning("Sorry, not implemented: Sidebar_Widget::stdAction");
|
||||
return ;
|
||||
#endif // KDAB_TEMPORARILY_REMOVED
|
||||
// ### problem: what about multi mode? We could have multiple modules shown,
|
||||
// and if we use Edit/Copy, which one should be used? Need to care about focus...
|
||||
kDebug() << handlestd << "m_activeModule=" << m_activeModule;
|
||||
if (m_activeModule)
|
||||
QMetaObject::invokeMethod(m_activeModule, handlestd);
|
||||
}
|
||||
|
||||
|
||||
|
@ -724,77 +715,31 @@ void Sidebar_Widget::createNewWindow(const KUrl &url, const KParts::OpenUrlArgum
|
|||
getExtension()->createNewWindow(url, args, browserArgs, windowArgs);
|
||||
}
|
||||
|
||||
void Sidebar_Widget::enableAction( const char * name, bool enabled )
|
||||
void Sidebar_Widget::slotEnableAction(KonqSidebarModule* module, const char * name, bool enabled)
|
||||
{
|
||||
// PENDING(kdab) Review
|
||||
#ifdef KDAB_TEMPORARILY_REMOVED
|
||||
// TODO ###### How could this ever happen?!?
|
||||
if ((qstrcmp("ButtonInfo", sender()->parent()->metaObject()->className()) == 0))
|
||||
{
|
||||
ButtonInfo *btninfo = static_cast<ButtonInfo*>(sender()->parent());
|
||||
if (btninfo)
|
||||
{
|
||||
QString n(name);
|
||||
if (n == "copy")
|
||||
btninfo->copy = enabled;
|
||||
else if (n == "cut")
|
||||
btninfo->cut = enabled;
|
||||
else if (n == "paste")
|
||||
btninfo->paste = enabled;
|
||||
else if (n == "trash")
|
||||
btninfo->trash = enabled;
|
||||
else if (n == "del")
|
||||
btninfo->del = enabled;
|
||||
else if (n == "rename")
|
||||
btninfo->rename = enabled;
|
||||
}
|
||||
if (module->getWidget()->isVisible()) {
|
||||
emit getExtension()->enableAction(name, enabled);
|
||||
}
|
||||
#else // KDAB_TEMPORARILY_REMOVED
|
||||
qWarning("Sorry, not implemented: Sidebar_Widget::enableAction");
|
||||
return ;
|
||||
#endif // KDAB_TEMPORARILY_REMOVED
|
||||
}
|
||||
|
||||
|
||||
bool Sidebar_Widget::doEnableActions()
|
||||
void Sidebar_Widget::doEnableActions()
|
||||
{
|
||||
// PENDING(kdab) Review
|
||||
#ifdef KDAB_TEMPORARILY_REMOVED
|
||||
if ((qstrcmp("ButtonInfo", sender()->parent()->metaObject()->className()) != 0))
|
||||
{
|
||||
kDebug()<<"Couldn't set active module, aborting";
|
||||
return false;
|
||||
} else {
|
||||
m_activeModule=static_cast<ButtonInfo*>(sender()->parent());
|
||||
getExtension()->enableAction( "copy", m_activeModule->copy );
|
||||
getExtension()->enableAction( "cut", m_activeModule->cut );
|
||||
getExtension()->enableAction( "paste", m_activeModule->paste );
|
||||
getExtension()->enableAction( "trash", m_activeModule->trash );
|
||||
getExtension()->enableAction( "del", m_activeModule->del );
|
||||
getExtension()->enableAction( "rename", m_activeModule->rename );
|
||||
return true;
|
||||
if (m_activeModule) {
|
||||
getExtension()->enableAction( "copy", m_activeModule->isCopyEnabled() );
|
||||
getExtension()->enableAction( "cut", m_activeModule->isCutEnabled() );
|
||||
getExtension()->enableAction( "paste", m_activeModule->isPasteEnabled() );
|
||||
}
|
||||
|
||||
#else // KDAB_TEMPORARILY_REMOVED
|
||||
qWarning("Sorry, not implemented: Sidebar_Widget::doEnableActions");
|
||||
return true;
|
||||
#endif // KDAB_TEMPORARILY_REMOVED
|
||||
}
|
||||
|
||||
|
||||
void Sidebar_Widget::connectModule(QObject *mod)
|
||||
void Sidebar_Widget::connectModule(KonqSidebarModule *mod)
|
||||
{
|
||||
// TODO get rid of started/completed, or define them in base class
|
||||
if (mod->metaObject()->indexOfSignal("started(KIO::Job*)") != -1) {
|
||||
connect(mod,SIGNAL(started(KIO::Job *)),this, SIGNAL(started(KIO::Job*)));
|
||||
}
|
||||
connect(mod,SIGNAL(started(KIO::Job *)),this, SIGNAL(started(KIO::Job*)));
|
||||
connect(mod,SIGNAL(completed()),this,SIGNAL(completed()));
|
||||
|
||||
if (mod->metaObject()->indexOfSignal("completed()") != -1) {
|
||||
connect(mod,SIGNAL(completed()),this,SIGNAL(completed()));
|
||||
}
|
||||
|
||||
connect(mod, SIGNAL(popupMenu(QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)),
|
||||
getExtension(), SIGNAL(popupMenu(QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)));
|
||||
connect(mod, SIGNAL(popupMenu(KonqSidebarModule*,QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)),
|
||||
this, SLOT(slotPopupMenu(KonqSidebarModule*,QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)));
|
||||
|
||||
connect(mod, SIGNAL(openUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)),
|
||||
this, SLOT(openUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)));
|
||||
|
@ -809,11 +754,8 @@ void Sidebar_Widget::connectModule(QObject *mod)
|
|||
SLOT(submitFormRequest(const char*,const QString&,const QByteArray&,const QString&,const QString&,const QString&)));
|
||||
}
|
||||
|
||||
// TODO remove?
|
||||
if (mod->metaObject()->indexOfSignal("enableAction(const char*,bool)") != -1) {
|
||||
connect(mod,SIGNAL(enableAction( const char *, bool)),
|
||||
this,SLOT(enableAction(const char *, bool)));
|
||||
}
|
||||
connect(mod, SIGNAL(enableAction(KonqSidebarModule*,const char*,bool)),
|
||||
this, SLOT(slotEnableAction(KonqSidebarModule*,const char*,bool)));
|
||||
}
|
||||
|
||||
Sidebar_Widget::~Sidebar_Widget()
|
||||
|
@ -854,4 +796,16 @@ KonqSidebarPlugin* ButtonInfo::plugin(QObject* parent)
|
|||
return m_plugin;
|
||||
}
|
||||
|
||||
void Sidebar_Widget::slotPopupMenu(KonqSidebarModule* module,
|
||||
const QPoint &global, const KFileItemList &items,
|
||||
const KParts::OpenUrlArguments &args,
|
||||
const KParts::BrowserArguments &browserArgs,
|
||||
KParts::BrowserExtension::PopupFlags flags,
|
||||
const KParts::BrowserExtension::ActionGroupMap& actionGroups)
|
||||
{
|
||||
m_activeModule = module;
|
||||
doEnableActions();
|
||||
emit getExtension()->popupMenu(global, items, args, browserArgs, flags, actionGroups);
|
||||
}
|
||||
|
||||
#include "sidebar_widget.moc"
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
module(NULL), m_plugin(NULL),
|
||||
URL(url_), libName(lib), displayName(dispName_), iconName(iconName_)
|
||||
{
|
||||
copy = cut = paste = trash = del = rename =false;
|
||||
}
|
||||
|
||||
~ButtonInfo() {}
|
||||
|
@ -69,13 +68,6 @@ public:
|
|||
QString libName;
|
||||
QString displayName;
|
||||
QString iconName;
|
||||
bool copy;
|
||||
bool cut;
|
||||
bool paste;
|
||||
bool trash;
|
||||
bool del;
|
||||
bool rename;
|
||||
//KonqSidebarIface *m_part;
|
||||
};
|
||||
|
||||
class Sidebar_Widget: public QWidget
|
||||
|
@ -135,7 +127,7 @@ public Q_SLOTS:
|
|||
void createNewWindow(const KUrl &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs,
|
||||
const KParts::WindowArgs &windowArgs);
|
||||
|
||||
void enableAction( const char * name, bool enabled );
|
||||
void slotEnableAction(KonqSidebarModule* module, const char * name, bool enabled);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -145,14 +137,21 @@ private:
|
|||
ButtonInfo& buttonInfo, const KSharedConfig::Ptr& config);
|
||||
void readConfig();
|
||||
void doLayout();
|
||||
void connectModule(QObject *mod);
|
||||
void connectModule(KonqSidebarModule *mod);
|
||||
void collapseExpandSidebar();
|
||||
bool doEnableActions();
|
||||
void doEnableActions();
|
||||
ButtonInfo& currentButtonInfo() { return m_buttons[m_currentButtonIndex]; }
|
||||
|
||||
protected Q_SLOTS:
|
||||
void aboutToShowAddMenu();
|
||||
void triggeredAddMenu(QAction* action);
|
||||
|
||||
void slotPopupMenu(KonqSidebarModule*, const QPoint &global, const KFileItemList &items,
|
||||
const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
|
||||
const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
|
||||
KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
|
||||
const KParts::BrowserExtension::ActionGroupMap& actionGroups = KParts::BrowserExtension::ActionGroupMap());
|
||||
|
||||
private:
|
||||
KParts::ReadOnlyPart *m_partParent;
|
||||
QSplitter *m_area;
|
||||
|
@ -167,8 +166,9 @@ private:
|
|||
QActionGroup m_addMenuActionGroup;
|
||||
QMap<QAction*, KonqSidebarPlugin*> m_pluginForAction;
|
||||
|
||||
//QPointer<ButtonInfo> m_activeModule; // TODO REMOVE?
|
||||
int m_currentButtonIndex; // during RMB popups only
|
||||
QPointer<KonqSidebarModule> m_activeModule; // during RMB popups inside the module
|
||||
|
||||
int m_currentButtonIndex; // during RMB popups (over tabs) only, see currentButtonInfo
|
||||
|
||||
KConfigGroup *m_config;
|
||||
QTimer m_configTimer;
|
||||
|
|
|
@ -15,7 +15,7 @@ add_subdirectory( bookmark_module )
|
|||
|
||||
########### next target ###############
|
||||
|
||||
set(konqsidebar_tree_PART_SRCS konqsidebar_tree.cpp ${libkonq_sidebar_tree_SRCS})
|
||||
set(konqsidebar_tree_PART_SRCS konqsidebar_oldtreemodule.cpp ${libkonq_sidebar_tree_SRCS})
|
||||
|
||||
kde4_add_plugin(konqsidebar_tree ${konqsidebar_tree_PART_SRCS})
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <klineedit.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kstandardaction.h>
|
||||
#include <kparts/part.h>
|
||||
|
||||
KBookmarkManager* s_bookmarkManager = 0;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
//#include "konq_treepart.h"
|
||||
#include "konqsidebar_oldtreemodule.h"
|
||||
#include "dirtree_item.h"
|
||||
#include <kfileitemlistproperties.h>
|
||||
#include "dirtree_module.h"
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
#include <kio/paste.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtGui/QPainter>
|
||||
#include <kiconloader.h>
|
||||
|
@ -150,17 +151,18 @@ bool KonqSidebarDirTreeItem::populateMimeData( QMimeData* mimeData, bool move )
|
|||
{
|
||||
KUrl::List lst;
|
||||
lst.append( m_fileItem.url() );
|
||||
kDebug() << lst;
|
||||
|
||||
KonqMimeData::populateMimeData( mimeData, KUrl::List(), lst, move );
|
||||
|
||||
KonqMimeData::populateMimeData( mimeData, lst, KUrl::List(), move );
|
||||
return true;
|
||||
}
|
||||
|
||||
void KonqSidebarDirTreeItem::itemSelected()
|
||||
{
|
||||
QMimeSource *data = QApplication::clipboard()->data();
|
||||
const bool paste = data->provides("text/uri-list");
|
||||
tree()->enableActions( true, true, paste );
|
||||
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
|
||||
const KUrl::List urls = KUrl::List::fromMimeData(mimeData);
|
||||
const bool paste = !urls.isEmpty();
|
||||
tree()->enableActions(true, true, paste);
|
||||
}
|
||||
|
||||
void KonqSidebarDirTreeItem::middleButtonClicked()
|
||||
|
@ -237,7 +239,7 @@ void KonqSidebarDirTreeItem::rightButtonPressed()
|
|||
|
||||
actionGroups.insert("editactions", editActions);
|
||||
|
||||
emit tree()->popupMenu(QCursor::pos(), items,
|
||||
emit tree()->sidebarModule()->showPopupMenu(QCursor::pos(), items,
|
||||
KParts::OpenUrlArguments(), KParts::BrowserArguments(),
|
||||
popupFlags, actionGroups);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "dirtree_module.h"
|
||||
#include "dirtree_item.h"
|
||||
|
||||
#include <kconfiggroup.h>
|
||||
#include <kdebug.h>
|
||||
#include <kprotocolmanager.h>
|
||||
#include <kdesktopfile.h>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "konq_sidebartreemodule.h"
|
||||
#include "konqsidebar_oldtreemodule.h"
|
||||
|
||||
#include <QtGui/QClipboard>
|
||||
#include <QtGui/QCursor>
|
||||
|
@ -119,7 +120,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
KonqSidebarTree::KonqSidebarTree( KonqSidebar_Tree *parent, QWidget *parentWidget, ModuleType moduleType, const QString& path )
|
||||
KonqSidebarTree::KonqSidebarTree( KonqSidebarOldTreeModule *parent, QWidget *parentWidget, ModuleType moduleType, const QString& path )
|
||||
: K3ListView( parentWidget ),
|
||||
m_currentTopLevelItem( 0 ),
|
||||
m_scrollingLocked( false ),
|
||||
|
@ -137,7 +138,7 @@ KonqSidebarTree::KonqSidebarTree( KonqSidebar_Tree *parent, QWidget *parentWidge
|
|||
setSelectionMode( Q3ListView::Single );
|
||||
setDragEnabled(true);
|
||||
|
||||
m_part = parent;
|
||||
m_sidebarModule = parent;
|
||||
|
||||
m_animationTimer = new QTimer( this );
|
||||
connect( m_animationTimer, SIGNAL( timeout() ),
|
||||
|
@ -165,6 +166,8 @@ KonqSidebarTree::KonqSidebarTree( KonqSidebar_Tree *parent, QWidget *parentWidge
|
|||
this, SLOT( slotDoubleClicked( Q3ListViewItem * ) ) );
|
||||
connect( this, SIGNAL( selectionChanged() ),
|
||||
this, SLOT( slotSelectionChanged() ) );
|
||||
connect(qApp->clipboard(), SIGNAL(dataChanged()),
|
||||
this, SLOT(slotSelectionChanged())); // so that "paste" can be updated
|
||||
|
||||
connect( this, SIGNAL(itemRenamed(Q3ListViewItem*, const QString &, int)),
|
||||
this, SLOT(slotItemRenamed(Q3ListViewItem*, const QString &, int)));
|
||||
|
@ -196,6 +199,7 @@ KonqSidebarTree::KonqSidebarTree( KonqSidebar_Tree *parent, QWidget *parentWidge
|
|||
connect(kdirnotify, SIGNAL(FilesRemoved(QStringList)), SLOT(slotFilesRemoved(QStringList)));
|
||||
|
||||
m_collection = new KActionCollection(this);
|
||||
m_collection->addAssociatedWidget(this);
|
||||
m_collection->setObjectName("bookmark actions");
|
||||
QAction *action = new KAction(KIcon("folder-new"), i18n("&Create New Folder..."), this);
|
||||
m_collection->addAction("create_folder", action);
|
||||
|
@ -210,6 +214,9 @@ KonqSidebarTree::KonqSidebarTree( KonqSidebar_Tree *parent, QWidget *parentWidge
|
|||
connect(action, SIGNAL(triggered(bool)), SLOT(slotTrash()));
|
||||
|
||||
action = new KAction(i18n("Rename"), this);
|
||||
action->setShortcut(Qt::Key_F2); // clash!
|
||||
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
action->setIcon(KIcon("edit-rename"));
|
||||
m_collection->addAction("rename", action);
|
||||
connect(action, SIGNAL(triggered(bool) ), SLOT( slotRename() ));
|
||||
|
||||
|
@ -471,10 +478,10 @@ Q3DragObject* KonqSidebarTree::dragObject()
|
|||
if ( !item )
|
||||
return 0;
|
||||
|
||||
QDrag* drag = new QDrag( viewport() );
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
if ( item->populateMimeData( mimeData, false ) )
|
||||
{
|
||||
QDrag* drag = new QDrag( viewport() );
|
||||
drag->setMimeData(mimeData);
|
||||
const QPixmap *pix = item->pixmap(0);
|
||||
if ( pix && drag->pixmap().isNull() )
|
||||
|
@ -482,8 +489,8 @@ Q3DragObject* KonqSidebarTree::dragObject()
|
|||
}
|
||||
else
|
||||
{
|
||||
delete drag;
|
||||
drag = 0;
|
||||
delete mimeData;
|
||||
mimeData = 0;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
@ -682,7 +689,7 @@ void KonqSidebarTree::scanDir( KonqSidebarTreeItem *parent, const QString &path,
|
|||
/*
|
||||
// debug code
|
||||
|
||||
const QStringList blah = m_part->getInterfaces->componentData()->dirs()->dirs()->findDirs( "data", "konqueror/dirtree" );
|
||||
const QStringList blah = m_sidebarModule->getInterfaces->componentData()->dirs()->dirs()->findDirs( "data", "konqueror/dirtree" );
|
||||
QStringList::ConstIterator eIt = blah.constBegin();
|
||||
QStringList::ConstIterator eEnd = blah.constEnd();
|
||||
for (; eIt != eEnd; ++eIt )
|
||||
|
@ -895,9 +902,9 @@ void KonqSidebarTree::slotItemRenamed(Q3ListViewItem* item, const QString &name,
|
|||
void KonqSidebarTree::enableActions(bool copy, bool cut, bool paste)
|
||||
{
|
||||
kDebug() << copy << cut << paste;
|
||||
enableAction( "copy", copy );
|
||||
enableAction( "cut", cut );
|
||||
enableAction( "paste", paste );
|
||||
m_sidebarModule->enableCopy(copy);
|
||||
m_sidebarModule->enableCut(cut);
|
||||
m_sidebarModule->enablePaste(paste);
|
||||
}
|
||||
|
||||
void KonqSidebarTree::showToplevelContextMenu()
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#define KONQ_SIDEBARTREE_H
|
||||
|
||||
#include <k3listview.h>
|
||||
#include <kparts/browserextension.h>
|
||||
#include "konq_sidebartreetoplevelitem.h"
|
||||
#include "konqsidebar_tree.h"
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QPoint>
|
||||
#include <Qt3Support/Q3StrList>
|
||||
|
@ -34,7 +34,7 @@
|
|||
#include <Qt3Support/Q3PtrList>
|
||||
#include <QtCore/QEvent>
|
||||
|
||||
class KonqSidebar_Tree;
|
||||
class KonqSidebarOldTreeModule;
|
||||
class KonqSidebarTreeModule;
|
||||
class KonqSidebarTreeItem;
|
||||
class KActionCollection;
|
||||
|
@ -69,7 +69,7 @@ class KonqSidebarTree : public K3ListView // PORTING NOTE: DO NOT PORT TO QTreeW
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KonqSidebarTree( KonqSidebar_Tree *parent, QWidget *parentWidget, ModuleType moduleType, const QString& path );
|
||||
KonqSidebarTree( KonqSidebarOldTreeModule *parent, QWidget *parentWidget, ModuleType moduleType, const QString& path );
|
||||
virtual ~KonqSidebarTree();
|
||||
|
||||
void followURL( const KUrl &url );
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
void startAnimation( KonqSidebarTreeItem * item, const char * iconBaseName = "kde", uint iconCount = 6, const QPixmap * originalPixmap = 0L );
|
||||
void stopAnimation( KonqSidebarTreeItem * item );
|
||||
|
||||
KonqSidebarModule * part() { return m_part; } // TODO remove
|
||||
KonqSidebarOldTreeModule * sidebarModule() { return m_sidebarModule; }
|
||||
|
||||
KActionCollection *actionCollection() { return m_collection; }
|
||||
|
||||
|
@ -160,7 +160,7 @@ private:
|
|||
|
||||
Q3PtrList<KonqSidebarTreeModule> m_lstModules;
|
||||
|
||||
KonqSidebar_Tree *m_part;
|
||||
KonqSidebarOldTreeModule *m_sidebarModule;
|
||||
|
||||
struct AnimationInfo
|
||||
{
|
||||
|
@ -212,12 +212,6 @@ signals:
|
|||
const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments() );
|
||||
void createNewWindow( const KUrl &url, const KParts::OpenUrlArguments& args = KParts::OpenUrlArguments(),
|
||||
const KParts::BrowserArguments& browserArgs = KParts::BrowserArguments() );
|
||||
void popupMenu(const QPoint &global, const KFileItemList &items,
|
||||
const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
|
||||
const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
|
||||
KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
|
||||
const KParts::BrowserExtension::ActionGroupMap& actionGroups = KParts::BrowserExtension::ActionGroupMap());
|
||||
void enableAction( const char * name, bool enabled );
|
||||
};
|
||||
|
||||
#endif // KONQ_SIDEBARTREE_H
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <konq_operations.h>
|
||||
#include <kprotocolinfo.h>
|
||||
#include <k3urldrag.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kfileitem.h>
|
||||
#include <kmimetype.h>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
|
@ -88,15 +90,12 @@ void KonqSidebarTreeTopLevelItem::drop( QDropEvent * ev )
|
|||
|
||||
bool KonqSidebarTreeTopLevelItem::populateMimeData( QMimeData* mimeData, bool move )
|
||||
{
|
||||
// 100% duplicated from KonqDirTreeItem::dragObject :(
|
||||
KUrl::List lst;
|
||||
KUrl url;
|
||||
url.setPath( path() );
|
||||
lst.append( url );
|
||||
lst.append( KUrl(path()) );
|
||||
|
||||
KonqMimeData::populateMimeData( mimeData, KUrl::List(), lst, move );
|
||||
|
||||
#if 0 // was this ever used? Seems populateMimeData is only used for copy/cut, not for dragging?
|
||||
#if 0
|
||||
const QPixmap * pix = pixmap(0);
|
||||
if (pix)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "konqsidebar_tree.h"
|
||||
#include "konqsidebar_oldtreemodule.h"
|
||||
#include <QAction>
|
||||
#include <kdesktopfile.h>
|
||||
#include "konqsidebar_tree.moc"
|
||||
#include "konq_sidebartree.h"
|
||||
#include <kvbox.h>
|
||||
#include <kdebug.h>
|
||||
|
@ -18,7 +17,7 @@
|
|||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QApplication>
|
||||
|
||||
KonqSidebar_Tree::KonqSidebar_Tree(const KComponentData &componentData, QWidget *parent,
|
||||
KonqSidebarOldTreeModule::KonqSidebarOldTreeModule(const KComponentData &componentData, QWidget *parent,
|
||||
const QString &desktopName_, const KConfigGroup& configGroup)
|
||||
: KonqSidebarModule(componentData, parent, configGroup)
|
||||
{
|
||||
|
@ -51,28 +50,21 @@ KonqSidebar_Tree::KonqSidebar_Tree(const KComponentData &componentData, QWidget
|
|||
|
||||
connect(tree,SIGNAL(createNewWindow(const KUrl &, const KParts::OpenUrlArguments &, const KParts::BrowserArguments &)),
|
||||
this,SIGNAL(createNewWindow(const KUrl &, const KParts::OpenUrlArguments &, const KParts::BrowserArguments &)));
|
||||
|
||||
connect(tree, SIGNAL(popupMenu(QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)),
|
||||
this, SIGNAL(popupMenu(QPoint,KFileItemList,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)));
|
||||
|
||||
connect(tree,SIGNAL(enableAction( const char *, bool )),
|
||||
this,SIGNAL(enableAction( const char *, bool)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
KonqSidebar_Tree::~KonqSidebar_Tree(){}
|
||||
KonqSidebarOldTreeModule::~KonqSidebarOldTreeModule(){}
|
||||
|
||||
QWidget *KonqSidebar_Tree::getWidget() { return widget; }
|
||||
QWidget *KonqSidebarOldTreeModule::getWidget() { return widget; }
|
||||
|
||||
void KonqSidebar_Tree::handleURL(const KUrl &url)
|
||||
void KonqSidebarOldTreeModule::handleURL(const KUrl &url)
|
||||
{
|
||||
emit started( 0 );
|
||||
tree->followURL( url );
|
||||
emit completed();
|
||||
}
|
||||
|
||||
void KonqSidebar_Tree::cut()
|
||||
void KonqSidebarOldTreeModule::cut()
|
||||
{
|
||||
QMimeData* mimeData = new QMimeData;
|
||||
if ( static_cast<KonqSidebarTreeItem*>(tree->selectedItem())->populateMimeData( mimeData, true ) )
|
||||
|
@ -81,22 +73,29 @@ void KonqSidebar_Tree::cut()
|
|||
delete mimeData;
|
||||
}
|
||||
|
||||
void KonqSidebar_Tree::copy()
|
||||
void KonqSidebarOldTreeModule::copy()
|
||||
{
|
||||
kDebug();
|
||||
QMimeData* mimeData = new QMimeData;
|
||||
if ( static_cast<KonqSidebarTreeItem*>(tree->selectedItem())->populateMimeData( mimeData, false ) )
|
||||
if ( static_cast<KonqSidebarTreeItem*>(tree->selectedItem())->populateMimeData( mimeData, false ) ) {
|
||||
kDebug() << "setting" << mimeData->formats();
|
||||
QApplication::clipboard()->setMimeData( mimeData );
|
||||
else
|
||||
} else
|
||||
delete mimeData;
|
||||
}
|
||||
|
||||
void KonqSidebar_Tree::paste()
|
||||
void KonqSidebarOldTreeModule::paste()
|
||||
{
|
||||
// Not implemented. Would be for pasting into the toplevel.
|
||||
kDebug() << "not implemented. Didn't think it would be called - tell me (David Faure)";
|
||||
}
|
||||
|
||||
void KonqSidebarOldTreeModule::pasteToSelection()
|
||||
{
|
||||
if (tree->currentItem())
|
||||
tree->currentItem()->paste();
|
||||
}
|
||||
|
||||
|
||||
class KonqSidebarTreePlugin : public KonqSidebarPlugin
|
||||
{
|
||||
public:
|
||||
|
@ -110,7 +109,7 @@ public:
|
|||
const QVariant& unused)
|
||||
{
|
||||
Q_UNUSED(unused);
|
||||
return new KonqSidebar_Tree(componentData, parent, desktopname, configGroup);
|
||||
return new KonqSidebarOldTreeModule(componentData, parent, desktopname, configGroup);
|
||||
}
|
||||
|
||||
virtual QList<QAction*> addNewActions(QObject* parent,
|
||||
|
@ -190,3 +189,4 @@ public:
|
|||
|
||||
K_PLUGIN_FACTORY(KonqSidebarTreePluginFactory, registerPlugin<KonqSidebarTreePlugin>(); )
|
||||
K_EXPORT_PLUGIN(KonqSidebarTreePluginFactory())
|
||||
#include "konqsidebar_oldtreemodule.moc"
|
|
@ -1,17 +1,17 @@
|
|||
#ifndef KONQSIDEBAR_TREE_H
|
||||
#define KONQSIDEBAR_TREE_H
|
||||
#ifndef KONQSIDEBAR_OLDTREEMODULE_H
|
||||
#define KONQSIDEBAR_OLDTREEMODULE_H
|
||||
|
||||
#include <konqsidebarplugin.h>
|
||||
|
||||
class KonqSidebarTree;
|
||||
|
||||
class KonqSidebar_Tree: public KonqSidebarModule
|
||||
class KonqSidebarOldTreeModule : public KonqSidebarModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KonqSidebar_Tree(const KComponentData &componentData, QWidget *parent,
|
||||
KonqSidebarOldTreeModule(const KComponentData &componentData, QWidget *parent,
|
||||
const QString &desktopName_, const KConfigGroup& configGroup);
|
||||
~KonqSidebar_Tree();
|
||||
~KonqSidebarOldTreeModule();
|
||||
virtual QWidget *getWidget();
|
||||
protected:
|
||||
class QWidget *widget;
|
||||
|
@ -21,8 +21,7 @@ protected Q_SLOTS:
|
|||
void copy();
|
||||
void cut();
|
||||
void paste();
|
||||
Q_SIGNALS:
|
||||
void enableAction( const char * name, bool enabled );
|
||||
void pasteToSelection();
|
||||
};
|
||||
|
||||
#endif // KONQSIDEBAR_TREE_H
|
||||
#endif // KONQSIDEBAR_TREEMODULE_H
|
Loading…
Reference in a new issue