mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +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;
|
||||
}
|
||||
|
||||
MainWindow* window = new MainWindow;
|
||||
window->restore(1);
|
||||
MainWindow* window = new MainWindow();
|
||||
if (!window->loadPart()) {
|
||||
delete window;
|
||||
return -1;
|
||||
}
|
||||
window->restore(1);
|
||||
} else { //new ark window (no restored session)
|
||||
// open any given URLs
|
||||
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
||||
|
@ -194,7 +194,7 @@ int main(int argc, char **argv)
|
|||
|
||||
batchJob->start();
|
||||
} else {
|
||||
MainWindow *window = new MainWindow;
|
||||
MainWindow *window = new MainWindow();
|
||||
if (!window->loadPart()) { // if loading the part fails
|
||||
delete window;
|
||||
return -1;
|
||||
|
|
|
@ -50,7 +50,8 @@ static bool isValidArchiveDrag(const QMimeData *data)
|
|||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *)
|
||||
: KParts::MainWindow()
|
||||
: KParts::MainWindow(),
|
||||
m_part(nullptr)
|
||||
{
|
||||
setXMLFile(QLatin1String( "arkui.rc" ));
|
||||
|
||||
|
@ -72,7 +73,7 @@ MainWindow::~MainWindow()
|
|||
}
|
||||
guiFactory()->removeClient(m_part);
|
||||
delete m_part;
|
||||
m_part = 0;
|
||||
m_part = nullptr;
|
||||
}
|
||||
|
||||
void MainWindow::dragEnterEvent(QDragEnterEvent * event)
|
||||
|
@ -261,3 +262,15 @@ void MainWindow::newArchive()
|
|||
m_openArgs.metaData().remove(QLatin1String( "showExtractDialog" ));
|
||||
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
|
||||
public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
bool loadPart();
|
||||
|
||||
|
@ -53,6 +53,11 @@ private slots:
|
|||
void editKeyBindings();
|
||||
void editToolbars();
|
||||
|
||||
protected:
|
||||
// KMainWindow reimplementations
|
||||
void saveProperties(KConfigGroup &group) final;
|
||||
void readProperties(const KConfigGroup &group) final;
|
||||
|
||||
private:
|
||||
void setupActions();
|
||||
|
||||
|
|
|
@ -29,7 +29,10 @@
|
|||
#include <KParts/StatusBarExtension>
|
||||
#include <KTempDir>
|
||||
|
||||
#include <QtCore/qabstractitemmodel.h>
|
||||
#include <QModelIndex>
|
||||
#include <QAction>
|
||||
#include <QSplitter>
|
||||
#include <QTreeView>
|
||||
|
||||
class ArchiveModel;
|
||||
class InfoPanel;
|
||||
|
@ -39,10 +42,6 @@ class KAboutData;
|
|||
class KAction;
|
||||
class KJob;
|
||||
|
||||
#include <QAction>
|
||||
#include <QSplitter>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace Ark
|
||||
{
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue