Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kfilewidget.cpp
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Line(s) | 84 | : q(widget), | |||
---|---|---|---|---|---|
99 | autoSelectExtChecked(false), | 99 | autoSelectExtChecked(false), | ||
100 | keepLocation(false), | 100 | keepLocation(false), | ||
101 | hasView(false), | 101 | hasView(false), | ||
102 | hasDefaultFilter(false), | 102 | hasDefaultFilter(false), | ||
103 | inAccept(false), | 103 | inAccept(false), | ||
104 | dummyAdded(false), | 104 | dummyAdded(false), | ||
105 | confirmOverwrite(false), | 105 | confirmOverwrite(false), | ||
106 | differentHierarchyLevelItemsEntered(false), | 106 | differentHierarchyLevelItemsEntered(false), | ||
107 | iconSizeSlider(nullptr) | 107 | iconSizeSlider(nullptr), | ||
108 | furtherAction(nullptr), | ||||
ngraham: While we're at it, why don't we rename these to be clearer: I'd prefer `zoomInAction` and… | |||||
109 | closerAction(nullptr) | ||||
108 | { | 110 | { | ||
109 | } | 111 | } | ||
110 | 112 | | |||
111 | ~KFileWidgetPrivate() | 113 | ~KFileWidgetPrivate() | ||
112 | { | 114 | { | ||
113 | delete bookmarkHandler; // Should be deleted before ops! | 115 | delete bookmarkHandler; // Should be deleted before ops! | ||
114 | delete ops; | 116 | delete ops; | ||
115 | } | 117 | } | ||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Line(s) | |||||
279 | bool autoDirectoryFollowing : 1; | 281 | bool autoDirectoryFollowing : 1; | ||
280 | bool inAccept : 1; // true between beginning and end of accept() | 282 | bool inAccept : 1; // true between beginning and end of accept() | ||
281 | bool dummyAdded : 1; // if the dummy item has been added. This prevents the combo from having a | 283 | bool dummyAdded : 1; // if the dummy item has been added. This prevents the combo from having a | ||
282 | // blank item added when loaded | 284 | // blank item added when loaded | ||
283 | bool confirmOverwrite : 1; | 285 | bool confirmOverwrite : 1; | ||
284 | bool differentHierarchyLevelItemsEntered; | 286 | bool differentHierarchyLevelItemsEntered; | ||
285 | 287 | | |||
286 | QSlider *iconSizeSlider; | 288 | QSlider *iconSizeSlider; | ||
289 | QAction *furtherAction; | ||||
290 | QAction *closerAction; | ||||
287 | 291 | | |||
288 | // The group which stores app-specific settings. These settings are recent | 292 | // The group which stores app-specific settings. These settings are recent | ||
289 | // files and urls. Visual settings (view mode, sorting criteria...) are not | 293 | // files and urls. Visual settings (view mode, sorting criteria...) are not | ||
290 | // app-specific and are stored in kdeglobals | 294 | // app-specific and are stored in kdeglobals | ||
291 | KConfigGroup configGroup; | 295 | KConfigGroup configGroup; | ||
292 | }; | 296 | }; | ||
293 | 297 | | |||
294 | Q_GLOBAL_STATIC(QUrl, lastDirectory) // to set the start path | 298 | Q_GLOBAL_STATIC(QUrl, lastDirectory) // to set the start path | ||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Line(s) | 410 | #endif | |||
508 | d->iconSizeSlider->setMaximum(100); | 512 | d->iconSizeSlider->setMaximum(100); | ||
509 | d->iconSizeSlider->installEventFilter(this); | 513 | d->iconSizeSlider->installEventFilter(this); | ||
510 | connect(d->iconSizeSlider, SIGNAL(valueChanged(int)), | 514 | connect(d->iconSizeSlider, SIGNAL(valueChanged(int)), | ||
511 | d->ops, SLOT(setIconsZoom(int))); | 515 | d->ops, SLOT(setIconsZoom(int))); | ||
512 | connect(d->iconSizeSlider, SIGNAL(valueChanged(int)), | 516 | connect(d->iconSizeSlider, SIGNAL(valueChanged(int)), | ||
513 | this, SLOT(_k_slotIconSizeChanged(int))); | 517 | this, SLOT(_k_slotIconSizeChanged(int))); | ||
514 | connect(d->iconSizeSlider, SIGNAL(sliderMoved(int)), | 518 | connect(d->iconSizeSlider, SIGNAL(sliderMoved(int)), | ||
515 | this, SLOT(_k_slotIconSizeSliderMoved(int))); | 519 | this, SLOT(_k_slotIconSizeSliderMoved(int))); | ||
516 | connect(d->ops, SIGNAL(currentIconSizeChanged(int)), | 520 | connect(d->ops, &KDirOperator::currentIconSizeChanged, [this](int value) { | ||
517 | d->iconSizeSlider, SLOT(setValue(int))); | 521 | d->iconSizeSlider->setValue(value); | ||
518 | 522 | d->furtherAction->setDisabled(value <= d->iconSizeSlider->minimum()); | |||
519 | QAction *furtherAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-out")), i18n("Zoom out"), this); | 523 | d->closerAction->setDisabled(value >= d->iconSizeSlider->maximum()); | ||
520 | connect(furtherAction, SIGNAL(triggered()), SLOT(_k_zoomOutIconsSize())); | 524 | }); | ||
521 | QAction *closerAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-in")), i18n("Zoom in"), this); | 525 | | ||
522 | connect(closerAction, SIGNAL(triggered()), SLOT(_k_zoomInIconsSize())); | 526 | d->furtherAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-out")), i18n("Zoom out"), this); | ||
527 | connect(d->furtherAction, SIGNAL(triggered()), SLOT(_k_zoomOutIconsSize())); | ||||
528 | d->closerAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-in")), i18n("Zoom in"), this); | ||||
529 | connect(d->closerAction, SIGNAL(triggered()), SLOT(_k_zoomInIconsSize())); | ||||
523 | 530 | | |||
524 | QWidget *midSpacer = new QWidget(this); | 531 | QWidget *midSpacer = new QWidget(this); | ||
525 | midSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | 532 | midSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | ||
526 | 533 | | |||
527 | QAction *separator = new QAction(this); | 534 | QAction *separator = new QAction(this); | ||
528 | separator->setSeparator(true); | 535 | separator->setSeparator(true); | ||
529 | 536 | | |||
530 | QAction *separator2 = new QAction(this); | 537 | QAction *separator2 = new QAction(this); | ||
531 | separator2->setSeparator(true); | 538 | separator2->setSeparator(true); | ||
532 | 539 | | |||
533 | QAction *separator3 = new QAction(this); | 540 | QAction *separator3 = new QAction(this); | ||
534 | separator3->setSeparator(true); | 541 | separator3->setSeparator(true); | ||
535 | 542 | | |||
536 | d->toolbar->addAction(coll->action(QStringLiteral("back"))); | 543 | d->toolbar->addAction(coll->action(QStringLiteral("back"))); | ||
537 | d->toolbar->addAction(coll->action(QStringLiteral("forward"))); | 544 | d->toolbar->addAction(coll->action(QStringLiteral("forward"))); | ||
538 | d->toolbar->addAction(coll->action(QStringLiteral("up"))); | 545 | d->toolbar->addAction(coll->action(QStringLiteral("up"))); | ||
539 | d->toolbar->addAction(coll->action(QStringLiteral("reload"))); | 546 | d->toolbar->addAction(coll->action(QStringLiteral("reload"))); | ||
540 | d->toolbar->addAction(separator); | 547 | d->toolbar->addAction(separator); | ||
541 | d->toolbar->addAction(coll->action(QStringLiteral("short view"))); | 548 | d->toolbar->addAction(coll->action(QStringLiteral("short view"))); | ||
542 | d->toolbar->addAction(coll->action(QStringLiteral("detailed tree view"))); | 549 | d->toolbar->addAction(coll->action(QStringLiteral("detailed tree view"))); | ||
543 | d->toolbar->addAction(separator2); | 550 | d->toolbar->addAction(separator2); | ||
544 | d->toolbar->addAction(coll->action(QStringLiteral("inline preview"))); | 551 | d->toolbar->addAction(coll->action(QStringLiteral("inline preview"))); | ||
545 | d->toolbar->addWidget(midSpacer); | 552 | d->toolbar->addWidget(midSpacer); | ||
546 | d->toolbar->addAction(furtherAction); | 553 | d->toolbar->addAction(d->furtherAction); | ||
547 | d->toolbar->addWidget(d->iconSizeSlider); | 554 | d->toolbar->addWidget(d->iconSizeSlider); | ||
548 | d->toolbar->addAction(closerAction); | 555 | d->toolbar->addAction(d->closerAction); | ||
549 | d->toolbar->addAction(separator3); | 556 | d->toolbar->addAction(separator3); | ||
550 | d->toolbar->addAction(coll->action(QStringLiteral("mkdir"))); | 557 | d->toolbar->addAction(coll->action(QStringLiteral("mkdir"))); | ||
551 | d->toolbar->addAction(menu); | 558 | d->toolbar->addAction(menu); | ||
552 | 559 | | |||
553 | d->toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); | 560 | d->toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); | ||
554 | d->toolbar->setMovable(false); | 561 | d->toolbar->setMovable(false); | ||
555 | 562 | | |||
556 | KUrlCompletion *pathCompletionObj = new KUrlCompletion(KUrlCompletion::DirCompletion); | 563 | KUrlCompletion *pathCompletionObj = new KUrlCompletion(KUrlCompletion::DirCompletion); | ||
▲ Show 20 Lines • Show All 2312 Lines • Show Last 20 Lines |
While we're at it, why don't we rename these to be clearer: I'd prefer zoomInAction and zoomOutAction