Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SDK
Lokalize
Commits
a0dc91dd
Commit
a0dc91dd
authored
Oct 12, 2021
by
Alexander Lohnau
💬
Browse files
Remove KRoss scripting
Task:
https://phabricator.kde.org/T11613
parent
ebeba788
Changes
12
Hide whitespace changes
Inline
Side-by-side
.kde-ci.yml
View file @
a0dc91dd
...
...
@@ -12,7 +12,6 @@ Dependencies:
'
frameworks/kconfig'
:
'
@stable'
'
frameworks/kcoreaddons'
:
'
@stable'
'
frameworks/kdoctools'
:
'
@stable'
'
frameworks/kross'
:
'
@stable'
'
frameworks/ksonnet'
:
'
@stable'
'
frameworks/kdbusaddons'
:
'
@stable'
'
frameworks/kcrash'
:
'
@stable'
CMakeLists.txt
View file @
a0dc91dd
...
...
@@ -23,7 +23,7 @@ include(ECMQtDeclareLoggingCategory)
find_package
(
Qt5
${
QT_MIN_VERSION
}
CONFIG REQUIRED Core DBus Widgets Sql
)
find_package
(
KF5
${
KF5_MIN_VERSION
}
REQUIRED I18n KIO XmlGui Notifications Config CoreAddons DocTools
Kross
Sonnet DBusAddons Crash
)
find_package
(
KF5
${
KF5_MIN_VERSION
}
REQUIRED I18n
TextWidgets
KIO XmlGui Notifications Config CoreAddons DocTools Sonnet DBusAddons Crash
)
add_definitions
(
-DQT_USE_QSTRINGBUILDER
...
...
src/CMakeLists.txt
View file @
a0dc91dd
...
...
@@ -86,9 +86,8 @@ set(liblokalize_SRCS
webquery/webqueryview.cpp
webquery/webquerycontroller.cpp
webquery/myactioncollectionview.cpp
languagetool/languagetoolresultjob.cpp
languagetool/languagetoolresultjob.cpp
languagetool/languagetoolmanager.cpp
languagetool/languagetoolparser.cpp
languagetool/languagetoolgrammarerror.cpp
...
...
@@ -182,13 +181,13 @@ qt5_add_dbus_adaptor(liblokalize_SRCS project/org.kde.lokalize.ProjectOverview.x
### Build intermediate library (will be used by unit tests) ###
add_library
(
liblokalize STATIC
${
liblokalize_SRCS
}
)
target_link_libraries
(
liblokalize
KF5::I18n
KF5::TextWidgets
KF5::KIOFileWidgets
KF5::ItemViews
KF5::Notifications
KF5::SonnetCore
KF5::SonnetUi
KF5::KrossCore
KF5::KrossUi
KF5::DBusAddons
KF5::Crash
Qt5::Sql
...
...
src/lokalizemainwindow.cpp
View file @
a0dc91dd
...
...
@@ -39,10 +39,10 @@
#include
<KStandardShortcut>
#include
<KRecentFilesAction>
#include
<KXMLGUIFactory>
#include
<kross/core/action.h>
#include
<QMenu>
#include
<QTabBar>
#include
<QActionGroup>
#include
<QMdiSubWindow>
#include
<QMdiArea>
...
...
@@ -64,7 +64,6 @@ LokalizeMainWindow::LokalizeMainWindow()
,
m_managerActions
(
new
QActionGroup
(
this
))
,
m_spareEditor
(
new
EditorTab
(
this
,
false
))
,
m_multiEditorAdaptor
(
new
MultiEditorAdaptor
(
m_spareEditor
))
,
m_projectScriptingPlugin
(
nullptr
)
{
m_spareEditor
->
hide
();
m_mdiArea
->
setViewMode
(
QMdiArea
::
TabbedView
);
...
...
@@ -164,22 +163,6 @@ void LokalizeMainWindow::slotSubWindowActivated(QMdiSubWindow* w)
EditorState
state
=
w
->
state
();
m_lastEditorState
=
state
.
dockWidgets
.
toBase64
();
}
/*
QMenu* projectActions=static_cast<QMenu*>(factory()->container("project_actions",this));
QList<QAction*> actionz=projectActions->actions();
int i=actionz.size();
//projectActions->menuAction()->setVisible(i);
//qCWarning(LOKALIZE_LOG)<<"adding object"<<actionz.at(0);
while(--i>=0)
{
disconnect(w, SIGNAL(signalNewEntryDisplayed()),actionz.at(i),SLOT(signalNewEntryDisplayed()));
//static_cast<Kross::Action*>(actionz.at(i))->addObject(static_cast<EditorWindow*>( editor )->adaptor(),"Editor",Kross::ChildrenInterface::AutoConnectSignals);
//static_cast<Kross::Action*>(actionz.at(i))->trigger();
}
}
*/
}
LokalizeSubwindowBase
*
editor
=
static_cast
<
LokalizeSubwindowBase2
*>
(
w
->
widget
());
...
...
@@ -192,20 +175,6 @@ void LokalizeMainWindow::slotSubWindowActivated(QMdiSubWindow* w)
m_lastEditorState
=
state
.
dockWidgets
.
toBase64
();
m_multiEditorAdaptor
->
setEditorTab
(
w
);
// connect(m_multiEditorAdaptor,SIGNAL(srcFileOpenRequested(QString,int)),this,SLOT(showTM()));
/*
QMenu* projectActions=static_cast<QMenu*>(factory()->container("project_actions",this));
QList<QAction*> actionz=projectActions->actions();
int i=actionz.size();
//projectActions->menuAction()->setVisible(i);
//qCWarning(LOKALIZE_LOG)<<"adding object"<<actionz.at(0);
while(--i>=0)
{
connect(w, SIGNAL(signalNewEntryDisplayed()),actionz.at(i),SLOT(signalNewEntryDisplayed()));
//static_cast<Kross::Action*>(actionz.at(i))->addObject(static_cast<EditorWindow*>( editor )->adaptor(),"Editor",Kross::ChildrenInterface::AutoConnectSignals);
//static_cast<Kross::Action*>(actionz.at(i))->trigger();
}*/
QTabBar
*
tw
=
m_mdiArea
->
findChild
<
QTabBar
*>
();
if
(
tw
)
tw
->
setTabToolTip
(
tw
->
currentIndex
(),
w
->
currentFilePath
());
...
...
@@ -746,8 +715,6 @@ void LokalizeMainWindow::projectLoaded()
}
projectSettingsChanged
();
QTimer
::
singleShot
(
0
,
this
,
&
LokalizeMainWindow
::
loadProjectScripts
);
}
void
LokalizeMainWindow
::
projectSettingsChanged
()
...
...
@@ -767,103 +734,6 @@ void LokalizeMainWindow::widgetTextCapture()
//#include "plugin.h"
#include
"mainwindowadaptor.h"
#include
<kross/core/actioncollection.h>
#include
<kross/core/manager.h>
using
namespace
Kross
;
class
MyScriptingPlugin
:
public
Kross
::
ScriptingPlugin
{
public:
MyScriptingPlugin
(
QObject
*
lokalize
,
QObject
*
editor
)
:
Kross
::
ScriptingPlugin
(
lokalize
)
{
addObject
(
lokalize
,
"Lokalize"
);
addObject
(
Project
::
instance
(),
"Project"
);
addObject
(
editor
,
"Editor"
);
setXMLFile
(
"scriptsui.rc"
,
true
);
}
~
MyScriptingPlugin
()
{}
};
#define PROJECTRCFILE "scripts.rc"
#define PROJECTRCFILEDIR Project::instance()->projectDir()+"/lokalize-scripts"
#define PROJECTRCFILEPATH Project::instance()->projectDir()+"/lokalize-scripts" "/" PROJECTRCFILE
//TODO be lazy creating scripts dir
ProjectScriptingPlugin
::
ProjectScriptingPlugin
(
QObject
*
lokalize
,
QObject
*
editor
)
:
Kross
::
ScriptingPlugin
(
Project
::
instance
()
->
kind
(),
PROJECTRCFILEPATH
,
Project
::
instance
()
->
kind
(),
lokalize
)
{
if
(
Project
::
instance
()
->
projectDir
().
isEmpty
())
return
;
QString
filepath
=
PROJECTRCFILEPATH
;
// Remove directory "scripts.rc" if it is empty. It could be
// mistakenly created by Lokalize 15.04.x.
if
(
QFileInfo
(
filepath
).
isDir
()
&&
!
QDir
().
rmdir
(
filepath
))
{
qCCritical
(
LOKALIZE_LOG
)
<<
"Failed to remove directory"
<<
filepath
<<
"to create scripting configuration file with at the same path. "
<<
"The directory may be not empty."
;
return
;
}
if
(
!
QFile
::
exists
(
filepath
))
{
QDir
().
mkdir
(
QFileInfo
(
filepath
).
dir
().
path
());
QFile
f
(
filepath
);
if
(
!
f
.
open
(
QIODevice
::
WriteOnly
))
return
;
QTextStream
out
(
&
f
);
out
<<
"<!-- see help for the syntax -->"
;
f
.
close
();
}
//qCWarning(LOKALIZE_LOG)<<Kross::Manager::self().hasInterpreterInfo("python");
addObject
(
lokalize
,
QLatin1String
(
"Lokalize"
),
ChildrenInterface
::
AutoConnectSignals
);
addObject
(
Project
::
instance
(),
QLatin1String
(
"Project"
),
ChildrenInterface
::
AutoConnectSignals
);
addObject
(
editor
,
QLatin1String
(
"Editor"
),
ChildrenInterface
::
AutoConnectSignals
);
setXMLFile
(
QLatin1String
(
"scriptsui.rc"
),
true
);
}
void
ProjectScriptingPlugin
::
setDOMDocument
(
const
QDomDocument
&
document
,
bool
merge
)
{
Kross
::
ScriptingPlugin
::
setDOMDocument
(
document
,
merge
);
QTimer
::
singleShot
(
0
,
this
,
&
ProjectScriptingPlugin
::
doAutoruns
);
}
void
ProjectScriptingPlugin
::
doAutoruns
()
{
Kross
::
ActionCollection
*
collection
=
Kross
::
Manager
::
self
().
actionCollection
()
->
collection
(
Project
::
instance
()
->
kind
());
if
(
!
collection
)
return
;
const
auto
collections
=
collection
->
collections
();
for
(
const
QString
&
collectionname
:
collections
)
{
Kross
::
ActionCollection
*
c
=
collection
->
collection
(
collectionname
);
if
(
!
c
->
isEnabled
())
continue
;
const
auto
actions
=
c
->
actions
();
for
(
Kross
::
Action
*
action
:
actions
)
{
if
(
action
->
property
(
"autorun"
).
toBool
())
action
->
trigger
();
if
(
action
->
property
(
"first-run"
).
toBool
()
&&
Project
::
local
()
->
firstRun
())
action
->
trigger
();
}
}
}
ProjectScriptingPlugin
::~
ProjectScriptingPlugin
()
{
Kross
::
ActionCollection
*
collection
=
Kross
::
Manager
::
self
().
actionCollection
()
->
collection
(
Project
::
instance
()
->
kind
());
if
(
!
collection
)
return
;
QString
scriptsrc
=
PROJECTRCFILE
;
QDir
rcdir
(
PROJECTRCFILEDIR
);
qCDebug
(
LOKALIZE_LOG
)
<<
rcdir
.
entryList
(
QStringList
(
"*.rc"
),
QDir
::
Files
);
const
auto
rcs
=
QDir
(
PROJECTRCFILEDIR
).
entryList
(
QStringList
(
"*.rc"
),
QDir
::
Files
);
for
(
const
QString
&
rc
:
rcs
)
if
(
rc
!=
scriptsrc
)
qCWarning
(
LOKALIZE_LOG
)
<<
rc
<<
collection
->
readXmlFile
(
rcdir
.
absoluteFilePath
(
rc
));
}
/*
void LokalizeMainWindow::checkForProjectAlreadyOpened()
...
...
@@ -888,10 +758,6 @@ void LokalizeMainWindow::registerDBusAdaptor()
QDBusConnection
::
sessionBus
().
registerObject
(
QLatin1String
(
"/ThisIsWhatYouWant"
),
this
);
//qCWarning(LOKALIZE_LOG)<<QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
#ifndef Q_OS_MAC
//TODO really fix!!!
guiFactory
()
->
addClient
(
new
MyScriptingPlugin
(
this
,
m_multiEditorAdaptor
));
#endif
//QMenu* projectActions=static_cast<QMenu*>(factory()->container("project_actions",this));
...
...
@@ -902,24 +768,6 @@ void LokalizeMainWindow::registerDBusAdaptor()
*/
}
void
LokalizeMainWindow
::
loadProjectScripts
()
{
if
(
m_projectScriptingPlugin
)
{
guiFactory
()
->
removeClient
(
m_projectScriptingPlugin
);
delete
m_projectScriptingPlugin
;
}
//a HACK to get new .rc files shown w/o requiring a restart
m_projectScriptingPlugin
=
new
ProjectScriptingPlugin
(
this
,
m_multiEditorAdaptor
);
//guiFactory()->addClient(m_projectScriptingPlugin);
//guiFactory()->removeClient(m_projectScriptingPlugin);
delete
m_projectScriptingPlugin
;
m_projectScriptingPlugin
=
new
ProjectScriptingPlugin
(
this
,
m_multiEditorAdaptor
);
guiFactory
()
->
addClient
(
m_projectScriptingPlugin
);
}
int
LokalizeMainWindow
::
lookupInTranslationMemory
(
DocPosition
::
Part
part
,
const
QString
&
text
)
{
TM
::
TMTab
*
w
=
showTM
();
...
...
src/lokalizemainwindow.h
View file @
a0dc91dd
...
...
@@ -29,7 +29,6 @@ class LokalizeMdiArea;
class
KRecentFilesAction
;
class
EditorTab
;
class
MultiEditorAdaptor
;
class
ProjectScriptingPlugin
;
class
FileSearchTab
;
namespace
TM
{
...
...
@@ -71,7 +70,6 @@ private Q_SLOTS:
void
applyToBeActiveSubWindow
();
void
projectLoaded
();
void
projectSettingsChanged
();
void
loadProjectScripts
();
void
editorClosed
(
QObject
*
obj
);
void
resetMultiEditorAdaptor
();
...
...
@@ -161,7 +159,6 @@ private:
//used for kross API
EditorTab
*
m_spareEditor
;
MultiEditorAdaptor
*
m_multiEditorAdaptor
;
ProjectScriptingPlugin
*
m_projectScriptingPlugin
;
//using QPointer switches it.value() to 0 before we get to destroyed() handler
//typedef QMap<QUrl, QPointer<QMdiSubWindow> > FileToEditor;
...
...
@@ -177,21 +174,6 @@ public Q_SLOTS:
void
activatePreviousSubWindow
();
};
#include
<kross/ui/plugin.h>
class
ProjectScriptingPlugin
:
public
Kross
::
ScriptingPlugin
{
Q_OBJECT
public:
ProjectScriptingPlugin
(
QObject
*
lokalize
,
QObject
*
editor
);
~
ProjectScriptingPlugin
();
void
setDOMDocument
(
const
QDomDocument
&
document
,
bool
merge
=
false
)
override
;
private
Q_SLOTS
:
void
doAutoruns
();
};
class
DelayedFileOpener
:
public
QObject
{
Q_OBJECT
...
...
src/prefs/prefs.cpp
View file @
a0dc91dd
...
...
@@ -34,9 +34,6 @@
#include
<KMessageBox>
#include
<KEditListWidget>
#include
<KConfigDialog>
#include
<kross/core/manager.h>
#include
<kross/core/actioncollection.h>
#include
<kross/ui/model.h>
#include
<QIcon>
#include
<QBoxLayout>
...
...
@@ -68,7 +65,6 @@ SettingsController* SettingsController::instance()
SettingsController
::
SettingsController
()
:
QObject
(
Project
::
instance
())
,
dirty
(
false
)
,
m_projectActionsView
(
nullptr
)
,
m_mainWindowPtr
(
nullptr
)
{}
...
...
@@ -172,29 +168,6 @@ void SettingsController::showSettingsDialog()
}
ScriptsView
::
ScriptsView
(
QWidget
*
parent
)
:
Kross
::
ActionCollectionView
(
parent
)
{
setAcceptDrops
(
true
);
}
void
ScriptsView
::
dragEnterEvent
(
QDragEnterEvent
*
event
)
{
if
(
!
event
->
mimeData
()
->
urls
().
isEmpty
()
&&
event
->
mimeData
()
->
urls
().
first
().
path
().
endsWith
(
QLatin1String
(
".rc"
)))
event
->
accept
();
}
void
ScriptsView
::
dropEvent
(
QDropEvent
*
event
)
{
Kross
::
ActionCollectionModel
*
scriptsModel
=
static_cast
<
Kross
::
ActionCollectionModel
*>
(
model
());
const
auto
urls
=
event
->
mimeData
()
->
urls
();
for
(
const
QUrl
&
url
:
urls
)
if
(
url
.
path
().
endsWith
(
QLatin1String
(
".rc"
)))
scriptsModel
->
rootCollection
()
->
readXmlFile
(
url
.
path
());
}
bool
SettingsController
::
ensureProjectIsLoaded
()
{
if
(
Project
::
instance
()
->
isLoaded
())
...
...
@@ -238,12 +211,6 @@ bool SettingsController::projectCreate()
if
(
path
.
isEmpty
())
return
false
;
if
(
m_projectActionsView
&&
m_projectActionsView
->
model
())
{
//ActionCollectionModel is known to be have bad for the usecase of reinitializing krossplugin
m_projectActionsView
->
model
()
->
deleteLater
();
m_projectActionsView
->
setModel
(
nullptr
);
}
//TODO ask-n-save
QDir
projectFolder
=
QFileInfo
(
path
).
absoluteDir
();
QString
projectId
=
projectFolder
.
dirName
();
...
...
@@ -264,12 +231,6 @@ void SettingsController::projectConfigure()
return
;
}
if
(
KConfigDialog
::
showDialog
(
"project_settings"
))
{
if
(
!
m_projectActionsView
->
model
())
m_projectActionsView
->
setModel
(
new
Kross
::
ActionCollectionModel
(
m_projectActionsView
,
Kross
::
Manager
::
self
().
actionCollection
()
->
collection
(
Project
::
instance
()
->
kind
())));
return
;
}
KConfigDialog
*
dialog
=
new
KConfigDialog
(
m_mainWindowPtr
,
"project_settings"
,
Project
::
instance
());
dialog
->
setFaceType
(
KPageDialog
::
List
);
...
...
@@ -332,20 +293,6 @@ void SettingsController::projectConfigure()
layout
->
setSpacing
(
6
);
layout
->
setContentsMargins
(
11
,
11
,
11
,
11
);
//m_projectActionsEditor=new Kross::ActionCollectionEditor(Kross::Manager::self().actionCollection()->collection(Project::instance()->projectID()),w);
m_projectActionsView
=
new
ScriptsView
(
w
);
layout
->
addWidget
(
m_projectActionsView
);
m_projectActionsView
->
setModel
(
new
Kross
::
ActionCollectionModel
(
w
,
Kross
::
Manager
::
self
().
actionCollection
()
->
collection
(
Project
::
instance
()
->
kind
())));
QHBoxLayout
*
btns
=
new
QHBoxLayout
();
layout
->
addLayout
(
btns
);
btns
->
addWidget
(
m_projectActionsView
->
createButton
(
w
,
"edit"
));
dialog
->
addPage
(
w
,
i18nc
(
"@title:tab"
,
"Scripts"
),
"preferences-system-windows-actions"
);
w
=
new
QWidget
(
dialog
);
Ui_prefs_project_local
ui_prefs_project_local
;
ui_prefs_project_local
.
setupUi
(
w
);
...
...
src/prefs/prefs.h
View file @
a0dc91dd
...
...
@@ -13,11 +13,6 @@
#include
<QLineEdit>
class
KEditListWidget
;
namespace
Kross
{
class
ActionCollectionView
;
}
/**
* Singleton that manages cfgs for Lokalize and projects
*/
...
...
@@ -58,7 +53,6 @@ Q_SIGNALS:
private:
KEditListWidget
*
m_scriptsRelPrefWidget
;
//HACK to get relative filenames in the project file
KEditListWidget
*
m_scriptsPrefWidget
;
Kross
::
ActionCollectionView
*
m_projectActionsView
;
QWidget
*
m_mainWindowPtr
;
private:
...
...
@@ -95,21 +89,6 @@ public Q_SLOTS:
void
setLangCode
(
int
);
};
#include
<kross/ui/view.h>
class
ScriptsView
:
public
Kross
::
ActionCollectionView
{
Q_OBJECT
public:
explicit
ScriptsView
(
QWidget
*
parent
);
// public Q_SLOTS:
// void addScsetText(const QString&);
void
dragEnterEvent
(
QDragEnterEvent
*
event
)
override
;
void
dropEvent
(
QDropEvent
*
event
)
override
;
};
void
writeUiState
(
const
char
*
elementName
,
const
QByteArray
&
);
QByteArray
readUiState
(
const
char
*
elementName
);
...
...
src/project/project.cpp
View file @
a0dc91dd
...
...
@@ -43,12 +43,7 @@
#include
<kjob.h>
#include
<kjobtrackerinterface.h>
#include
<kross/core/action.h>
#include
<kross/core/actioncollection.h>
#include
<kross/core/manager.h>
#include
<QDBusArgument>
using
namespace
Kross
;
QString
getMailingList
()
{
...
...
src/webquery/myactioncollectionview.cpp
deleted
100644 → 0
View file @
ebeba788
/*****************************************************************************
This file is part of KAider
SPDX-FileCopyrightText: 2007 Nick Shaforostoff <shafff@ukr.net>
SPDX-FileCopyrightText: 2018-2019 Simon Depiets <sdepiets@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Qt-Commercial-exception-1.0
*/
#include
"myactioncollectionview.h"
#include
"webquerycontroller.h"
#include
"project.h"
#include
<QMetaObject>
#include
<kross/ui/model.h>
#include
<kross/core/action.h>
using
namespace
Kross
;
MyActionCollectionView
::
MyActionCollectionView
(
QWidget
*
parent
)
:
Kross
::
ActionCollectionView
(
parent
)
{
setSelectionMode
(
QAbstractItemView
::
MultiSelection
);
//qRegisterMetaType<CatalogData>("CatalogData");
}
void
MyActionCollectionView
::
triggerSelectedActions
()
{
const
auto
selectedIndexes
=
itemSelection
().
indexes
();
for
(
const
QModelIndex
&
index
:
selectedIndexes
)
{
Action
*
action
=
ActionCollectionModel
::
action
(
index
);
static_cast
<
WebQueryController
*>
(
action
->
object
(
"WebQueryController"
))
->
query
(
data
);
//we pass us into the queue.
// qCWarning(LOKALIZE_LOG)<<action->object("WebQueryController");
// Project::instance()->aaaaa()->postQuery(data,
// static_cast<WebQueryController*>(action->object("WebQueryController")));
// QMetaObject::invokeMethod(action->object("WebQueryController"),
// SLOT(query(const CatalogData&)),
// Q_ARG(CatalogData,data)
// );
// connect(this,SIGNAL(query(const CatalogData&)),
// action->object("WebQueryController"),SLOT(query(const CatalogData&)),Qt::QueuedConnection);
// Q_EMIT query(data);
// disconnect(this,SIGNAL(query(const CatalogData&)),
// action->object("WebQueryController"),SLOT(query(const CatalogData&)));
}
}
src/webquery/myactioncollectionview.h
deleted
100644 → 0
View file @
ebeba788
/*****************************************************************************
This file is part of KAider
SPDX-FileCopyrightText: 2007 Nick Shaforostoff <shafff@ukr.net>
SPDX-FileCopyrightText: 2018-2019 Simon Depiets <sdepiets@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Qt-Commercial-exception-1.0
*/
#ifndef MYACTIONCOLLECTIONVIEW_H
#define MYACTIONCOLLECTIONVIEW_H
#include
<kross/ui/view.h>
class
Catalog
;
#include
"webquerycontroller.h"
/**
@author Nick Shaforostoff <shafff@ukr.net>
*/
class
MyActionCollectionView
:
public
Kross
::
ActionCollectionView
{
Q_OBJECT
public:
explicit
MyActionCollectionView
(
QWidget
*
parent
=
nullptr
);
~
MyActionCollectionView
()
override
=
default
;
public
Q_SLOTS
:
void
triggerSelectedActions
();
void
reset
()
override
{
Kross
::
ActionCollectionView
::
reset
();
/*selectAll();*/
}
Q_SIGNALS:
void
query
(
const
CatalogData
&
data
);
public:
CatalogData
data
;
};
#endif
src/webquery/querycontrol.ui
View file @
a0dc91dd
...
...
@@ -26,16 +26,11 @@
</property>
</widget>
</item>
<item>
<widget class="MyActionCollectionView" name="actionzView" />
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>MyActionCollectionView</class>
<extends>QTreeView</extends>
<header>myactioncollectionview.h</header>
</customwidget>
</customwidgets>
<resources/>
...
...
src/webquery/webqueryview.cpp
View file @
a0dc91dd
...
...
@@ -15,13 +15,10 @@
#include
"catalog.h"
#include
"flowlayout.h"
#include
"ui_querycontrol.h"
#include
<KLocalizedString>
#include
<QAction>
#include
<kross/ui/view.h>
#include
<kross/ui/model.h>
#include
<kross/core/actioncollection.h>
#include
<kross/core/manager.h>
#include
<klocalizedstring.h>
#include
"ui_querycontrol.h"
#include
"webquerycontroller.h"
...
...
@@ -31,11 +28,6 @@
#include
<QTextBrowser>
#include
<QTimer>
// #include <QShortcutEvent>
#include
"myactioncollectionview.h"
using
namespace
Kross
;
WebQueryView
::
WebQueryView
(
QWidget
*
parent
,
Catalog
*
catalog
,
const
QVector
<
QAction
*>&
actions
)
:
QDockWidget
(
i18n
(
"Web Queries"
),
parent
)
,
m_catalog
(
catalog
)
...
...
@@ -67,18 +59,6 @@ WebQueryView::~WebQueryView()
void
WebQueryView
::
initLater
()
{
connect
(
ui_queryControl
->
queryBtn
,
&
QPushButton
::
clicked
,
ui_queryControl
->
actionzView
,
&
MyActionCollectionView
::
triggerSelectedActions
);
// connect(this, &WebQueryView::addWebQueryResult, m_flowLayout, SLOT(addWebQueryResult(const QString&)));
// ActionCollectionModel::Mode mode(
// ActionCollectionModel::Icons
// | ActionCollectionModel::ToolTips | ActionCollectionModel::UserCheckable );*/
ActionCollectionModel
*
m
=
new
ActionCollectionModel
(
ui_queryControl
->
actionzView
,
Manager
::
self
().
actionCollection
()
/*, mode*/
);
ui_queryControl
->
actionzView
->
setModel
(
m
);
// m_boxLayout->addWidget(w);
ui_queryControl
->
actionzView
->
data
.
webQueryView
=
this
;
m_browser
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Double-click any word to insert it into translation"
));
...
...
@@ -121,12 +101,6 @@ void WebQueryView::slotNewEntryDisplayed(const DocPosition& pos)
//m_flowLayout->clearWebQueryResult();
m_browser
->
clear
();
m_suggestions
.
clear
();
ui_queryControl
->
actionzView
->
data
.
msg
=
m_catalog
->
msgid
(
pos
);
//TODO pass DocPosition also, as tmview does
if
(
ui_queryControl
->
autoQuery
->
isChecked
())
ui_queryControl
->
actionzView
->
triggerSelectedActions
();
}
void
WebQueryView
::
slotUseSuggestion
(
int
i
)
...
...
Write
Preview