[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeutils/ark
From: Raphael Kubo da Costa <kubito () gmail ! com>
Date: 2010-10-17 23:28:00
Message-ID: 20101017232800.977AFAC89A () svn ! kde ! org
[Download RAW message or body]
SVN commit 1186932 by rkcosta:
Replace all the remaining cases of QPointer usage with QWeakPointer.
M +16 -15 app/batchextract.cpp
M +4 -4 app/mainwindow.cpp
M +8 -8 kerfuffle/addtoarchive.cpp
M +12 -12 kerfuffle/queries.cpp
M +11 -11 part/part.cpp
--- trunk/KDE/kdeutils/ark/app/batchextract.cpp #1186931:1186932
@@ -43,8 +43,8 @@
#include <QDir>
#include <QFileInfo>
-#include <QPointer>
#include <QTimer>
+#include <QWeakPointer>
BatchExtract::BatchExtract()
: m_autoSubfolder(false),
@@ -252,34 +252,35 @@
bool BatchExtract::showExtractDialog()
{
- QPointer<Kerfuffle::ExtractionDialog> dialog = new \
Kerfuffle::ExtractionDialog(); + QWeakPointer<Kerfuffle::ExtractionDialog> dialog \
= + new Kerfuffle::ExtractionDialog;
if (m_inputs.size() > 1) {
- dialog->batchModeOption();
+ dialog.data()->batchModeOption();
}
- dialog->setAutoSubfolder(autoSubfolder());
- dialog->setCurrentUrl(destinationFolder());
- dialog->setPreservePaths(preservePaths());
+ dialog.data()->setAutoSubfolder(autoSubfolder());
+ dialog.data()->setCurrentUrl(destinationFolder());
+ dialog.data()->setPreservePaths(preservePaths());
if (m_inputs.size() == 1) {
if (m_inputs.at(0)->isSingleFolderArchive()) {
- dialog->setSingleFolderArchive(true);
+ dialog.data()->setSingleFolderArchive(true);
}
- dialog->setSubfolder(m_inputs.at(0)->subfolderName());
+ dialog.data()->setSubfolder(m_inputs.at(0)->subfolderName());
}
- if (!dialog->exec()) {
- delete dialog;
+ if (!dialog.data()->exec()) {
+ delete dialog.data();
return false;
}
- setAutoSubfolder(dialog->autoSubfolders());
- setDestinationFolder(dialog->destinationDirectory().pathOrUrl());
- setOpenDestinationAfterExtraction(dialog->openDestinationAfterExtraction());
- setPreservePaths(dialog->preservePaths());
+ setAutoSubfolder(dialog.data()->autoSubfolders());
+ setDestinationFolder(dialog.data()->destinationDirectory().pathOrUrl());
+ setOpenDestinationAfterExtraction(dialog.data()->openDestinationAfterExtraction());
+ setPreservePaths(dialog.data()->preservePaths());
- delete dialog;
+ delete dialog.data();
return true;
}
--- trunk/KDE/kdeutils/ark/app/mainwindow.cpp #1186931:1186932
@@ -41,7 +41,7 @@
#include <QDragEnterEvent>
#include <QDragMoveEvent>
-#include <QPointer>
+#include <QWeakPointer>
static bool isValidArchiveDrag(const QMimeData *data)
{
@@ -179,14 +179,14 @@
{
saveMainWindowSettings(KGlobal::config()->group(QLatin1String("MainWindow")));
- QPointer<KEditToolBar> dlg = new KEditToolBar(factory(), this);
- dlg->exec();
+ QWeakPointer<KEditToolBar> dlg = new KEditToolBar(factory(), this);
+ dlg.data()->exec();
createGUI(m_part);
applyMainWindowSettings(KGlobal::config()->group(QLatin1String("MainWindow")));
- delete dlg;
+ delete dlg.data();
}
void MainWindow::openArchive()
--- trunk/KDE/kdeutils/ark/kerfuffle/addtoarchive.cpp #1186931:1186932
@@ -40,8 +40,8 @@
#include <QFileInfo>
#include <QDir>
-#include <QPointer>
#include <QTimer>
+#include <QWeakPointer>
namespace Kerfuffle
{
@@ -76,23 +76,23 @@
bool AddToArchive::showAddDialog(void)
{
- QPointer<Kerfuffle::AddDialog> dialog = new Kerfuffle::AddDialog(
+ QWeakPointer<Kerfuffle::AddDialog> dialog = new Kerfuffle::AddDialog(
m_inputs, // itemsToAdd
KUrl(m_firstPath), // startDir
QLatin1String( "" ), // filter
NULL, // parent
NULL); // widget
- bool ret = dialog->exec();
+ bool ret = dialog.data()->exec();
if (ret) {
- kDebug() << "Returned URL:" << dialog->selectedUrl();
- kDebug() << "Returned mime:" << dialog->currentMimeFilter();
- setFilename(dialog->selectedUrl());
- setMimeType(dialog->currentMimeFilter());
+ kDebug() << "Returned URL:" << dialog.data()->selectedUrl();
+ kDebug() << "Returned mime:" << dialog.data()->currentMimeFilter();
+ setFilename(dialog.data()->selectedUrl());
+ setMimeType(dialog.data()->currentMimeFilter());
}
- delete dialog;
+ delete dialog.data();
return ret;
}
--- trunk/KDE/kdeutils/ark/kerfuffle/queries.cpp #1186931:1186932
@@ -33,7 +33,7 @@
#include <kio/renamedialog.h>
#include <QApplication>
-#include <QPointer>
+#include <QWeakPointer>
namespace Kerfuffle
{
@@ -91,19 +91,19 @@
sourceUrl.cleanPath();
destUrl.cleanPath();
- QPointer<KIO::RenameDialog> dialog = new KIO::RenameDialog(
+ QWeakPointer<KIO::RenameDialog> dialog = new KIO::RenameDialog(
NULL,
i18n("File already exists"),
sourceUrl,
destUrl,
mode);
- dialog->exec();
+ dialog.data()->exec();
- m_data[QLatin1String( "newFilename" )] = dialog->newDestUrl().pathOrUrl();
+ m_data[QLatin1String("newFilename")] = dialog.data()->newDestUrl().pathOrUrl();
- setResponse(dialog->result());
+ setResponse(dialog.data()->result());
- delete dialog;
+ delete dialog.data();
QApplication::restoreOverrideCursor();
}
@@ -173,23 +173,23 @@
// at the moment (#231974)
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
- QPointer<KPasswordDialog> dlg = new KPasswordDialog;
- dlg->setPrompt(i18n("The archive '%1' is password protected. Please enter the \
password to extract the file.", m_data.value(QLatin1String( "archiveFilename" \
)).toString())); + QWeakPointer<KPasswordDialog> dlg = new KPasswordDialog;
+ dlg.data()->setPrompt(i18n("The archive '%1' is password protected. Please enter \
the password to extract the file.", m_data.value(QLatin1String( "archiveFilename" \
)).toString()));
if (m_data.value(QLatin1String( "incorrectTryAgain" )).toBool()) {
- dlg->showErrorMessage(i18n("Incorrect password, please try again."), \
KPasswordDialog::PasswordError); + \
dlg.data()->showErrorMessage(i18n("Incorrect password, please try again."), \
KPasswordDialog::PasswordError); }
- if (!dlg->exec()) {
+ if (!dlg.data()->exec()) {
setResponse(false);
} else {
- m_data[QLatin1String( "password" )] = dlg->password();
+ m_data[QLatin1String("password")] = dlg.data()->password();
setResponse(true);
}
QApplication::restoreOverrideCursor();
- delete dlg;
+ delete dlg.data();
}
QString PasswordNeededQuery::password()
--- trunk/KDE/kdeutils/ark/part/part.cpp #1186931:1186932
@@ -60,10 +60,10 @@
#include <QMenu>
#include <QMimeData>
#include <QMouseEvent>
-#include <QPointer>
#include <QSplitter>
#include <QTimer>
#include <QVBoxLayout>
+#include <QWeakPointer>
#include <QtDBus/QtDBus>
using namespace Kerfuffle;
@@ -578,28 +578,28 @@
return;
}
- QPointer<Kerfuffle::ExtractionDialog> dialog = new \
Kerfuffle::ExtractionDialog(); + QWeakPointer<Kerfuffle::ExtractionDialog> dialog \
= new Kerfuffle::ExtractionDialog;
if (m_view->selectionModel()->selectedRows().count() > 0) {
- dialog->setShowSelectedFiles(true);
+ dialog.data()->setShowSelectedFiles(true);
}
- dialog->setSingleFolderArchive(isSingleFolderArchive());
- dialog->setSubfolder(detectSubfolder());
+ dialog.data()->setSingleFolderArchive(isSingleFolderArchive());
+ dialog.data()->setSubfolder(detectSubfolder());
- dialog->setCurrentUrl(QFileInfo(m_model->archive()->fileName()).path());
+ dialog.data()->setCurrentUrl(QFileInfo(m_model->archive()->fileName()).path());
- if (dialog->exec()) {
+ if (dialog.data()->exec()) {
//this is done to update the quick extract menu
updateActions();
- m_destinationDirectory = dialog->destinationDirectory().pathOrUrl();
+ m_destinationDirectory = dialog.data()->destinationDirectory().pathOrUrl();
QVariantList files;
//if the user has chosen to extract only selected entries, fetch these
//from the listview
- if (!dialog->extractAllFiles()) {
+ if (!dialog.data()->extractAllFiles()) {
files = selectedFilesWithChildren();
}
@@ -607,7 +607,7 @@
Kerfuffle::ExtractionOptions options;
- if (dialog->preservePaths())
+ if (dialog.data()->preservePaths())
options[QLatin1String( "PreservePaths" )] = true;
ExtractJob *job = m_model->extractFiles(files, m_destinationDirectory, \
options); @@ -619,7 +619,7 @@
job->start();
}
- delete dialog;
+ delete dialog.data();
}
QList<QVariant> Part::selectedFilesWithChildren()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic