Commit de55c41c authored by Pablo Rauzy's avatar Pablo Rauzy Committed by Christoph Cullmann
Browse files

fixing oversimplifications

parent dd11e707
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KeyboardMacroWidget</class>
<widget class="QDialog" name="KeyboardMacroWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>370</width>
<height>190</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="lblFilter">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Enter command to &amp;pipe selected text through:</string>
</property>
<property name="buddy">
<cstring>filterBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="KHistoryComboBox" name="filterBox"/>
</item>
<item>
<widget class="QCheckBox" name="newDoc">
<property name="text">
<string>Open results in a new document</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="copyResult">
<property name="toolTip">
<string>Copy the result to clipboard leaving a document unchanged.</string>
</property>
<property name="text">
<string>Copy the result instead of pasting it</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mergeOutput">
<property name="toolTip">
<string>If checked, an output from STDOUT and STDERR will be merged and no errors will be reported.
Otherwise, STDERR will be displayed as a passive message.</string>
</property>
<property name="text">
<string>Merge STDOUT and STDERR</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KHistoryComboBox</class>
<extends>KComboBox</extends>
<header>khistorycombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>KeyboardMacroWidget</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>177</x>
<y>136</y>
</hint>
<hint type="destinationlabel">
<x>182</x>
<y>118</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>KeyboardMacroWidget</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>326</x>
<y>141</y>
</hint>
<hint type="destinationlabel">
<x>358</x>
<y>117</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -5,8 +5,8 @@
#include "plugin_katekeyboardmacro.h"
#include <ktexteditor/editor.h>
#include <ktexteditor/message.h>
#include <KTextEditor/Editor>
#include <KTextEditor/Message>
#include <KLocalizedString>
#include <QAction>
......@@ -14,12 +14,8 @@
#include <KActionCollection>
#include <KPluginFactory>
#include <KSharedConfig>
#include <KXMLGUIFactory>
#include <QApplication>
#include <QClipboard>
#include <iostream>
K_PLUGIN_FACTORY_WITH_JSON(KeyboardMacroPluginFactory, "keyboardmacroplugin.json", registerPlugin<PluginKateKeyboardMacro>();)
......@@ -38,9 +34,10 @@ PluginKateKeyboardMacro::~PluginKateKeyboardMacro()
delete m_runCommand;
}
QObject *PluginKateKeyboardMacro::createView(KTextEditor::MainWindow *)
QObject *PluginKateKeyboardMacro::createView(KTextEditor::MainWindow *mainWindow)
{
return nullptr;
m_mainWindow = mainWindow;
return new PluginViewKateKeyboardMacro(this, mainWindow);
}
bool PluginKateKeyboardMacro::record(KTextEditor::View *)
......@@ -173,10 +170,10 @@ PluginViewKateKeyboardMacro::PluginViewKateKeyboardMacro(PluginKateKeyboardMacro
connect(rec, &QAction::triggered, plugin, &PluginKateKeyboardMacro::slotRecord);
// create run action
QAction *exec = actionCollection()->addAction(QStringLiteral("run_macro"));
exec->setText(i18n("&Run Macro"));
actionCollection()->setDefaultShortcut(exec, Qt::CTRL | Qt::ALT | Qt::Key_K);
connect(exec, &QAction::triggered, plugin, &PluginKateKeyboardMacro::slotRun);
QAction *run = actionCollection()->addAction(QStringLiteral("run_macro"));
run->setText(i18n("&Run Macro"));
actionCollection()->setDefaultShortcut(run, Qt::CTRL | Qt::ALT | Qt::Key_K);
connect(run, &QAction::triggered, plugin, &PluginKateKeyboardMacro::slotRun);
// register us at the UI
mainwindow->guiFactory()->addClient(this);
......
......@@ -8,7 +8,6 @@
#include <KTextEditor/Application>
#include <KTextEditor/Command>
#include <KTextEditor/Document>
#include <KTextEditor/MainWindow>
#include <KTextEditor/Plugin>
#include <KTextEditor/View>
......@@ -28,13 +27,15 @@ public:
~PluginKateKeyboardMacro() override;
virtual QObject *createView(KTextEditor::MainWindow *mainWindow) override;
QObject *createView(KTextEditor::MainWindow *mainWindow) override;
bool record(KTextEditor::View *view);
bool run(KTextEditor::View *view);
bool isRecording();
private:
KTextEditor::MainWindow *m_mainWindow;
bool m_recording = false;
QString m_macro;
......
Supports Markdown
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