[app] Restore current folder at startup
This commit is contained in:
parent
93b07f46fa
commit
ca2f50cb4b
3 changed files with 48 additions and 23 deletions
|
@ -1,32 +1,34 @@
|
|||
/*
|
||||
Copyright (C) 2015 Jolla Ltd.
|
||||
Copyright (C) 2015-2016 Jolla Ltd.
|
||||
Contact: Slava Monich <slava.monich@jolla.com>
|
||||
|
||||
You may use this file under the terms of BSD license as follows:
|
||||
You may use this file under the terms of the BSD license as follows:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Jolla Ltd nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Jolla Ltd nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
@ -67,10 +69,21 @@ Item {
|
|||
Shelf {
|
||||
id: shelfModel
|
||||
property bool needDummyItem: dragInProgress && dragItem.shelfIndex !== shelfView.shelfIndex
|
||||
property bool _completed // Received Component.onCompleted
|
||||
onNeedDummyItemChanged: if (needDummyItem) hasDummyItem = true
|
||||
editMode: shelfView.editMode
|
||||
onRelativePathChanged: longStartTimer.restart()
|
||||
onPathChanged: globalSettings.currentFolder = path
|
||||
onPathChanged: {
|
||||
if (globalSettings.currentStorage === device && _completed) {
|
||||
globalSettings.currentFolder = path
|
||||
}
|
||||
}
|
||||
onDeviceChanged: {
|
||||
if (device === globalSettings.currentStorage) {
|
||||
relativePath = globalSettings.relativePath
|
||||
}
|
||||
}
|
||||
Component.onCompleted: _completed = true
|
||||
}
|
||||
|
||||
BooksPathModel {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Jolla Ltd.
|
||||
* Copyright (C) 2015-2016 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of the BSD license as follows:
|
||||
|
@ -14,7 +14,7 @@
|
|||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Nemo Mobile nor the names of its contributors
|
||||
* * Neither the name of Jolla Ltd nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
|
@ -330,6 +330,14 @@ BooksSettings::setInvertColors(
|
|||
iInvertColorsConf->set(aValue);
|
||||
}
|
||||
|
||||
QString
|
||||
BooksSettings::relativePath() const
|
||||
{
|
||||
QString rel;
|
||||
BooksStorageManager::instance()->storageForPath(currentFolder(), &rel);
|
||||
return rel;
|
||||
}
|
||||
|
||||
QString
|
||||
BooksSettings::currentFolder() const
|
||||
{
|
||||
|
@ -351,6 +359,7 @@ BooksSettings::onCurrentFolderChanged()
|
|||
Q_EMIT currentStorageChanged();
|
||||
}
|
||||
Q_EMIT currentFolderChanged();
|
||||
Q_EMIT relativePathChanged();
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Jolla Ltd.
|
||||
* Copyright (C) 2015-2016 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of the BSD license as follows:
|
||||
|
@ -14,7 +14,7 @@
|
|||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Nemo Mobile nor the names of its contributors
|
||||
* * Neither the name of Jolla Ltd nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
|
@ -51,6 +51,7 @@ class BooksSettings : public QObject
|
|||
Q_PROPERTY(QObject* currentBook READ currentBook WRITE setCurrentBook NOTIFY currentBookChanged)
|
||||
Q_PROPERTY(QString currentFolder READ currentFolder WRITE setCurrentFolder NOTIFY currentFolderChanged)
|
||||
Q_PROPERTY(QString currentStorage READ currentStorage NOTIFY currentStorageChanged)
|
||||
Q_PROPERTY(QString relativePath READ relativePath NOTIFY relativePathChanged)
|
||||
Q_PROPERTY(QColor primaryPageToolColor READ primaryPageToolColor CONSTANT)
|
||||
Q_PROPERTY(QColor highlightPageToolColor READ highlightPageToolColor NOTIFY invertColorsChanged)
|
||||
class TextStyle;
|
||||
|
@ -82,6 +83,7 @@ public:
|
|||
QObject* currentBook() const;
|
||||
void setCurrentBook(QObject* aBook);
|
||||
|
||||
QString relativePath() const;
|
||||
QString currentFolder() const;
|
||||
void setCurrentFolder(QString aValue);
|
||||
|
||||
|
@ -97,6 +99,7 @@ Q_SIGNALS:
|
|||
void currentBookChanged();
|
||||
void currentFolderChanged();
|
||||
void currentStorageChanged();
|
||||
void relativePathChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onFontSizeValueChanged();
|
||||
|
|
Loading…
Reference in a new issue