Changeset View
Changeset View
Standalone View
Standalone View
addons/snippets/snippetview.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 73 | for ( int j = 0; j < model->rowCount(index); j++ ) { | |||
---|---|---|---|---|---|
76 | if ( ! snippet ) { | 76 | if ( ! snippet ) { | ||
77 | continue; | 77 | continue; | ||
78 | } | 78 | } | ||
79 | snippet->registerActionForView(widget); | 79 | snippet->registerActionForView(widget); | ||
80 | } | 80 | } | ||
81 | } | 81 | } | ||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | SnippetView::SnippetView(KateSnippetGlobal* plugin, QWidget* parent) | 84 | SnippetView::SnippetView(KateSnippetGlobal* plugin, KTextEditor::MainWindow *mainWindow, QWidget* parent) | ||
85 | : QWidget(parent), Ui::SnippetViewBase(), m_plugin(plugin) | 85 | : QWidget(parent), Ui::SnippetViewBase(), m_plugin(plugin) | ||
86 | { | 86 | { | ||
87 | Ui::SnippetViewBase::setupUi(this); | 87 | Ui::SnippetViewBase::setupUi(this); | ||
88 | 88 | | |||
89 | setWindowTitle(i18n("Snippets")); | 89 | setWindowTitle(i18n("Snippets")); | ||
90 | setWindowIcon(QIcon::fromTheme(QStringLiteral("document-new"), windowIcon())); | 90 | setWindowIcon(QIcon::fromTheme(QStringLiteral("document-new"), windowIcon())); | ||
91 | 91 | | |||
92 | snippetTree->setContextMenuPolicy( Qt::CustomContextMenu ); | 92 | snippetTree->setContextMenuPolicy( Qt::CustomContextMenu ); | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
138 | m_getNewStuffAction = new QAction(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")), i18n("Get New Snippets"), this); | 138 | m_getNewStuffAction = new QAction(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")), i18n("Get New Snippets"), this); | ||
139 | m_getNewStuffAction->setVisible(newStuffAllowed); | 139 | m_getNewStuffAction->setVisible(newStuffAllowed); | ||
140 | connect(m_getNewStuffAction, &QAction::triggered, this, &SnippetView::slotGHNS); | 140 | connect(m_getNewStuffAction, &QAction::triggered, this, &SnippetView::slotGHNS); | ||
141 | addAction(m_getNewStuffAction); | 141 | addAction(m_getNewStuffAction); | ||
142 | 142 | | |||
143 | connect(snippetTree->selectionModel(), &QItemSelectionModel::selectionChanged, this, &SnippetView::validateActions); | 143 | connect(snippetTree->selectionModel(), &QItemSelectionModel::selectionChanged, this, &SnippetView::validateActions); | ||
144 | validateActions(); | 144 | validateActions(); | ||
145 | 145 | | |||
146 | connect(snippetTree->model(), &QAbstractItemModel::rowsInserted, this, [this]() { setupActionsForWindow(this); }); | 146 | connect(snippetTree->model(), &QAbstractItemModel::rowsInserted, this, [this, mainWindow]() { setupActionsForWindow(mainWindow->window()); }); | ||
147 | 147 | | |||
148 | m_proxy->setDynamicSortFilter(true); | 148 | m_proxy->setDynamicSortFilter(true); | ||
149 | m_proxy->sort(0, Qt::AscendingOrder); | 149 | m_proxy->sort(0, Qt::AscendingOrder); | ||
150 | } | 150 | } | ||
151 | 151 | | |||
152 | void SnippetView::validateActions() | 152 | void SnippetView::validateActions() | ||
153 | { | 153 | { | ||
154 | QStandardItem* item = currentItem(); | 154 | QStandardItem* item = currentItem(); | ||
▲ Show 20 Lines • Show All 224 Lines • Show Last 20 Lines |