Changeset View
Changeset View
Standalone View
Standalone View
app/mainwindow.cpp
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Line(s) | 155 | { | |||
---|---|---|---|---|---|
169 | SideBar* mSideBar; | 169 | SideBar* mSideBar; | ||
170 | QStackedWidget* mViewStackedWidget; | 170 | QStackedWidget* mViewStackedWidget; | ||
171 | FullScreenContent* mFullScreenContent; | 171 | FullScreenContent* mFullScreenContent; | ||
172 | SaveBar* mSaveBar; | 172 | SaveBar* mSaveBar; | ||
173 | bool mStartSlideShowWhenDirListerCompleted; | 173 | bool mStartSlideShowWhenDirListerCompleted; | ||
174 | SlideShow* mSlideShow; | 174 | SlideShow* mSlideShow; | ||
175 | Preloader* mPreloader; | 175 | Preloader* mPreloader; | ||
176 | bool mPreloadDirectionIsForward; | 176 | bool mPreloadDirectionIsForward; | ||
177 | bool mSelectFirstItemWhenDirListerCompleted; | ||||
177 | #ifdef KIPI_FOUND | 178 | #ifdef KIPI_FOUND | ||
178 | KIPIInterface* mKIPIInterface; | 179 | KIPIInterface* mKIPIInterface; | ||
179 | #endif | 180 | #endif | ||
180 | 181 | | |||
181 | QActionGroup* mViewModeActionGroup; | 182 | QActionGroup* mViewModeActionGroup; | ||
182 | KRecentFilesAction* mFileOpenRecentAction; | 183 | KRecentFilesAction* mFileOpenRecentAction; | ||
183 | QAction * mBrowseAction; | 184 | QAction * mBrowseAction; | ||
184 | QAction * mViewAction; | 185 | QAction * mViewAction; | ||
▲ Show 20 Lines • Show All 244 Lines • ▼ Show 20 Line(s) | 357 | { | |||
429 | 430 | | |||
430 | mGoToLastAction = view->addAction("go_last", q, SLOT(goToLast())); | 431 | mGoToLastAction = view->addAction("go_last", q, SLOT(goToLast())); | ||
431 | mGoToLastAction->setPriority(QAction::LowPriority); | 432 | mGoToLastAction->setPriority(QAction::LowPriority); | ||
432 | mGoToLastAction->setText(i18nc("@action Go to last image", "Last")); | 433 | mGoToLastAction->setText(i18nc("@action Go to last image", "Last")); | ||
433 | mGoToLastAction->setToolTip(i18nc("@info:tooltip", "Go to last image")); | 434 | mGoToLastAction->setToolTip(i18nc("@info:tooltip", "Go to last image")); | ||
434 | actionCollection->setDefaultShortcut(mGoToLastAction, Qt::Key_End); | 435 | actionCollection->setDefaultShortcut(mGoToLastAction, Qt::Key_End); | ||
435 | 436 | | |||
436 | mPreloadDirectionIsForward = true; | 437 | mPreloadDirectionIsForward = true; | ||
438 | mSelectFirstItemWhenDirListerCompleted = false; | ||||
437 | 439 | | |||
438 | mGoUpAction = view->addAction(KStandardAction::Up, q, SLOT(goUp())); | 440 | mGoUpAction = view->addAction(KStandardAction::Up, q, SLOT(goUp())); | ||
439 | 441 | | |||
440 | action = view->addAction("go_start_page", q, SLOT(showStartMainPage())); | 442 | action = view->addAction("go_start_page", q, SLOT(showStartMainPage())); | ||
441 | action->setPriority(QAction::LowPriority); | 443 | action->setPriority(QAction::LowPriority); | ||
442 | action->setIcon(QIcon::fromTheme("go-home")); | 444 | action->setIcon(QIcon::fromTheme("go-home")); | ||
443 | action->setText(i18nc("@action", "Start Page")); | 445 | action->setText(i18nc("@action", "Start Page")); | ||
444 | action->setToolTip(i18nc("@info:tooltip", "Open the start page")); | 446 | action->setToolTip(i18nc("@info:tooltip", "Open the start page")); | ||
▲ Show 20 Lines • Show All 683 Lines • ▼ Show 20 Line(s) | |||||
1128 | void MainWindow::slotCurrentDirUrlChanged(const QUrl &url) | 1130 | void MainWindow::slotCurrentDirUrlChanged(const QUrl &url) | ||
1129 | { | 1131 | { | ||
1130 | if (url.isValid()) { | 1132 | if (url.isValid()) { | ||
1131 | d->mUrlNavigator->setLocationUrl(url); | 1133 | d->mUrlNavigator->setLocationUrl(url); | ||
1132 | d->mGoUpAction->setEnabled(url.path() != "/"); | 1134 | d->mGoUpAction->setEnabled(url.path() != "/"); | ||
1133 | } else { | 1135 | } else { | ||
1134 | d->mGoUpAction->setEnabled(false); | 1136 | d->mGoUpAction->setEnabled(false); | ||
1135 | } | 1137 | } | ||
1138 | d->mSelectFirstItemWhenDirListerCompleted = true; | ||||
1136 | } | 1139 | } | ||
1137 | 1140 | | |||
1138 | void MainWindow::slotDirModelNewItems() | 1141 | void MainWindow::slotDirModelNewItems() | ||
1139 | { | 1142 | { | ||
1140 | if (d->mContextManager->selectionModel()->hasSelection()) { | 1143 | if (d->mContextManager->selectionModel()->hasSelection()) { | ||
1141 | updatePreviousNextActions(); | 1144 | updatePreviousNextActions(); | ||
1142 | } | 1145 | } | ||
1143 | } | 1146 | } | ||
1144 | 1147 | | |||
1145 | void MainWindow::slotDirListerCompleted() | 1148 | void MainWindow::slotDirListerCompleted() | ||
1146 | { | 1149 | { | ||
1147 | if (d->mStartSlideShowWhenDirListerCompleted) { | 1150 | if (d->mStartSlideShowWhenDirListerCompleted) { | ||
1148 | d->mStartSlideShowWhenDirListerCompleted = false; | 1151 | d->mStartSlideShowWhenDirListerCompleted = false; | ||
1149 | QTimer::singleShot(0, d->mToggleSlideShowAction, SLOT(trigger())); | 1152 | QTimer::singleShot(0, d->mToggleSlideShowAction, SLOT(trigger())); | ||
1150 | } | 1153 | } | ||
1151 | if (d->mContextManager->selectionModel()->hasSelection()) { | 1154 | if (d->mContextManager->selectionModel()->hasSelection()) { | ||
1152 | updatePreviousNextActions(); | 1155 | updatePreviousNextActions(); | ||
1153 | } else { | 1156 | } else { | ||
1157 | if (d->mSelectFirstItemWhenDirListerCompleted) { | ||||
1154 | QModelIndex index = d->mThumbnailView->model()->index(0, 0); | 1158 | QModelIndex index = d->mThumbnailView->model()->index(0, 0); | ||
1155 | if (index.isValid()) { | 1159 | if (index.isValid()) { | ||
1156 | d->mThumbnailView->setCurrentIndex(index); | 1160 | d->mThumbnailView->setCurrentIndex(index); | ||
1157 | } | 1161 | } | ||
1158 | } | 1162 | } | ||
1163 | } | ||||
1164 | d->mSelectFirstItemWhenDirListerCompleted = false; | ||||
1159 | d->mThumbnailView->scrollToSelectedIndex(); | 1165 | d->mThumbnailView->scrollToSelectedIndex(); | ||
1160 | d->mViewMainPage->thumbnailBar()->scrollToSelectedIndex(); | 1166 | d->mViewMainPage->thumbnailBar()->scrollToSelectedIndex(); | ||
1161 | } | 1167 | } | ||
1162 | 1168 | | |||
1163 | void MainWindow::goToPrevious() | 1169 | void MainWindow::goToPrevious() | ||
1164 | { | 1170 | { | ||
1165 | d->goTo(-1); | 1171 | d->goTo(-1); | ||
1166 | } | 1172 | } | ||
▲ Show 20 Lines • Show All 449 Lines • Show Last 20 Lines |