mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
ark: implement session restoration
altough there are bits for that in main() the URL the part loaded was not saved and restored when that had to happen, now it is Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
39b4708812
commit
200504c967
4 changed files with 31 additions and 14 deletions
|
@ -124,12 +124,12 @@ int main(int argc, char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow* window = new MainWindow;
|
MainWindow* window = new MainWindow();
|
||||||
window->restore(1);
|
|
||||||
if (!window->loadPart()) {
|
if (!window->loadPart()) {
|
||||||
delete window;
|
delete window;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
window->restore(1);
|
||||||
} else { //new ark window (no restored session)
|
} else { //new ark window (no restored session)
|
||||||
// open any given URLs
|
// open any given URLs
|
||||||
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
||||||
|
@ -194,7 +194,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
batchJob->start();
|
batchJob->start();
|
||||||
} else {
|
} else {
|
||||||
MainWindow *window = new MainWindow;
|
MainWindow *window = new MainWindow();
|
||||||
if (!window->loadPart()) { // if loading the part fails
|
if (!window->loadPart()) { // if loading the part fails
|
||||||
delete window;
|
delete window;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -50,7 +50,8 @@ static bool isValidArchiveDrag(const QMimeData *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *)
|
MainWindow::MainWindow(QWidget *)
|
||||||
: KParts::MainWindow()
|
: KParts::MainWindow(),
|
||||||
|
m_part(nullptr)
|
||||||
{
|
{
|
||||||
setXMLFile(QLatin1String( "arkui.rc" ));
|
setXMLFile(QLatin1String( "arkui.rc" ));
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ MainWindow::~MainWindow()
|
||||||
}
|
}
|
||||||
guiFactory()->removeClient(m_part);
|
guiFactory()->removeClient(m_part);
|
||||||
delete m_part;
|
delete m_part;
|
||||||
m_part = 0;
|
m_part = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::dragEnterEvent(QDragEnterEvent * event)
|
void MainWindow::dragEnterEvent(QDragEnterEvent * event)
|
||||||
|
@ -261,3 +262,15 @@ void MainWindow::newArchive()
|
||||||
m_openArgs.metaData().remove(QLatin1String( "showExtractDialog" ));
|
m_openArgs.metaData().remove(QLatin1String( "showExtractDialog" ));
|
||||||
m_openArgs.metaData().remove(QLatin1String( "createNewArchive" ));
|
m_openArgs.metaData().remove(QLatin1String( "createNewArchive" ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::saveProperties(KConfigGroup &group)
|
||||||
|
{
|
||||||
|
if (m_part) {
|
||||||
|
group.writePathEntry("URL", m_part->url().url());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::readProperties(const KConfigGroup &group)
|
||||||
|
{
|
||||||
|
openUrl(group.readPathEntry("URL", QString()));
|
||||||
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class MainWindow: public KParts::MainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = 0);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
bool loadPart();
|
bool loadPart();
|
||||||
|
|
||||||
|
@ -53,6 +53,11 @@ private slots:
|
||||||
void editKeyBindings();
|
void editKeyBindings();
|
||||||
void editToolbars();
|
void editToolbars();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// KMainWindow reimplementations
|
||||||
|
void saveProperties(KConfigGroup &group) final;
|
||||||
|
void readProperties(const KConfigGroup &group) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupActions();
|
void setupActions();
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,10 @@
|
||||||
#include <KParts/StatusBarExtension>
|
#include <KParts/StatusBarExtension>
|
||||||
#include <KTempDir>
|
#include <KTempDir>
|
||||||
|
|
||||||
#include <QtCore/qabstractitemmodel.h>
|
#include <QModelIndex>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QSplitter>
|
||||||
|
#include <QTreeView>
|
||||||
|
|
||||||
class ArchiveModel;
|
class ArchiveModel;
|
||||||
class InfoPanel;
|
class InfoPanel;
|
||||||
|
@ -39,10 +42,6 @@ class KAboutData;
|
||||||
class KAction;
|
class KAction;
|
||||||
class KJob;
|
class KJob;
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QSplitter>
|
|
||||||
#include <QTreeView>
|
|
||||||
|
|
||||||
namespace Ark
|
namespace Ark
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue