Commit 2e74fe39 authored by Harald Hvaal's avatar Harald Hvaal
Browse files

Cleaned up dropping of files so that it is handled completely in the kpart,...

Cleaned up dropping of files so that it is handled completely in the kpart, with proper gui notifications on error

svn path=/trunk/KDE/kdeutils/ark/; revision=847693
parent be694a78
......@@ -417,11 +417,7 @@ QMimeData * ArchiveModel::mimeData ( const QModelIndexList & indexes ) const
bool ArchiveModel::dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent )
{
kDebug (1601) << "Fuckings";
//if (action == Qt::IgnoreAction)
//return true;
if (!data->hasFormat("text/uri-list"))
if (!data->hasUrls())
return false;
QStringList paths;
......@@ -429,10 +425,8 @@ bool ArchiveModel::dropMimeData ( const QMimeData * data, Qt::DropAction action,
paths << url.path();
}
//TODO: if this job fails, no error will be displayeed to the user!!!
addFiles(paths)->start();
emit droppedFiles(paths);
kDebug() << "Yes it's a drop!" << paths;
return true;
}
......
......@@ -75,7 +75,7 @@ class ArchiveModel: public QAbstractItemModel
void loadingFinished();
void extractionFinished( bool success );
void error( const QString& error, const QString& details );
void startedAddFilesJob ( KJob *job);
void droppedFiles(const QStringList& files);
private slots:
void slotNewEntry( const ArchiveEntry& entry );
......
......@@ -85,6 +85,8 @@ Part::Part( QWidget *parentWidget, QObject *parent, const QStringList& args )
this, SLOT( slotLoadingStarted() ) );
connect( m_model, SIGNAL( loadingFinished() ),
this, SLOT( slotLoadingFinished() ) );
connect( m_model, SIGNAL( droppedFiles(const QStringList&) ),
this, SLOT( slotAddFiles(const QStringList&) ) );
connect( m_model, SIGNAL( error( const QString&, const QString& ) ),
this, SLOT( slotError( const QString&, const QString& ) ) );
......@@ -540,10 +542,9 @@ void Part::adjustColumns( const QModelIndex & topleft, const QModelIndex& bottom
} while (firstColumn < lastColumn);
}
void Part::slotAddFiles()
void Part::slotAddFiles(const QStringList& filesToAdd)
{
kDebug( 1601 ) ;
QStringList filesToAdd = KFileDialog::getOpenFileNames( KUrl( "kfiledialog:///ArkAddFiles" ), QString(), widget(), i18n( "Add Files" ) );
if ( !filesToAdd.isEmpty() )
{
......@@ -554,6 +555,15 @@ void Part::slotAddFiles()
}
}
void Part::slotAddFiles()
{
kDebug( 1601 ) ;
QStringList filesToAdd = KFileDialog::getOpenFileNames( KUrl( "kfiledialog:///ArkAddFiles" ), QString(), widget(), i18n( "Add Files" ) );
slotAddFiles( filesToAdd);
}
void Part::slotAddDir()
{
kDebug( 1601 ) ;
......
......@@ -68,6 +68,7 @@ class Part: public KParts::ReadWritePart, public Interface
void slotExtractionDone( KJob* );
void slotQuickExtractFiles(QAction*);
void slotAddFiles();
void slotAddFiles(const QStringList& files);
void slotAddDir();
void slotAddFilesDone( KJob* );
void slotDeleteFiles();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment