Browse files

fixed #63 Razor launcher should access history on arrow up/down

  • Loading branch information...
1 parent 0254536 commit 461994bf21426e92b86b14c24bd1488637a9bac7 @pvanek pvanek committed Mar 30, 2012
View
10 razorqt-runner/commanditemmodel.cpp
@@ -86,6 +86,10 @@ void CommandItemModel::addHistoryCommand(const QString &command)
mSourceModel->addHistoryCommand(command);
}
+void CommandItemModel::clearHistory()
+{
+ mSourceModel->clearHistory();
+}
/************************************************
@@ -292,6 +296,12 @@ void CommandSourceItemModel::rebuild()
emit layoutChanged();
}
+void CommandSourceItemModel::clearHistory()
+{
+ mHistoryProvider->clearHistory();
+ reset();
+}
+
/************************************************
View
2 razorqt-runner/commanditemmodel.h
@@ -56,6 +56,7 @@ class CommandSourceItemModel: public QAbstractListModel
QPersistentModelIndex customCommandIndex() const { return mCustomCommandIndex; }
public slots:
void rebuild();
+ void clearHistory();
private:
QList<CommandProvider*> mProviders;
@@ -87,6 +88,7 @@ class CommandItemModel: public QSortFilterProxyModel
public slots:
void rebuild();
+ void clearHistory();
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
View
4 razorqt-runner/dialog.cpp
@@ -88,6 +88,10 @@ Dialog::Dialog(QWidget *parent) :
QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure razor-runner"), this);
connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog()));
addAction(a);
+
+ a = new QAction(XdgIcon::fromTheme("edit-clear-history"), tr("Clear razor-runner History"), this);
+ connect(a, SIGNAL(triggered()), mCommandItemModel, SLOT(clearHistory()));
+ addAction(a);
setContextMenuPolicy(Qt::ActionsContextMenu);
// End of popup menu ........................
View
6 razorqt-runner/providers.cpp
@@ -337,7 +337,11 @@ void HistoryProvider::AddCommand(const QString &command)
}
}
-
+void HistoryProvider::clearHistory()
+{
+ clear();
+ mHistoryFile->clear();
+}
/************************************************
View
1 razorqt-runner/providers.h
@@ -167,6 +167,7 @@ class HistoryProvider: public CommandProvider
virtual ~HistoryProvider();
void AddCommand(const QString &command);
+ void clearHistory();
private:
QSettings *mHistoryFile;

0 comments on commit 461994b

Please sign in to comment.