Changeset View
Changeset View
Standalone View
Standalone View
applets/pager/plugin/pagermodel.cpp
Show First 20 Lines • Show All 345 Lines • ▼ Show 20 Line(s) | 338 | if (d->screenGeometry != geometry) { | |||
---|---|---|---|---|---|
346 | 346 | | |||
347 | emit showOnlyCurrentScreenChanged(); | 347 | emit showOnlyCurrentScreenChanged(); | ||
348 | } | 348 | } | ||
349 | } | 349 | } | ||
350 | 350 | | |||
351 | int PagerModel::currentPage() const | 351 | int PagerModel::currentPage() const | ||
352 | { | 352 | { | ||
353 | if (d->pagerType == VirtualDesktops) { | 353 | if (d->pagerType == VirtualDesktops) { | ||
354 | return d->virtualDesktopInfo->currentDesktop(); | 354 | return d->virtualDesktopInfo->currentDesktop() - 1; | ||
355 | } else { | 355 | } else { | ||
356 | return d->activityInfo->runningActivities().indexOf(d->activityInfo->currentActivity()); | 356 | return d->activityInfo->runningActivities().indexOf(d->activityInfo->currentActivity()); | ||
357 | } | 357 | } | ||
358 | } | 358 | } | ||
359 | 359 | | |||
360 | int PagerModel::layoutRows() const | 360 | int PagerModel::layoutRows() const | ||
361 | { | 361 | { | ||
362 | return qBound(1, d->virtualDesktopInfo->desktopLayoutRows(), | 362 | return qBound(1, d->virtualDesktopInfo->desktopLayoutRows(), | ||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Line(s) | 512 | #else | |||
513 | Q_UNUSED(window) | 513 | Q_UNUSED(window) | ||
514 | Q_UNUSED(x) | 514 | Q_UNUSED(x) | ||
515 | Q_UNUSED(y) | 515 | Q_UNUSED(y) | ||
516 | Q_UNUSED(targetDesktop) | 516 | Q_UNUSED(targetDesktop) | ||
517 | Q_UNUSED(sourceDesktop) | 517 | Q_UNUSED(sourceDesktop) | ||
518 | #endif | 518 | #endif | ||
519 | } | 519 | } | ||
520 | 520 | | |||
521 | void PagerModel::changePage(int itemId) | 521 | void PagerModel::changePage(int page) | ||
522 | { | 522 | { | ||
523 | | ||||
523 | #if HAVE_X11 | 524 | #if HAVE_X11 | ||
524 | if (!KWindowSystem::isPlatformX11()) { | 525 | if (!KWindowSystem::isPlatformX11()) { | ||
525 | return; | 526 | return; | ||
526 | } | 527 | } | ||
527 | 528 | | |||
528 | const int targetId = (d->pagerType == VirtualDesktops) ? itemId + 1 : itemId; | 529 | if (currentPage() == page) { | ||
529 | | ||||
530 | if (currentPage() == targetId) { | | |||
531 | if (d->showDesktop) { | 530 | if (d->showDesktop) { | ||
532 | QDBusConnection::sessionBus().asyncCall(QDBusMessage::createMethodCall(QLatin1String("org.kde.plasmashell"), | 531 | QDBusConnection::sessionBus().asyncCall(QDBusMessage::createMethodCall(QLatin1String("org.kde.plasmashell"), | ||
533 | QLatin1String("/PlasmaShell"), | 532 | QLatin1String("/PlasmaShell"), | ||
534 | QLatin1String("org.kde.PlasmaShell"), | 533 | QLatin1String("org.kde.PlasmaShell"), | ||
535 | QLatin1String("toggleDashboard"))); | 534 | QLatin1String("toggleDashboard"))); | ||
536 | } | 535 | } | ||
537 | } else { | 536 | } else { | ||
538 | if (d->pagerType == VirtualDesktops) { | 537 | if (d->pagerType == VirtualDesktops) { | ||
539 | KWindowSystem::setCurrentDesktop(targetId); | 538 | KWindowSystem::setCurrentDesktop(page + 1); | ||
540 | } else { | 539 | } else { | ||
541 | const QStringList &runningActivities = d->activityInfo->runningActivities(); | 540 | const QStringList &runningActivities = d->activityInfo->runningActivities(); | ||
542 | 541 | if (page < runningActivities.length()) { | |||
543 | if (targetId < runningActivities.length()) { | | |||
544 | KActivities::Controller activitiesController; | 542 | KActivities::Controller activitiesController; | ||
545 | activitiesController.setCurrentActivity(runningActivities.at(targetId)); | 543 | activitiesController.setCurrentActivity(runningActivities.at(page)); | ||
546 | } | 544 | } | ||
547 | } | 545 | } | ||
548 | } | 546 | } | ||
547 | | ||||
549 | #else | 548 | #else | ||
550 | Q_UNUSED(itemId) | 549 | Q_UNUSED(itemId) | ||
551 | #endif | 550 | #endif | ||
552 | } | 551 | } | ||
553 | 552 | | |||
554 | void PagerModel::drop(QMimeData *mimeData, int itemId) | 553 | void PagerModel::drop(QMimeData *mimeData, int itemId) | ||
555 | { | 554 | { | ||
556 | if (!mimeData) { | 555 | if (!mimeData) { | ||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |