Commit c09cf89b authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Remove unused code and dependencies

parent 762f55a7
......@@ -81,7 +81,6 @@ public:
DiscoverMainWindow::DiscoverMainWindow(CompactMode mode)
: QObject()
, m_collection(this)
, m_engine(new QQmlApplicationEngine)
, m_mode(mode)
, m_networkAccessManagerFactory(new CachedNetworkAccessManagerFactory)
......@@ -268,37 +267,32 @@ bool DiscoverMainWindow::eventFilter(QObject * object, QEvent * event)
void DiscoverMainWindow::setupActions()
{
QAction *quitAction = KStandardAction::quit(QCoreApplication::instance(), &QCoreApplication::quit, actionCollection());
actionCollection()->addAction(QStringLiteral("file_quit"), quitAction);
if (KAuthorized::authorizeAction(QStringLiteral("help_contents"))) {
auto mHandBookAction = KStandardAction::helpContents(this, &DiscoverMainWindow::appHelpActivated, this);
actionCollection()->addAction(mHandBookAction->objectName(), mHandBookAction);
m_collection[mHandBookAction->objectName()] = mHandBookAction;
}
if (KAuthorized::authorizeAction(QStringLiteral("help_report_bug")) && !KAboutData::applicationData().bugAddress().isEmpty()) {
auto mReportBugAction = KStandardAction::reportBug(this, &DiscoverMainWindow::reportBug, this);
actionCollection()->addAction(mReportBugAction->objectName(), mReportBugAction);
m_collection[mReportBugAction->objectName()] = mReportBugAction;
}
if (KAuthorized::authorizeAction(QStringLiteral("switch_application_language"))) {
// if (KLocalizedString::availableApplicationTranslations().count() > 1) {
auto mSwitchApplicationLanguageAction = KStandardAction::create(KStandardAction::SwitchApplicationLanguage, this, &DiscoverMainWindow::switchApplicationLanguage, this);
actionCollection()->addAction(mSwitchApplicationLanguageAction->objectName(), mSwitchApplicationLanguageAction);
m_collection[mSwitchApplicationLanguageAction->objectName()] = mSwitchApplicationLanguageAction;
// }
}
if (KAuthorized::authorizeAction(QStringLiteral("help_about_app"))) {
auto mAboutAppAction = KStandardAction::aboutApp(this, &DiscoverMainWindow::aboutApplication, this);
actionCollection()->addAction(mAboutAppAction->objectName(), mAboutAppAction);
m_collection[mAboutAppAction->objectName()] = mAboutAppAction;
}
auto mKeyBindignsAction = KStandardAction::keyBindings(this, &DiscoverMainWindow::configureShortcuts, this);
actionCollection()->addAction(mKeyBindignsAction->objectName(), mKeyBindignsAction);
}
QAction * DiscoverMainWindow::action(const QString& name)
QAction * DiscoverMainWindow::action(const QString& name) const
{
return actionCollection()->action(name);
return m_collection.value(name);
}
QString DiscoverMainWindow::iconName(const QIcon& icon)
......@@ -338,14 +332,6 @@ void DiscoverMainWindow::switchApplicationLanguage()
// langDialog->show();
}
void DiscoverMainWindow::configureShortcuts()
{
KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, nullptr);
dlg.setModal(true);
dlg.addCollection(actionCollection());
qDebug() << "saving shortcuts..." << dlg.configure(/*bSaveSettings*/);
}
void DiscoverMainWindow::setCompactMode(DiscoverMainWindow::CompactMode mode)
{
if (m_mode != mode) {
......
......@@ -23,7 +23,6 @@
#include <QtCore/QUrl>
#include <QQuickView>
#include <KActionCollection>
class AbstractResource;
class Category;
......@@ -52,8 +51,8 @@ class DiscoverMainWindow : public QObject
bool eventFilter(QObject * object, QEvent * event) override;
Q_SCRIPTABLE QAction * action(const QString& name);
Q_SCRIPTABLE QString iconName(const QIcon& icon);
Q_SCRIPTABLE QAction * action(const QString& name) const;
Q_SCRIPTABLE static QString iconName(const QIcon& icon);
void loadTest(const QUrl& url);
......@@ -73,7 +72,6 @@ class DiscoverMainWindow : public QObject
void reportBug();
void switchApplicationLanguage();
void aboutApplication();
void configureShortcuts();
Q_SIGNALS:
void openSearch(const QString &search);
......@@ -90,9 +88,7 @@ class DiscoverMainWindow : public QObject
void integrateObject(QObject* object);
QQmlApplicationEngine* engine() const { return m_engine; }
KActionCollection* actionCollection() { return &m_collection; }
KActionCollection m_collection;
QMap<QString, QAction*> m_collection;
QQmlApplicationEngine * const m_engine;
CompactMode m_mode;
......
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