Commit e02e7236 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa
Browse files

Make it possible to close Ark after a successful extraction.

A future improvement could be hiding the option if in batch
extraction mode.

Patch written by Matthew Leach, thanks a lot!

CCMAIL: matthew@theleachfamily.co.uk
FEATURE: 135112

svn path=/trunk/KDE/kdeutils/ark/; revision=1071450
parent 7bf2a546
......@@ -133,6 +133,7 @@ bool MainWindow::loadPart()
connect(m_part, SIGNAL(busy()), this, SLOT(updateActions()));
connect(m_part, SIGNAL(ready()), this, SLOT(updateActions()));
connect(m_part, SIGNAL(quit()), this, SLOT(quit()));
return true;
}
......
......@@ -9,6 +9,10 @@
<label>Open destination folder after extraction</label>
<default>false</default>
</entry>
<entry name="closeAfterExtraction" type="Bool">
<label>Close Ark after extraction</label>
<default>false</default>
</entry>
<entry name="preservePaths" type="Bool">
<label>Preserve paths when extracting</label>
<default>true</default>
......
......@@ -76,6 +76,7 @@ ExtractionDialog::ExtractionDialog(QWidget *parent)
void ExtractionDialog::loadSettings()
{
setOpenDestinationFolderAfterExtraction(ArkSettings::openDestinationFolderAfterExtraction());
setCloseAfterExtraction(ArkSettings::closeAfterExtraction());
setPreservePaths(ArkSettings::preservePaths());
}
......@@ -191,6 +192,11 @@ void ExtractionDialog::setOpenDestinationFolderAfterExtraction(bool value)
m_ui->openFolderCheckBox->setChecked(value);
}
void ExtractionDialog::setCloseAfterExtraction(bool value)
{
m_ui->closeAfterExtraction->setChecked(value);
}
void ExtractionDialog::setPreservePaths(bool value)
{
m_ui->preservePaths->setChecked(value);
......@@ -206,6 +212,11 @@ bool ExtractionDialog::openDestinationAfterExtraction() const
return m_ui->openFolderCheckBox->isChecked();
}
bool ExtractionDialog::closeAfterExtraction() const
{
return m_ui->closeAfterExtraction->isChecked();
}
KUrl ExtractionDialog::destinationDirectory() const
{
if (extractToSubfolder()) {
......@@ -218,6 +229,7 @@ KUrl ExtractionDialog::destinationDirectory() const
void ExtractionDialog::writeSettings()
{
ArkSettings::setOpenDestinationFolderAfterExtraction(openDestinationAfterExtraction());
ArkSettings::setCloseAfterExtraction(closeAfterExtraction());
ArkSettings::setPreservePaths(preservePaths());
ArkSettings::self()->writeConfig();
}
......
......@@ -49,10 +49,12 @@ public:
void setPreservePaths(bool);
void batchModeOption();
void setOpenDestinationFolderAfterExtraction(bool);
void setCloseAfterExtraction(bool);
void setAutoSubfolder(bool value);
bool extractAllFiles() const;
bool openDestinationAfterExtraction() const;
bool closeAfterExtraction() const;
bool extractToSubfolder() const;
bool autoSubfolders() const;
bool preservePaths() const;
......
......@@ -112,7 +112,7 @@
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="5" column="0" >
<item row="6" column="0" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
......@@ -133,13 +133,20 @@
</widget>
</item>
<item row="3" column="0" >
<widget class="QCheckBox" name="closeAfterExtraction" >
<property name="text" >
<string>Close &amp;Ark after extraction</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QCheckBox" name="preservePaths" >
<property name="text" >
<string>&amp;Preserve paths when extracting</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<item row="5" column="0" >
<widget class="QCheckBox" name="autoSubfolders" >
<property name="text" >
<string>&amp;Automatically create subfolders</string>
......
......@@ -635,6 +635,10 @@ void Part::slotExtractionDone(KJob* job)
KRun::runUrl(destinationFolder, "inode/directory", widget());
}
if (ArkSettings::closeAfterExtraction()) {
emit quit();
}
}
}
......
......@@ -90,6 +90,7 @@ private slots:
signals:
void busy();
void ready();
void quit();
private:
void setupView();
......
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