Changeset View
Changeset View
Standalone View
Standalone View
shell/uicontroller.cpp
Show All 30 Lines | |||||
31 | #include <KXMLGUIClient> | 31 | #include <KXMLGUIClient> | ||
32 | 32 | | |||
33 | #include <sublime/area.h> | 33 | #include <sublime/area.h> | ||
34 | #include <sublime/view.h> | 34 | #include <sublime/view.h> | ||
35 | #include <sublime/tooldocument.h> | 35 | #include <sublime/tooldocument.h> | ||
36 | #include <sublime/holdupdates.h> | 36 | #include <sublime/holdupdates.h> | ||
37 | 37 | | |||
38 | #include <interfaces/itoolviewactionlistener.h> | 38 | #include <interfaces/itoolviewactionlistener.h> | ||
39 | #include <util/scopeddialog.h> | ||||
39 | 40 | | |||
40 | #include "core.h" | 41 | #include "core.h" | ||
41 | #include "configpage.h" | 42 | #include "configpage.h" | ||
42 | #include "configdialog.h" | 43 | #include "configdialog.h" | ||
43 | #include "debug.h" | 44 | #include "debug.h" | ||
44 | #include "editorconfigpage.h" | 45 | #include "editorconfigpage.h" | ||
45 | #include "shellextension.h" | 46 | #include "shellextension.h" | ||
46 | #include "plugincontroller.h" | 47 | #include "plugincontroller.h" | ||
▲ Show 20 Lines • Show All 382 Lines • ▼ Show 20 Line(s) | 427 | { | |||
429 | saveAllAreas(KSharedConfig::openConfig()); | 430 | saveAllAreas(KSharedConfig::openConfig()); | ||
430 | } | 431 | } | ||
431 | 432 | | |||
432 | void UiController::selectNewToolViewToAdd(MainWindow *mw) | 433 | void UiController::selectNewToolViewToAdd(MainWindow *mw) | ||
433 | { | 434 | { | ||
434 | if (!mw || !mw->area()) | 435 | if (!mw || !mw->area()) | ||
435 | return; | 436 | return; | ||
436 | 437 | | |||
437 | QDialog *dia = new QDialog(mw); | 438 | ScopedDialog<QDialog> dia(mw); | ||
438 | dia->setWindowTitle(i18n("Select Tool View to Add")); | 439 | dia->setWindowTitle(i18n("Select Tool View to Add")); | ||
439 | 440 | | |||
440 | auto mainLayout = new QVBoxLayout(dia); | 441 | auto mainLayout = new QVBoxLayout(dia); | ||
441 | 442 | | |||
442 | NewToolViewListWidget *list = new NewToolViewListWidget(mw, dia); | 443 | NewToolViewListWidget *list = new NewToolViewListWidget(mw, dia); | ||
443 | 444 | | |||
444 | list->setSelectionMode(QAbstractItemView::ExtendedSelection); | 445 | list->setSelectionMode(QAbstractItemView::ExtendedSelection); | ||
445 | list->setSortingEnabled(true); | 446 | list->setSortingEnabled(true); | ||
Show All 23 Lines | |||||
469 | 470 | | |||
470 | if (dia->exec() == QDialog::Accepted) | 471 | if (dia->exec() == QDialog::Accepted) | ||
471 | { | 472 | { | ||
472 | foreach (QListWidgetItem* item, list->selectedItems()) | 473 | foreach (QListWidgetItem* item, list->selectedItems()) | ||
473 | { | 474 | { | ||
474 | addNewToolView(mw, item); | 475 | addNewToolView(mw, item); | ||
475 | } | 476 | } | ||
476 | } | 477 | } | ||
477 | delete dia; | | |||
478 | } | 478 | } | ||
479 | 479 | | |||
480 | void UiController::addNewToolView(MainWindow *mw, QListWidgetItem* item) | 480 | void UiController::addNewToolView(MainWindow *mw, QListWidgetItem* item) | ||
481 | { | 481 | { | ||
482 | ViewSelectorItem *current = static_cast<ViewSelectorItem*>(item); | 482 | ViewSelectorItem *current = static_cast<ViewSelectorItem*>(item); | ||
483 | Sublime::ToolDocument *doc = d->factoryDocuments[current->factory]; | 483 | Sublime::ToolDocument *doc = d->factoryDocuments[current->factory]; | ||
484 | Sublime::View *view = doc->createView(); | 484 | Sublime::View *view = doc->createView(); | ||
485 | mw->area()->addToolView(view, | 485 | mw->area()->addToolView(view, | ||
▲ Show 20 Lines • Show All 273 Lines • Show Last 20 Lines |