Changeset View
Changeset View
Standalone View
Standalone View
klipper/configdialog.cpp
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | 81 | #endif | |||
---|---|---|---|---|---|
91 | onSelectionChanged(); | 91 | onSelectionChanged(); | ||
92 | } | 92 | } | ||
93 | 93 | | |||
94 | void ActionsWidget::setActionList(const ActionList& list) | 94 | void ActionsWidget::setActionList(const ActionList& list) | ||
95 | { | 95 | { | ||
96 | qDeleteAll( m_actionList ); | 96 | qDeleteAll( m_actionList ); | ||
97 | m_actionList.clear(); | 97 | m_actionList.clear(); | ||
98 | 98 | | |||
99 | foreach (ClipAction* action, list) { | 99 | for (ClipAction* action : list) { | ||
100 | if (!action) { | 100 | if (!action) { | ||
101 | qCDebug(KLIPPER_LOG) << "action is null!"; | 101 | qCDebug(KLIPPER_LOG) << "action is null!"; | ||
102 | continue; | 102 | continue; | ||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | // make a copy for us to work with from now on | 105 | // make a copy for us to work with from now on | ||
106 | m_actionList.append( new ClipAction( *action ) ); | 106 | m_actionList.append( new ClipAction( *action ) ); | ||
107 | } | 107 | } | ||
108 | 108 | | |||
109 | updateActionListView(); | 109 | updateActionListView(); | ||
110 | } | 110 | } | ||
111 | 111 | | |||
112 | void ActionsWidget::updateActionListView() | 112 | void ActionsWidget::updateActionListView() | ||
113 | { | 113 | { | ||
114 | m_ui.kcfg_ActionList->clear(); | 114 | m_ui.kcfg_ActionList->clear(); | ||
115 | 115 | | |||
116 | foreach (ClipAction* action, m_actionList) { | 116 | for (ClipAction* action : qAsConst(m_actionList)) { | ||
117 | if (!action) { | 117 | if (!action) { | ||
118 | qCDebug(KLIPPER_LOG) << "action is null!"; | 118 | qCDebug(KLIPPER_LOG) << "action is null!"; | ||
119 | continue; | 119 | continue; | ||
120 | } | 120 | } | ||
121 | 121 | | |||
122 | QTreeWidgetItem *item = new QTreeWidgetItem; | 122 | QTreeWidgetItem *item = new QTreeWidgetItem; | ||
123 | updateActionItem( item, action ); | 123 | updateActionItem( item, action ); | ||
124 | 124 | | |||
Show All 13 Lines | 136 | if ( !item || !action ) { | |||
138 | return; | 138 | return; | ||
139 | } | 139 | } | ||
140 | 140 | | |||
141 | // clear children if any | 141 | // clear children if any | ||
142 | item->takeChildren(); | 142 | item->takeChildren(); | ||
143 | item->setText( 0, action->regExp() ); | 143 | item->setText( 0, action->regExp() ); | ||
144 | item->setText( 1, action->description() ); | 144 | item->setText( 1, action->description() ); | ||
145 | 145 | | |||
146 | foreach (const ClipCommand& command, action->commands()) { | 146 | const auto commands = action->commands(); | ||
147 | for (const ClipCommand& command : commands) { | ||||
147 | QStringList cmdProps; | 148 | QStringList cmdProps; | ||
148 | cmdProps << command.command << command.description; | 149 | cmdProps << command.command << command.description; | ||
149 | QTreeWidgetItem *child = new QTreeWidgetItem(item, cmdProps); | 150 | QTreeWidgetItem *child = new QTreeWidgetItem(item, cmdProps); | ||
150 | child->setIcon(0, QIcon::fromTheme(command.icon.isEmpty() ? QStringLiteral("system-run") : command.icon)); | 151 | child->setIcon(0, QIcon::fromTheme(command.icon.isEmpty() ? QStringLiteral("system-run") : command.icon)); | ||
151 | } | 152 | } | ||
152 | } | 153 | } | ||
153 | 154 | | |||
154 | void ActionsWidget::setExcludedWMClasses(const QStringList& excludedWMClasses) | 155 | void ActionsWidget::setExcludedWMClasses(const QStringList& excludedWMClasses) | ||
155 | { | 156 | { | ||
156 | m_exclWMClasses = excludedWMClasses; | 157 | m_exclWMClasses = excludedWMClasses; | ||
157 | } | 158 | } | ||
158 | 159 | | |||
159 | QStringList ActionsWidget::excludedWMClasses() const | 160 | QStringList ActionsWidget::excludedWMClasses() const | ||
160 | { | 161 | { | ||
161 | return m_exclWMClasses; | 162 | return m_exclWMClasses; | ||
162 | } | 163 | } | ||
163 | 164 | | |||
164 | ActionList ActionsWidget::actionList() const | 165 | ActionList ActionsWidget::actionList() const | ||
165 | { | 166 | { | ||
166 | // return a copy of our action list | 167 | // return a copy of our action list | ||
167 | ActionList list; | 168 | ActionList list; | ||
168 | foreach( ClipAction* action, m_actionList ) { | 169 | for ( ClipAction* action : qAsConst(m_actionList) ) { | ||
169 | if ( !action ) { | 170 | if ( !action ) { | ||
170 | qCDebug(KLIPPER_LOG) << "action is null"; | 171 | qCDebug(KLIPPER_LOG) << "action is null"; | ||
171 | continue; | 172 | continue; | ||
172 | } | 173 | } | ||
173 | list.append( new ClipAction( *action ) ); | 174 | list.append( new ClipAction( *action ) ); | ||
174 | } | 175 | } | ||
175 | 176 | | |||
176 | return list; | 177 | return list; | ||
▲ Show 20 Lines • Show All 243 Lines • Show Last 20 Lines |