summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-23 15:05:36 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-23 15:05:36 (GMT)
commitb9a8a8b8512d327b6552e52949f6096c4bb51068 (patch)
tree4f3cf2d582593adb1765756fdc66d1121aba27e0
parent7ce75cee8304c2711fd82ff93ef8be41a9662f90 (diff)
cleanup internal API
-rw-r--r--kate/app/kateconfigdialog.cpp2
-rw-r--r--kate/app/katemainwindow.cpp12
-rw-r--r--kate/app/kateviewspace.cpp2
-rw-r--r--kate/session/katesessionchooser.cpp5
-rw-r--r--kate/session/katesessionmanagedialog.cpp11
-rw-r--r--kate/session/katesessionmanager.cpp5
-rw-r--r--kate/session/katesessionmanager.h6
-rw-r--r--kate/session/katesessionopendialog.cpp3
-rw-r--r--kate/session/katesessionsaction.cpp3
9 files changed, 21 insertions, 28 deletions
diff --git a/kate/app/kateconfigdialog.cpp b/kate/app/kateconfigdialog.cpp
index 9bce159..2189941 100644
--- a/kate/app/kateconfigdialog.cpp
+++ b/kate/app/kateconfigdialog.cpp
@@ -354,7 +354,7 @@ void KateConfigDialog::slotApply()
m_mainWindow->saveOptions();
// save plugin config !!
- KateSessionManager *sessionmanager = KateSessionManager::self();
+ KateSessionManager *sessionmanager = KateApp::self()->sessionManager();
KConfig *sessionConfig = sessionmanager->activeSession()->config();
KateApp::self()->pluginManager()->writeConfig(sessionConfig);
}
diff --git a/kate/app/katemainwindow.cpp b/kate/app/katemainwindow.cpp
index ea08cf4..3df5361 100644
--- a/kate/app/katemainwindow.cpp
+++ b/kate/app/katemainwindow.cpp
@@ -201,7 +201,7 @@ KateMainWindow::KateMainWindow(KConfig *sconfig, const QString &sgroup)
setAcceptDrops(true);
- connect(KateSessionManager::self(), SIGNAL(sessionChanged()), this, SLOT(updateCaption()));
+ connect(KateApp::self()->sessionManager(), SIGNAL(sessionChanged()), this, SLOT(updateCaption()));
connect(this, SIGNAL(sigShowPluginConfigPage(KTextEditor::ConfigPageInterface*,uint)), this, SLOT(showPluginConfigPage(KTextEditor::ConfigPageInterface*,uint)));
}
@@ -377,25 +377,25 @@ void KateMainWindow::setupActions()
a->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
a->setText(i18nc("Menu entry Session->New", "&New"));
// Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008)
- connect(a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionNew()), Qt::QueuedConnection);
+ connect(a, SIGNAL(triggered()), KateApp::self()->sessionManager(), SLOT(sessionNew()), Qt::QueuedConnection);
a = actionCollection()->addAction(QStringLiteral("sessions_open"));
a->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
a->setText(i18n("&Open Session"));
// Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008)
- connect(a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionOpen()), Qt::QueuedConnection);
+ connect(a, SIGNAL(triggered()), KateApp::self()->sessionManager(), SLOT(sessionOpen()), Qt::QueuedConnection);
a = actionCollection()->addAction(QStringLiteral("sessions_save"));
a->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
a->setText(i18n("&Save Session"));
- connect(a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSave()));
+ connect(a, SIGNAL(triggered()), KateApp::self()->sessionManager(), SLOT(sessionSave()));
a = actionCollection()->addAction(QStringLiteral("sessions_save_as"));
a->setIcon(QIcon::fromTheme(QStringLiteral("document-save-as")));
a->setText(i18n("Save Session &As..."));
- connect(a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSaveAs()));
+ connect(a, SIGNAL(triggered()), KateApp::self()->sessionManager(), SLOT(sessionSaveAs()));
a = actionCollection()->addAction(QStringLiteral("sessions_manage"));
a->setIcon(QIcon::fromTheme(QStringLiteral("view-choose")));
a->setText(i18n("&Manage Sessions..."));
// Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008)
- connect(a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionManage()), Qt::QueuedConnection);
+ connect(a, SIGNAL(triggered()), KateApp::self()->sessionManager(), SLOT(sessionManage()), Qt::QueuedConnection);
// quick open menu ;)
a = new KateSessionsAction(i18n("&Quick Open Session"), this);
diff --git a/kate/app/kateviewspace.cpp b/kate/app/kateviewspace.cpp
index 2dcd6d2..cf00b25 100644
--- a/kate/app/kateviewspace.cpp
+++ b/kate/app/kateviewspace.cpp
@@ -144,7 +144,7 @@ KTextEditor::View *KateViewSpace::createView(KTextEditor::Document *doc)
if (! fn.isEmpty()) {
QString vgroup = QString::fromLatin1("%1 %2").arg(m_group).arg(fn);
- KateSession::Ptr as = KateSessionManager::self()->activeSession();
+ KateSession::Ptr as = KateApp::self()->sessionManager()->activeSession();
if (as->config() && as->config()->hasGroup(vgroup)) {
KConfigGroup cg(as->config(), vgroup);
diff --git a/kate/session/katesessionchooser.cpp b/kate/session/katesessionchooser.cpp
index afb7ae9..3cd73a8 100644
--- a/kate/session/katesessionchooser.cpp
+++ b/kate/session/katesessionchooser.cpp
@@ -20,6 +20,7 @@
#include "katesessionchooser.h"
+#include "kateapp.h"
#include "katesessionmanager.h"
#include "katesessionchooseritem.h"
#include "katedebug.h"
@@ -64,7 +65,7 @@ KateSessionChooser::KateSessionChooser(QWidget *parent, const QString &lastSessi
qCDebug(LOG_KATE) << "Last session is:" << lastSession;
- KateSessionList slist = KateSessionManager::self()->sessionList();
+ KateSessionList slist = KateApp::self()->sessionManager()->sessionList();
qSort(slist.begin(), slist.end(), KateSession::compareByName);
foreach(const KateSession::Ptr & session, slist) {
@@ -145,7 +146,7 @@ void KateSessionChooser::slotDeleteSession()
return;
}
- KateSessionManager::self()->deleteSession(item->session);
+ KateApp::self()->sessionManager()->deleteSession(item->session);
m_sessions->removeItemWidget(item, 2);
delete item;
diff --git a/kate/session/katesessionmanagedialog.cpp b/kate/session/katesessionmanagedialog.cpp
index 27e6eaa..a1191a6 100644
--- a/kate/session/katesessionmanagedialog.cpp
+++ b/kate/session/katesessionmanagedialog.cpp
@@ -20,6 +20,7 @@
#include "katesessionmanagedialog.h"
+#include "kateapp.h"
#include "katesessionmanager.h"
#include "katesessionchooseritem.h"
@@ -110,7 +111,7 @@ void KateSessionManageDialog::selectionChanged(QTreeWidgetItem *current, QTreeWi
const bool validItem = (current != NULL);
m_rename->setEnabled(validItem);
- m_del->setEnabled(validItem && (static_cast<KateSessionChooserItem *>(current))->session != KateSessionManager::self()->activeSession());
+ m_del->setEnabled(validItem && (static_cast<KateSessionChooserItem *>(current))->session != KateApp::self()->sessionManager()->activeSession());
m_openButton->setEnabled(true);
}
@@ -136,7 +137,7 @@ void KateSessionManageDialog::rename()
return;
}
- if (KateSessionManager::self()->renameSession(item->session, name)) {
+ if (KateApp::self()->sessionManager()->renameSession(item->session, name)) {
updateSessionList();
}
}
@@ -149,7 +150,7 @@ void KateSessionManageDialog::del()
return;
}
- KateSessionManager::self()->deleteSession(item->session);
+ KateApp::self()->sessionManager()->deleteSession(item->session);
updateSessionList();
}
@@ -162,7 +163,7 @@ void KateSessionManageDialog::open()
}
hide();
- KateSessionManager::self()->activateSession(item->session);
+ KateApp::self()->sessionManager()->activateSession(item->session);
done(0);
}
@@ -170,7 +171,7 @@ void KateSessionManageDialog::updateSessionList()
{
m_sessions->clear();
- KateSessionList slist = KateSessionManager::self()->sessionList();
+ KateSessionList slist = KateApp::self()->sessionManager()->sessionList();
qSort(slist.begin(), slist.end(), KateSession::compareByName);
foreach(const KateSession::Ptr & session, slist) {
diff --git a/kate/session/katesessionmanager.cpp b/kate/session/katesessionmanager.cpp
index e5bcef4..39d6521 100644
--- a/kate/session/katesessionmanager.cpp
+++ b/kate/session/katesessionmanager.cpp
@@ -72,11 +72,6 @@ KateSessionManager::~KateSessionManager()
delete m_dirWatch;
}
-KateSessionManager *KateSessionManager::self()
-{
- return KateApp::self()->sessionManager();
-}
-
void KateSessionManager::updateSessionList()
{
QStringList list;
diff --git a/kate/session/katesessionmanager.h b/kate/session/katesessionmanager.h
index 1bccfcf..15a710e 100644
--- a/kate/session/katesessionmanager.h
+++ b/kate/session/katesessionmanager.h
@@ -37,12 +37,6 @@ public:
~KateSessionManager();
/**
- * allow access to this, equivalent of calling `KateApp::self()->sessionManager();`
- * @return instance of the session manager
- */
- static KateSessionManager *self();
-
- /**
* allow access to the session list
* kept up to date by watching the dir
*/
diff --git a/kate/session/katesessionopendialog.cpp b/kate/session/katesessionopendialog.cpp
index b81358a..2b43aeb 100644
--- a/kate/session/katesessionopendialog.cpp
+++ b/kate/session/katesessionopendialog.cpp
@@ -20,6 +20,7 @@
#include "katesessionopendialog.h"
+#include "kateapp.h"
#include "katesessionmanager.h"
#include "katesessionchooseritem.h"
@@ -54,7 +55,7 @@ KateSessionOpenDialog::KateSessionOpenDialog(QWidget *parent)
m_sessions->setSelectionBehavior(QAbstractItemView::SelectRows);
m_sessions->setSelectionMode(QAbstractItemView::SingleSelection);
- KateSessionList slist = KateSessionManager::self()->sessionList();
+ KateSessionList slist = KateApp::self()->sessionManager()->sessionList();
qSort(slist.begin(), slist.end(), KateSession::compareByName);
foreach(const KateSession::Ptr & session, slist) {
diff --git a/kate/session/katesessionsaction.cpp b/kate/session/katesessionsaction.cpp
index 64a2a99..af455f1 100644
--- a/kate/session/katesessionsaction.cpp
+++ b/kate/session/katesessionsaction.cpp
@@ -20,6 +20,7 @@
#include "katesessionsaction.h"
+#include "kateapp.h"
#include "katesessionmanager.h"
#include <QMenu>
@@ -27,7 +28,7 @@
KateSessionsAction::KateSessionsAction(const QString &text, QObject *parent, KateSessionManager *manager)
: KActionMenu(text, parent)
{
- m_manager = manager ? manager : KateSessionManager::self();
+ m_manager = manager ? manager : KateApp::self()->sessionManager();
connect(menu(), SIGNAL(aboutToShow()), this, SLOT(slotAboutToShow()));