Commit b9a8a8b8 authored by Christoph Cullmann's avatar Christoph Cullmann

cleanup internal API

parent 7ce75cee
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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) {
......
......@@ -72,11 +72,6 @@ KateSessionManager::~KateSessionManager()
delete m_dirWatch;
}
KateSessionManager *KateSessionManager::self()
{
return KateApp::self()->sessionManager();
}
void KateSessionManager::updateSessionList()
{
QStringList list;
......
......@@ -36,12 +36,6 @@ public:
KateSessionManager(QObject *parent = 0, const QString &sessionsDir = QString());
~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
......
......@@ -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) {
......
......@@ -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()));
......
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