Changeset View
Changeset View
Standalone View
Standalone View
core/ModuleView.cpp
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 52 | public: | |||
---|---|---|---|---|---|
56 | KPageWidget* mPageWidget = nullptr; | 56 | KPageWidget* mPageWidget = nullptr; | ||
57 | QVBoxLayout* mLayout = nullptr; | 57 | QVBoxLayout* mLayout = nullptr; | ||
58 | QDialogButtonBox* mButtons = nullptr; | 58 | QDialogButtonBox* mButtons = nullptr; | ||
59 | KAuth::ObjectDecorator* mApplyAuthorize = nullptr; | 59 | KAuth::ObjectDecorator* mApplyAuthorize = nullptr; | ||
60 | QPushButton* mApply = nullptr; | 60 | QPushButton* mApply = nullptr; | ||
61 | QPushButton* mReset = nullptr; | 61 | QPushButton* mReset = nullptr; | ||
62 | QPushButton* mDefault = nullptr; | 62 | QPushButton* mDefault = nullptr; | ||
63 | QPushButton* mHelp = nullptr; | 63 | QPushButton* mHelp = nullptr; | ||
64 | bool pageChangeSupressed; | 64 | bool pageChangeSupressed = false; | ||
65 | bool mSaveStatistics = true; | ||||
65 | }; | 66 | }; | ||
66 | 67 | | |||
67 | ModuleView::ModuleView( QWidget * parent ) | 68 | ModuleView::ModuleView( QWidget * parent ) | ||
68 | : QWidget( parent ) | 69 | : QWidget( parent ) | ||
69 | , d( new Private() ) | 70 | , d( new Private() ) | ||
70 | { | 71 | { | ||
71 | // Configure a layout first | 72 | // Configure a layout first | ||
72 | d->mLayout = new QVBoxLayout(this); | 73 | d->mLayout = new QVBoxLayout(this); | ||
▲ Show 20 Lines • Show All 267 Lines • ▼ Show 20 Line(s) | 333 | { | |||
340 | if( d->pageChangeSupressed ) { | 341 | if( d->pageChangeSupressed ) { | ||
341 | return; | 342 | return; | ||
342 | } | 343 | } | ||
343 | // We need to get the state of the now active module | 344 | // We need to get the state of the now active module | ||
344 | stateChanged(); | 345 | stateChanged(); | ||
345 | 346 | | |||
346 | KCModuleProxy * activeModule = d->mPages.value( d->mPageWidget->currentPage() ); | 347 | KCModuleProxy * activeModule = d->mPages.value( d->mPageWidget->currentPage() ); | ||
347 | if (activeModule) { | 348 | if (activeModule) { | ||
349 | // TODO: if we'll ever need statistics for kinfocenter modules, save them with an URL like "kinfo:" | ||||
350 | if (d->mSaveStatistics) { | ||||
348 | KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("kcm:") + activeModule->moduleInfo().service()->storageId()), | 351 | KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("kcm:") + activeModule->moduleInfo().service()->storageId()), | ||
349 | QStringLiteral("org.kde.systemsettings")); | 352 | QStringLiteral("org.kde.systemsettings")); | ||
353 | } | ||||
meven: We might want to have a different url scheme like "kinfo" insteat of "kcm" and "org.kde. | |||||
that's a good point. mart: that's a good point.
Tough, at the moment we don't do anything with the statistics in… | |||||
We can ignore this for now, for sure, since we don't have a use case indeed. meven: We can ignore this for now, for sure, since we don't have a use case indeed.
KFeedback may like… | |||||
350 | if (activeModule->realModule() && activeModule->realModule()->inherits("KCModuleQml")) { | 354 | if (activeModule->realModule() && activeModule->realModule()->inherits("KCModuleQml")) { | ||
351 | d->mButtons->setContentsMargins( | 355 | d->mButtons->setContentsMargins( | ||
352 | style()->pixelMetric(QStyle::PM_LayoutLeftMargin), | 356 | style()->pixelMetric(QStyle::PM_LayoutLeftMargin), | ||
353 | style()->pixelMetric(QStyle::PM_LayoutTopMargin), | 357 | style()->pixelMetric(QStyle::PM_LayoutTopMargin), | ||
354 | style()->pixelMetric(QStyle::PM_LayoutRightMargin), | 358 | style()->pixelMetric(QStyle::PM_LayoutRightMargin), | ||
355 | style()->pixelMetric(QStyle::PM_LayoutBottomMargin)); | 359 | style()->pixelMetric(QStyle::PM_LayoutBottomMargin)); | ||
356 | d->mLayout->setContentsMargins(0, 0, 0, 0); | 360 | d->mLayout->setContentsMargins(0, 0, 0, 0); | ||
357 | } else { | 361 | } else { | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 427 | { | |||
424 | d->mPageWidget->setFaceType(type); | 428 | d->mPageWidget->setFaceType(type); | ||
425 | } | 429 | } | ||
426 | 430 | | |||
427 | KPageView::FaceType ModuleView::faceType() const | 431 | KPageView::FaceType ModuleView::faceType() const | ||
428 | { | 432 | { | ||
429 | return d->mPageWidget->faceType(); | 433 | return d->mPageWidget->faceType(); | ||
430 | } | 434 | } | ||
431 | 435 | | |||
436 | void ModuleView::setSaveStatistics(bool save) | ||||
437 | { | ||||
438 | d->mSaveStatistics = save; | ||||
439 | } | ||||
440 | | ||||
441 | bool ModuleView::saveStatistics() const | ||||
442 | { | ||||
443 | return d->mSaveStatistics; | ||||
444 | } | ||||
445 | | ||||
446 | void ModuleView::setApplyVisible(bool visible) | ||||
447 | { | ||||
448 | d->mApply->setVisible(visible); | ||||
449 | } | ||||
450 | | ||||
451 | bool ModuleView::isApplyVisible() const | ||||
452 | { | ||||
453 | return d->mApply->isVisible(); | ||||
454 | } | ||||
455 | | ||||
456 | void ModuleView::setDefaultsVisible(bool visible) | ||||
457 | { | ||||
458 | d->mDefault->setVisible(visible); | ||||
459 | } | ||||
460 | | ||||
461 | bool ModuleView::isDefaultsVisible() const | ||||
462 | { | ||||
463 | return d->mDefault->isVisible(); | ||||
464 | } | ||||
465 | | ||||
466 | void ModuleView::setResetVisible(bool visible) | ||||
467 | { | ||||
468 | d->mReset->setVisible(visible); | ||||
469 | } | ||||
470 | | ||||
471 | bool ModuleView::isResetVisible() const | ||||
472 | { | ||||
473 | return d->mReset->isVisible(); | ||||
474 | } | ||||
475 | |
We might want to have a different url scheme like "kinfo" insteat of "kcm" and "org.kde.kinfocenter" instead of "org.kde.systemsettings"