Changeset View
Changeset View
Standalone View
Standalone View
app/kiten.cpp
Show All 22 Lines | |||||
23 | *****************************************************************************/ | 23 | *****************************************************************************/ | ||
24 | 24 | | |||
25 | #include "kiten.h" | 25 | #include "kiten.h" | ||
26 | 26 | | |||
27 | #include <KActionCollection> | 27 | #include <KActionCollection> | ||
28 | #include <KConfig> | 28 | #include <KConfig> | ||
29 | #include <KConfigGui> | 29 | #include <KConfigGui> | ||
30 | #include <KEditToolBar> | 30 | #include <KEditToolBar> | ||
31 | #include <KHTMLView> | | |||
32 | #include <KLocalizedString> | 31 | #include <KLocalizedString> | ||
33 | #include <KProcess> | 32 | #include <KProcess> | ||
34 | #include <KShortcutsDialog> | 33 | #include <KShortcutsDialog> | ||
35 | #include <KStandardAction> | 34 | #include <KStandardAction> | ||
36 | #include <KStandardGuiItem> | 35 | #include <KStandardGuiItem> | ||
37 | #include <KStatusNotifierItem> | 36 | #include <KStatusNotifierItem> | ||
38 | #include <KToggleAction> | 37 | #include <KToggleAction> | ||
39 | #include <KXmlGuiWindow> | 38 | #include <KXmlGuiWindow> | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 93 | */ | |||
97 | 96 | | |||
98 | /* Create the export list */ | 97 | /* Create the export list */ | ||
99 | // setupExportListDock(); | 98 | // setupExportListDock(); | ||
100 | 99 | | |||
101 | /* TODO: have a look at this idea | 100 | /* TODO: have a look at this idea | ||
102 | detachedView = new ResultsView( NULL, "detachedView" ); | 101 | detachedView = new ResultsView( NULL, "detachedView" ); | ||
103 | */ | 102 | */ | ||
104 | 103 | | |||
105 | setCentralWidget( _mainView->widget() ); | 104 | setCentralWidget( _mainView ); | ||
106 | 105 | | |||
107 | setupActions(); | 106 | setupActions(); | ||
108 | // Be sure to create this manager before creating the GUI | 107 | // Be sure to create this manager before creating the GUI | ||
109 | // as it needs to add a KAction to it. | 108 | // as it needs to add a KAction to it. | ||
110 | _dictionaryUpdateManager = new DictionaryUpdateManager( this ); | 109 | _dictionaryUpdateManager = new DictionaryUpdateManager( this ); | ||
111 | 110 | | |||
112 | createGUI(); | 111 | createGUI(); | ||
113 | 112 | | |||
Show All 13 Lines | |||||
127 | applyMainWindowSettings( KSharedConfig::openConfig()->group( "kitenWindow" ) ); | 126 | applyMainWindowSettings( KSharedConfig::openConfig()->group( "kitenWindow" ) ); | ||
128 | 127 | | |||
129 | /* What happens when links are clicked or things are selected in the clipboard */ | 128 | /* What happens when links are clicked or things are selected in the clipboard */ | ||
130 | connect(_mainView, &ResultsView::urlClicked, this, &Kiten::searchText); | 129 | connect(_mainView, &ResultsView::urlClicked, this, &Kiten::searchText); | ||
131 | connect( QApplication::clipboard(), &QClipboard::selectionChanged, | 130 | connect( QApplication::clipboard(), &QClipboard::selectionChanged, | ||
132 | this, &Kiten::searchClipboard ); | 131 | this, &Kiten::searchClipboard ); | ||
133 | connect(_inputManager, &SearchStringInput::search, this, &Kiten::searchFromEdit); | 132 | connect(_inputManager, &SearchStringInput::search, this, &Kiten::searchFromEdit); | ||
134 | 133 | | |||
135 | connect( _mainView->view()->verticalScrollBar(), &QAbstractSlider::valueChanged, | 134 | connect( _mainView->verticalScrollBar(), &QAbstractSlider::valueChanged, | ||
136 | this, &Kiten::setCurrentScrollValue ); | 135 | this, &Kiten::setCurrentScrollValue ); | ||
137 | /* We need to know when to reload our dictionaries if the user updated them. */ | 136 | /* We need to know when to reload our dictionaries if the user updated them. */ | ||
138 | connect(_dictionaryUpdateManager, &DictionaryUpdateManager::updateFinished, this, &Kiten::loadDictionaries); | 137 | connect(_dictionaryUpdateManager, &DictionaryUpdateManager::updateFinished, this, &Kiten::loadDictionaries); | ||
139 | 138 | | |||
140 | /* See below for what else needs to be done */ | 139 | /* See below for what else needs to be done */ | ||
141 | QTimer::singleShot( 10, this, &Kiten::finishInit ); | 140 | QTimer::singleShot( 10, this, &Kiten::finishInit ); | ||
142 | } | 141 | } | ||
143 | 142 | | |||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Line(s) | |||||
305 | 304 | | |||
306 | // Edit->Completion()->clear(); // make sure the edit is focused initially | 305 | // Edit->Completion()->clear(); // make sure the edit is focused initially | ||
307 | _statusBar->showMessage( i18n( "Welcome to Kiten" ) ); | 306 | _statusBar->showMessage( i18n( "Welcome to Kiten" ) ); | ||
308 | setCaption( QString() ); | 307 | setCaption( QString() ); | ||
309 | } | 308 | } | ||
310 | 309 | | |||
311 | void Kiten::focusResultsView() | 310 | void Kiten::focusResultsView() | ||
312 | { | 311 | { | ||
313 | _mainView->view()->setFocus(); | 312 | _mainView->verticalScrollBar()->setFocus(); | ||
314 | } | 313 | } | ||
315 | 314 | | |||
316 | // This function is run on program window close. | 315 | // This function is run on program window close. | ||
317 | // It saves the settings in the config. | 316 | // It saves the settings in the config. | ||
318 | bool Kiten::queryClose() | 317 | bool Kiten::queryClose() | ||
319 | { | 318 | { | ||
320 | _config->setAutosearch( _autoSearchToggle->isChecked() ); | 319 | _config->setAutosearch( _autoSearchToggle->isChecked() ); | ||
321 | _config->save(); | 320 | _config->save(); | ||
▲ Show 20 Lines • Show All 497 Lines • Show Last 20 Lines |