Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/plugins/folder/viewpropertiesmenu.cpp
Show All 22 Lines | |||||
23 | 23 | | |||
24 | #include <KDirModel> | 24 | #include <KDirModel> | ||
25 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
26 | 26 | | |||
27 | ViewPropertiesMenu::ViewPropertiesMenu(QObject *parent) : QObject(parent) | 27 | ViewPropertiesMenu::ViewPropertiesMenu(QObject *parent) : QObject(parent) | ||
28 | { | 28 | { | ||
29 | m_menu = new QMenu(); | 29 | m_menu = new QMenu(); | ||
30 | 30 | | |||
31 | m_arrangementMenu = m_menu->addMenu(i18n("Arrange In")); | | |||
32 | m_arrangement = new QActionGroup(this); | | |||
33 | connect(m_arrangement, &QActionGroup::triggered, this, &ViewPropertiesMenu::arrangementChanged); | | |||
34 | QAction *action = m_arrangementMenu->addAction(i18n("Rows")); | | |||
35 | action->setCheckable(true); | | |||
36 | action->setData(0); | | |||
37 | m_arrangement->addAction(action); | | |||
38 | action = m_arrangementMenu->addAction(i18n("Columns")); | | |||
39 | action->setData(1); | | |||
40 | action->setCheckable(true); | | |||
41 | m_arrangement->addAction(action); | | |||
42 | | ||||
43 | m_alignmentMenu = m_menu->addMenu(i18n("Align")); | | |||
44 | m_alignment = new QActionGroup(this); | | |||
45 | connect(m_alignment, &QActionGroup::triggered, this, &ViewPropertiesMenu::alignmentChanged); | | |||
46 | action = m_alignmentMenu->addAction(i18n("Left")); | | |||
47 | action->setCheckable(true); | | |||
48 | action->setData(0); | | |||
49 | m_alignment->addAction(action); | | |||
50 | action = m_alignmentMenu->addAction(i18n("Right")); | | |||
51 | action->setCheckable(true); | | |||
52 | action->setData(1); | | |||
53 | m_alignment->addAction(action); | | |||
54 | | ||||
55 | QMenu *menu = m_menu->addMenu(i18n("Sort By")); | 31 | QMenu *menu = m_menu->addMenu(i18n("Sort By")); | ||
56 | m_sortMode = new QActionGroup(this); | 32 | m_sortMode = new QActionGroup(this); | ||
57 | connect(m_sortMode, &QActionGroup::triggered, this, &ViewPropertiesMenu::sortModeChanged); | 33 | connect(m_sortMode, &QActionGroup::triggered, this, &ViewPropertiesMenu::sortModeChanged); | ||
58 | action = menu->addAction(i18n("Unsorted")); | 34 | QAction *action = menu->addAction(i18n("Unsorted")); | ||
59 | action->setCheckable(true); | 35 | action->setCheckable(true); | ||
60 | action->setData(-1); | 36 | action->setData(-1); | ||
61 | m_sortMode->addAction(action); | 37 | m_sortMode->addAction(action); | ||
62 | action = menu->addAction(i18n("Name")); | 38 | action = menu->addAction(i18n("Name")); | ||
63 | action->setCheckable(true); | 39 | action->setCheckable(true); | ||
64 | action->setData(int(KDirModel::Name)); | 40 | action->setData(int(KDirModel::Name)); | ||
65 | m_sortMode->addAction(action); | 41 | m_sortMode->addAction(action); | ||
66 | action = menu->addAction(i18n("Size")); | 42 | action = menu->addAction(i18n("Size")); | ||
Show All 22 Lines | |||||
89 | }; | 65 | }; | ||
90 | for (int i = 0; i < iconSizes.count(); ++i) { | 66 | for (int i = 0; i < iconSizes.count(); ++i) { | ||
91 | action = m_iconSizeMenu->addAction(iconSizes.at(i)); | 67 | action = m_iconSizeMenu->addAction(iconSizes.at(i)); | ||
92 | action->setCheckable(true); | 68 | action->setCheckable(true); | ||
93 | action->setData(i); | 69 | action->setData(i); | ||
94 | m_iconSize->addAction(action); | 70 | m_iconSize->addAction(action); | ||
95 | } | 71 | } | ||
96 | 72 | | |||
73 | m_arrangementMenu = m_menu->addMenu(i18n("Arrange In")); | ||||
74 | m_arrangement = new QActionGroup(this); | ||||
75 | connect(m_arrangement, &QActionGroup::triggered, this, &ViewPropertiesMenu::arrangementChanged); | ||||
76 | action = m_arrangementMenu->addAction(i18n("Rows")); | ||||
77 | action->setCheckable(true); | ||||
78 | action->setData(0); | ||||
79 | m_arrangement->addAction(action); | ||||
80 | action = m_arrangementMenu->addAction(i18n("Columns")); | ||||
81 | action->setData(1); | ||||
82 | action->setCheckable(true); | ||||
83 | m_arrangement->addAction(action); | ||||
84 | | ||||
85 | m_alignmentMenu = m_menu->addMenu(i18n("Align")); | ||||
86 | m_alignment = new QActionGroup(this); | ||||
87 | connect(m_alignment, &QActionGroup::triggered, this, &ViewPropertiesMenu::alignmentChanged); | ||||
88 | action = m_alignmentMenu->addAction(i18n("Left")); | ||||
89 | action->setCheckable(true); | ||||
90 | action->setData(0); | ||||
91 | m_alignment->addAction(action); | ||||
92 | action = m_alignmentMenu->addAction(i18n("Right")); | ||||
93 | action->setCheckable(true); | ||||
94 | action->setData(1); | ||||
95 | m_alignment->addAction(action); | ||||
96 | | ||||
97 | m_previews = m_menu->addAction(QIcon::fromTheme(QStringLiteral("view-preview")), i18n("Show Previews"), this, &ViewPropertiesMenu::previewsChanged); | 97 | m_previews = m_menu->addAction(QIcon::fromTheme(QStringLiteral("view-preview")), i18n("Show Previews"), this, &ViewPropertiesMenu::previewsChanged); | ||
98 | m_previews->setCheckable(true); | 98 | m_previews->setCheckable(true); | ||
99 | 99 | | |||
100 | m_locked = m_menu->addAction(QIcon::fromTheme(QStringLiteral("lock")), i18n("Locked"), this, &ViewPropertiesMenu::lockedChanged); | 100 | m_locked = m_menu->addAction(QIcon::fromTheme(QStringLiteral("lock")), i18n("Locked"), this, &ViewPropertiesMenu::lockedChanged); | ||
101 | m_locked->setCheckable(true); | 101 | m_locked->setCheckable(true); | ||
102 | } | 102 | } | ||
103 | 103 | | |||
104 | ViewPropertiesMenu::~ViewPropertiesMenu() | 104 | ViewPropertiesMenu::~ViewPropertiesMenu() | ||
▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines |