Changeset View
Changeset View
Standalone View
Standalone View
app/startmainpage.cpp
Show All 27 Lines | |||||
28 | #include <QMenu> | 28 | #include <QMenu> | ||
29 | 29 | | |||
30 | #ifdef GTK_WORKAROUND_BROKE_IN_KF5_PORT | 30 | #ifdef GTK_WORKAROUND_BROKE_IN_KF5_PORT | ||
31 | #include <QPlastiqueStyle> | 31 | #include <QPlastiqueStyle> | ||
32 | #endif | 32 | #endif | ||
33 | 33 | | |||
34 | #include <QIcon> | 34 | #include <QIcon> | ||
35 | #include <QStyledItemDelegate> | 35 | #include <QStyledItemDelegate> | ||
36 | 36 | | |||
ngraham: Unnecessary whitespace change | |||||
37 | // KDE | 37 | // KDE | ||
38 | #include <KFilePlacesModel> | 38 | #include <KFilePlacesModel> | ||
39 | #include <KLocalizedString> | 39 | #include <KLocalizedString> | ||
40 | 40 | | |||
41 | // Local | 41 | // Local | ||
42 | #include <gvcore.h> | 42 | #include <gvcore.h> | ||
43 | #include <ui_startmainpage.h> | 43 | #include <ui_startmainpage.h> | ||
44 | #include <lib/dialogguard.h> | 44 | #include <lib/dialogguard.h> | ||
45 | #include <lib/flowlayout.h> | 45 | #include <lib/flowlayout.h> | ||
46 | #include <lib/gvdebug.h> | 46 | #include <lib/gvdebug.h> | ||
47 | #include <lib/gwenviewconfig.h> | 47 | #include <lib/gwenviewconfig.h> | ||
48 | #include <lib/thumbnailview/abstractthumbnailviewhelper.h> | 48 | #include <lib/thumbnailview/abstractthumbnailviewhelper.h> | ||
49 | #include <lib/thumbnailview/previewitemdelegate.h> | 49 | #include <lib/thumbnailview/previewitemdelegate.h> | ||
50 | #include <lib/thumbnailprovider/thumbnailprovider.h> | 50 | #include <lib/thumbnailprovider/thumbnailprovider.h> | ||
51 | #include <lib/scrollerutils.h> | ||||
51 | 52 | | |||
52 | #ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE | 53 | #ifndef GWENVIEW_SEMANTICINFO_BACKEND_NONE | ||
53 | #include <lib/semanticinfo/tagmodel.h> | 54 | #include <lib/semanticinfo/tagmodel.h> | ||
54 | #endif | 55 | #endif | ||
55 | 56 | | |||
56 | namespace Gwenview | 57 | namespace Gwenview | ||
57 | { | 58 | { | ||
58 | 59 | | |||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 153 | if (styleIsGtkBased()) { | |||
157 | QStyle* fix = new QPlastiqueStyle(); | 158 | QStyle* fix = new QPlastiqueStyle(); | ||
158 | fix->setParent(this); | 159 | fix->setParent(this); | ||
159 | d->mHistoryWidget->tabBar()->setStyle(fix); | 160 | d->mHistoryWidget->tabBar()->setStyle(fix); | ||
160 | d->mPlacesTagsWidget->tabBar()->setStyle(fix); | 161 | d->mPlacesTagsWidget->tabBar()->setStyle(fix); | ||
161 | #endif | 162 | #endif | ||
162 | } | 163 | } | ||
163 | setFrameStyle(QFrame::NoFrame); | 164 | setFrameStyle(QFrame::NoFrame); | ||
164 | 165 | | |||
165 | // Bookmark view | 166 | // Bookmark view | ||
This breaks reordering by dragging in the places panel for mouse users, so I don't think this can be removed. rkflx: This breaks reordering by dragging in the places panel for mouse users, so I don't think this… | |||||
166 | d->mBookmarksModel = new KFilePlacesModel(this); | 167 | d->mBookmarksModel = new KFilePlacesModel(this); | ||
167 | 168 | | |||
168 | d->mBookmarksView->setModel(d->mBookmarksModel); | 169 | d->mBookmarksView->setModel(d->mBookmarksModel); | ||
169 | d->mBookmarksView->setAutoResizeItemsEnabled(false); | 170 | d->mBookmarksView->setAutoResizeItemsEnabled(false); | ||
170 | 171 | | |||
171 | connect(d->mBookmarksView, &KFilePlacesView::urlChanged, this, &StartMainPage::urlSelected); | 172 | connect(d->mBookmarksView, &KFilePlacesView::urlChanged, this, &StartMainPage::urlSelected); | ||
This duplicates a lot of code from FolderViewContextManagerItem, so you might think about putting this into a separate function taking the viewport as a parameter (in app, but see lib/*utils* for some examples). rkflx: This duplicates a lot of code from `FolderViewContextManagerItem`, so you might think about… | |||||
172 | 173 | | |||
173 | // Tag view | 174 | // Tag view | ||
174 | connect(d->mTagView, &QListView::clicked, this, &StartMainPage::slotTagViewClicked); | 175 | connect(d->mTagView, &QListView::clicked, this, &StartMainPage::slotTagViewClicked); | ||
175 | 176 | | |||
176 | // Recent folders view | 177 | // Recent folders view | ||
177 | connect(d->mRecentFoldersView, &Gwenview::ThumbnailView::indexActivated, | 178 | connect(d->mRecentFoldersView, &Gwenview::ThumbnailView::indexActivated, | ||
178 | this, &StartMainPage::slotListViewActivated); | 179 | this, &StartMainPage::slotListViewActivated); | ||
179 | connect(d->mRecentFoldersView, &Gwenview::ThumbnailView::customContextMenuRequested, | 180 | connect(d->mRecentFoldersView, &Gwenview::ThumbnailView::customContextMenuRequested, | ||
180 | this, &StartMainPage::showContextMenu); | 181 | this, &StartMainPage::showContextMenu); | ||
181 | 182 | | |||
182 | // Recent files view | 183 | // Recent files view | ||
183 | connect(d->mRecentFilesView, &Gwenview::ThumbnailView::indexActivated, | 184 | connect(d->mRecentFilesView, &Gwenview::ThumbnailView::indexActivated, | ||
184 | this, &StartMainPage::slotListViewActivated); | 185 | this, &StartMainPage::slotListViewActivated); | ||
185 | connect(d->mRecentFilesView, &Gwenview::ThumbnailView::customContextMenuRequested, | 186 | connect(d->mRecentFilesView, &Gwenview::ThumbnailView::customContextMenuRequested, | ||
186 | this, &StartMainPage::showContextMenu); | 187 | this, &StartMainPage::showContextMenu); | ||
187 | 188 | | |||
188 | d->updateHistoryTab(); | 189 | d->updateHistoryTab(); | ||
189 | connect(GwenviewConfig::self(), &GwenviewConfig::configChanged, this, &StartMainPage::loadConfig); | 190 | connect(GwenviewConfig::self(), &GwenviewConfig::configChanged, this, &StartMainPage::loadConfig); | ||
190 | 191 | | |||
191 | d->mRecentFoldersView->setFocus(); | 192 | d->mRecentFoldersView->setFocus(); | ||
193 | | ||||
194 | ScrollerUtils::setQScroller(d->mBookmarksView->viewport()); | ||||
195 | d->mBookmarksView->viewport()->installEventFilter(this); | ||||
192 | } | 196 | } | ||
193 | 197 | | |||
194 | StartMainPage::~StartMainPage() | 198 | StartMainPage::~StartMainPage() | ||
195 | { | 199 | { | ||
196 | delete d->mRecentFilesThumbnailProvider; | 200 | delete d->mRecentFilesThumbnailProvider; | ||
197 | delete d; | 201 | delete d; | ||
198 | } | 202 | } | ||
199 | 203 | | |||
204 | bool StartMainPage::eventFilter(QObject*, QEvent* event) | ||||
205 | { | ||||
206 | if (event->type() == QEvent::MouseMove) { | ||||
207 | QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event); | ||||
208 | if (mouseEvent->source() == Qt::MouseEventSynthesizedByQt) { | ||||
209 | return true; | ||||
210 | } | ||||
211 | } | ||||
212 | return false; | ||||
213 | } | ||||
214 | | ||||
200 | void StartMainPage::slotTagViewClicked(const QModelIndex& index) | 215 | void StartMainPage::slotTagViewClicked(const QModelIndex& index) | ||
201 | { | 216 | { | ||
202 | #ifdef GWENVIEW_SEMANTICINFO_BACKEND_BALOO | 217 | #ifdef GWENVIEW_SEMANTICINFO_BACKEND_BALOO | ||
203 | if (!index.isValid()) { | 218 | if (!index.isValid()) { | ||
204 | return; | 219 | return; | ||
205 | } | 220 | } | ||
206 | // FIXME: Check label encoding | 221 | // FIXME: Check label encoding | ||
207 | const QString tag = index.data().toString(); | 222 | const QString tag = index.data().toString(); | ||
▲ Show 20 Lines • Show All 128 Lines • Show Last 20 Lines |
Unnecessary whitespace change