Commit 3f6a5566 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Allow removal of all user commands, Ubuntu bug #913725.

parent 0692fc7c
...@@ -282,5 +282,10 @@ QList<MiscConfig::MenuCommand> CommandsTableModel::getCommandList() const ...@@ -282,5 +282,10 @@ QList<MiscConfig::MenuCommand> CommandsTableModel::getCommandList() const
cmdList.append(*it); cmdList.append(*it);
} }
} }
if (cmdList.isEmpty()) {
// Make sure that their is at least one entry, so that new entries can
// be added.
cmdList.append(MiscConfig::MenuCommand());
}
return cmdList; return cmdList;
} }
...@@ -131,7 +131,7 @@ void FileList::updateCurrentSelection() ...@@ -131,7 +131,7 @@ void FileList::updateCurrentSelection()
*/ */
void FileList::contextMenu(const QModelIndex& index, const QPoint& pos) void FileList::contextMenu(const QModelIndex& index, const QPoint& pos)
{ {
if (index.isValid() && !ConfigStore::s_miscCfg.m_contextMenuCommands.empty()) { if (index.isValid()) {
QMenu menu(this); QMenu menu(this);
menu.addAction(i18n("&Expand all"), this, SLOT(expandAll())); menu.addAction(i18n("&Expand all"), this, SLOT(expandAll()));
menu.addAction(i18n("&Collapse all"), this, SLOT(collapseAll())); menu.addAction(i18n("&Collapse all"), this, SLOT(collapseAll()));
...@@ -145,7 +145,10 @@ void FileList::contextMenu(const QModelIndex& index, const QPoint& pos) ...@@ -145,7 +145,10 @@ void FileList::contextMenu(const QModelIndex& index, const QPoint& pos)
it = ConfigStore::s_miscCfg.m_contextMenuCommands.begin(); it = ConfigStore::s_miscCfg.m_contextMenuCommands.begin();
it != ConfigStore::s_miscCfg.m_contextMenuCommands.end(); it != ConfigStore::s_miscCfg.m_contextMenuCommands.end();
++it) { ++it) {
menu.addAction((*it).getName()); QString name((*it).getName());
if (!name.isEmpty()) {
menu.addAction(name);
}
++id; ++id;
} }
connect(&menu, SIGNAL(triggered(QAction*)), this, SLOT(executeAction(QAction*))); connect(&menu, SIGNAL(triggered(QAction*)), this, SLOT(executeAction(QAction*)));
......
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