| 251 | |
| 252 | |
| 253 | SessionController::SessionController( QObject *parent ) |
| 254 | : QObject(parent) |
| 255 | , d_ptr(new SessionControllerPrivate(this)) |
| 256 | { |
| 257 | Q_D(SessionController); |
| 258 | |
| 259 | setObjectName(QStringLiteral("SessionController")); |
| 260 | setComponentName(QStringLiteral("kdevsession"), i18n("Session Manager")); |
| 261 | |
| 262 | setXMLFile(QStringLiteral("kdevsessionui.rc")); |
| 263 | |
| 264 | QDBusConnection::sessionBus().registerObject( QStringLiteral("/org/kdevelop/SessionController"), |
| 265 | this, QDBusConnection::ExportScriptableSlots ); |
| 266 | |
| 267 | if (Core::self()->setupFlags() & Core::NoUi) return; |
| 268 | |
| 269 | QAction* action = actionCollection()->addAction(QStringLiteral("new_session")); |
| 270 | connect(action, &QAction::triggered, |
| 271 | this, [this] { Q_D(SessionController); d->newSession(); }); |
| 272 | action->setText( i18nc("@action:inmenu", "Start New Session") ); |
| 273 | action->setToolTip( i18nc("@info:tooltip", "Start a new KDevelop instance with an empty session") ); |
| 274 | action->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); |
| 275 | |
| 276 | action = actionCollection()->addAction(QStringLiteral("new_named_session")); |
| 277 | connect(action, &QAction::triggered, this, [this] { |
| 278 | Q_D(SessionController); |
| 279 | d->newNamedSession(); |
| 280 | }); |
| 281 | action->setText(i18nc("@action:inmenu", "Start New Named Session...")); |
| 282 | action->setToolTip(i18nc("@info:tooltip", "Start a new KDevelop instance with an empty named session")); |
| 283 | action->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); |
| 284 | |
| 285 | action = actionCollection()->addAction(QStringLiteral("rename_session")); |
| 286 | connect(action, &QAction::triggered, |
| 287 | this, [this] { Q_D(SessionController); d->renameSession(); }); |
| 288 | action->setText( i18nc("@action", "Rename Current Session...") ); |
| 289 | action->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); |
| 290 | |
| 291 | action = actionCollection()->addAction(QStringLiteral("delete_session")); |
| 292 | connect(action, &QAction::triggered, |
| 293 | this, [this] { Q_D(SessionController); d->deleteCurrentSession(); }); |
| 294 | action->setText( i18nc("@action", "Delete Current Session...") ); |
| 295 | action->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); |
| 296 | |
| 297 | action = actionCollection()->addAction( QStringLiteral("quit"), this, SIGNAL(quitSession()) ); |
| 298 | action->setText( i18nc("@action", "Quit") ); |
| 299 | action->setMenuRole( QAction::NoRole ); // OSX: prevent QT from hiding this due to conflict with 'Quit KDevelop...' |
| 300 | actionCollection()->setDefaultShortcut( action, Qt::CTRL | Qt::Key_Q ); |
| 301 | action->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"))); |
| 302 | |
| 303 | d->grp = new QActionGroup( this ); |
| 304 | connect(d->grp, &QActionGroup::triggered, |
| 305 | this, [this] (QAction* a) { Q_D(SessionController); d->loadSessionFromAction(a); } ); |
| 306 | } |
| 307 | |
| 308 | SessionController::~SessionController() = default; |
| 309 |
nothing calls this directly
no test coverage detected