Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit b2ae7ecf authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Folder View] Add checkbox for toggling previews

There's all sorts of icon view options in the context menu, so add a quick toggle for Previews like Dolphin has it.

Differential Revision: https://phabricator.kde.org/D15269
parent d4839a25
......@@ -109,6 +109,10 @@ Item {
plasmoid.configuration.alignment = alignment;
}
onPreviewsChanged: {
plasmoid.configuration.previews = previews;
}
onLockedChanged: {
plasmoid.configuration.locked = locked;
}
......@@ -132,6 +136,7 @@ Item {
Component.onCompleted: {
arrangement = plasmoid.configuration.arrangement;
alignment = plasmoid.configuration.alignment;
previews = plasmoid.configuration.previews;
locked = plasmoid.configuration.locked;
sortMode = plasmoid.configuration.sortMode;
sortDesc = plasmoid.configuration.sortDesc;
......
......@@ -94,6 +94,9 @@ ViewPropertiesMenu::ViewPropertiesMenu(QObject *parent) : QObject(parent)
m_iconSize->addAction(action);
}
m_previews = m_menu->addAction(QIcon::fromTheme(QStringLiteral("view-preview")), i18n("Show Previews"), this, &ViewPropertiesMenu::previewsChanged);
m_previews->setCheckable(true);
m_locked = m_menu->addAction(i18n("Locked"), this, SIGNAL(lockedChanged()));
m_locked->setCheckable(true);
}
......@@ -186,6 +189,18 @@ void ViewPropertiesMenu::setAlignment(int alignment)
}
}
bool ViewPropertiesMenu::previews() const
{
return m_previews->isChecked();
}
void ViewPropertiesMenu::setPreviews(bool previews)
{
if (m_previews->isChecked() != previews) {
m_previews->setChecked(previews);
}
}
bool ViewPropertiesMenu::locked() const
{
return m_locked->isChecked();
......
......@@ -38,6 +38,7 @@ class FOLDERPLUGIN_TESTS_EXPORT ViewPropertiesMenu : public QObject
Q_PROPERTY(int arrangement READ arrangement WRITE setArrangement NOTIFY arrangementChanged)
Q_PROPERTY(int alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
Q_PROPERTY(bool previews READ previews WRITE setPreviews NOTIFY previewsChanged)
Q_PROPERTY(bool locked READ locked WRITE setLocked NOTIFY lockedChanged)
Q_PROPERTY(int sortMode READ sortMode WRITE setSortMode NOTIFY sortModeChanged)
Q_PROPERTY(bool sortDesc READ sortDesc WRITE setSortDesc NOTIFY sortDescChanged)
......@@ -65,6 +66,9 @@ class FOLDERPLUGIN_TESTS_EXPORT ViewPropertiesMenu : public QObject
int alignment() const;
void setAlignment(int alignment);
bool previews() const;
void setPreviews(bool previews);
bool locked() const;
void setLocked(bool locked);
......@@ -86,6 +90,7 @@ class FOLDERPLUGIN_TESTS_EXPORT ViewPropertiesMenu : public QObject
void showIconSizeActionsChanged();
void arrangementChanged() const;
void alignmentChanged() const;
void previewsChanged() const;
void lockedChanged() const;
void sortModeChanged() const;
void sortDescChanged() const;
......@@ -103,6 +108,7 @@ class FOLDERPLUGIN_TESTS_EXPORT ViewPropertiesMenu : public QObject
QActionGroup *m_iconSize;
QAction *m_sortDesc;
QAction *m_sortDirsFirst;
QAction *m_previews;
QAction *m_locked;
};
......
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