libs: deal with TODOs related to KonqOperations

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-09-23 14:58:11 +03:00
parent ce73514ea0
commit 7bb060f0cf
3 changed files with 14 additions and 59 deletions

View file

@ -1441,7 +1441,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
m_model->setData(index, data);
}
KonqOperations* op = KonqOperations::renameV2(this, oldUrl, newName);
KonqOperations* op = KonqOperations::rename(this, oldUrl, newName);
if (op && !newNameExistsAlready) {
// Only connect the renamingFailed signal if there is no item with the new name
// in the model yet, see bug 328262.
@ -1582,7 +1582,7 @@ void DolphinView::applyModeToView()
void DolphinView::pasteToUrl(const KUrl& url)
{
KonqOperations* op = KonqOperations::doPasteV2(this, url);
KonqOperations* op = KonqOperations::doPaste(this, url);
if (op) {
m_clearSelectionBeforeSelectingNewItems = true;
m_markFirstNewlySelectedItemAsCurrent = true;

View file

@ -133,12 +133,7 @@ KIO::SimpleJob* KonqOperations::mkdir( QWidget *parent, const KUrl & url )
return job;
}
void KonqOperations::doPaste( QWidget * parent, const KUrl & destUrl, const QPoint &pos )
{
(void) KonqOperations::doPasteV2( parent, destUrl, pos );
}
KonqOperations *KonqOperations::doPasteV2(QWidget *parent, const KUrl &destUrl, const QPoint &pos)
KonqOperations *KonqOperations::doPaste( QWidget * parent, const KUrl & destUrl, const QPoint &pos )
{
QClipboard *clipboard = QApplication::clipboard();
const QMimeData *data = clipboard->mimeData();
@ -723,12 +718,7 @@ static QString translatePath( QString path ) // krazy:exclude=passbyvalue
return path;
}
void KonqOperations::rename( QWidget * parent, const KUrl & oldurl, const KUrl& newurl )
{
renameV2(parent, oldurl, newurl);
}
KonqOperations *KonqOperations::renameV2( QWidget * parent, const KUrl & oldurl, const KUrl& newurl )
KonqOperations *KonqOperations::rename( QWidget * parent, const KUrl & oldurl, const KUrl& newurl )
{
kDebug(1203) << "oldurl=" << oldurl << " newurl=" << newurl;
if ( oldurl == newurl )
@ -850,17 +840,12 @@ void KonqOperations::slotResult(KJob *job)
deleteLater();
}
void KonqOperations::rename( QWidget * parent, const KUrl & oldurl, const QString & name )
{
renameV2(parent, oldurl, name);
}
KonqOperations *KonqOperations::renameV2( QWidget * parent, const KUrl & oldurl, const QString & name )
KonqOperations *KonqOperations::rename( QWidget * parent, const KUrl & oldurl, const QString & name )
{
KUrl newurl( oldurl );
newurl.setPath( oldurl.directory( KUrl::AppendTrailingSlash ) + name );
kDebug(1203) << "KonqOperations::rename("<<name<<") called. newurl=" << newurl;
return renameV2( parent, oldurl, newurl );
return rename( parent, oldurl, newurl );
}
// Duplicated in libkfile's KDirOperator

View file

@ -25,13 +25,14 @@
#include <kurl.h>
#include <konq_export.h>
#include <kio/job.h>
#include <QtCore/QObject>
#include <QtGui/qevent.h>
#include <QtGui/QWidget>
class KJob;
namespace KIO { class Job; class SimpleJob; struct CopyInfo; }
#include <QWidget>
class KFileItem;
class KFileItemListProperties;
@ -108,30 +109,24 @@ public:
* after the slot returns.
*
* @return The KonqOperations object
*
* @since 4.3
*/
static KonqOperations *doDrop( const KFileItem & destItem, const KUrl & destUrl, QDropEvent * ev, QWidget * parent,
const QList<QAction*> &userActions );
/**
* Paste the clipboard contents
*/
static void doPaste( QWidget * parent, const KUrl & destUrl, const QPoint &pos = QPoint() );
/**
* Paste the clipboard contents
*
* @return The KonqOperations object
* @since 4.10
*
* @todo TODO KDE 5,0 - Merge doPaste and doPasteV2
*/
static KonqOperations *doPasteV2(QWidget * parent, const KUrl & destUrl, const QPoint &pos = QPoint());
static KonqOperations *doPaste( QWidget * parent, const KUrl & destUrl, const QPoint &pos = QPoint() );
/**
* Returns the state of the paste action:
* first is whether the action should be enabled
* second is the text for the action
*
* @since 4.3
*/
static QPair<bool, QString> pasteInfo(const KUrl& targetUrl);
@ -180,14 +175,6 @@ public:
*/
static void statUrl( const KUrl & url, const QObject *receiver, const char *member, QWidget* parent );
/**
* Do a renaming.
* @param parent the parent widget, passed to KonqOperations ctor
* @param oldurl the current url of the file to be renamed
* @param name the new name for the file. Shouldn't include '/'.
*/
static void rename( QWidget * parent, const KUrl & oldurl, const QString & name );
/**
* Do a renaming.
* @param parent the parent widget, passed to KonqOperations ctor
@ -195,21 +182,8 @@ public:
* @param name the new name for the file. Shouldn't include '/'.
*
* @return The KonqOperations object
* @since 4.11
*
* @todo TODO KDE 5.0 - Merge rename and renameV2
*/
static KonqOperations *renameV2( QWidget * parent, const KUrl & oldurl, const QString & name );
/**
* Do a renaming.
* @param parent the parent widget, passed to KonqOperations ctor
* @param oldurl the current url of the file to be renamed
* @param newurl the new url for the file
* Use this version if the other one wouldn't work :) (e.g. because name could
* be a relative path, including a '/').
*/
static void rename( QWidget * parent, const KUrl & oldurl, const KUrl & newurl );
static KonqOperations *rename( QWidget * parent, const KUrl & oldurl, const QString & name );
/**
* Do a renaming.
@ -220,11 +194,8 @@ public:
* be a relative path, including a '/').
*
* @return The KonqOperations object
* @since 4.11
*
* @todo TODO KDE 5.0 - Merge rename and renameV2
*/
static KonqOperations *renameV2( QWidget * parent, const KUrl & oldurl, const KUrl & newurl );
static KonqOperations *rename( QWidget * parent, const KUrl & oldurl, const KUrl & newurl );
enum ConfirmationType { DEFAULT_CONFIRMATION, SKIP_CONFIRMATION, FORCE_CONFIRMATION };
/**
@ -249,6 +220,7 @@ public:
/**
* Returns the position where the drop occurred.
*
* @since 4.3
*/
QPoint dropPosition() const;
@ -312,8 +284,6 @@ private:
KIOPasteInfo * m_pasteInfo;
};
#include <kio/job.h>
/// Restore multiple trashed files
class KonqMultiRestoreJob : public KIO::Job
{