Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kfilewidget.cpp
Show First 20 Lines • Show All 355 Lines • ▼ Show 20 Line(s) | 347 | { | |||
---|---|---|---|---|---|
356 | KGuiItem::assign(d->cancelButton, KStandardGuiItem::cancel()); | 356 | KGuiItem::assign(d->cancelButton, KStandardGuiItem::cancel()); | ||
357 | // The dialog shows them | 357 | // The dialog shows them | ||
358 | d->okButton->hide(); | 358 | d->okButton->hide(); | ||
359 | d->cancelButton->hide(); | 359 | d->cancelButton->hide(); | ||
360 | 360 | | |||
361 | d->opsWidget = new QWidget(this); | 361 | d->opsWidget = new QWidget(this); | ||
362 | QVBoxLayout *opsWidgetLayout = new QVBoxLayout(d->opsWidget); | 362 | QVBoxLayout *opsWidgetLayout = new QVBoxLayout(d->opsWidget); | ||
363 | opsWidgetLayout->setMargin(0); | 363 | opsWidgetLayout->setMargin(0); | ||
364 | opsWidgetLayout->setSpacing(0); | 364 | opsWidgetLayout->setSpacing(0); | ||
365 | d->toolbar = new KToolBar(this, true); | 365 | d->toolbar = new KToolBar(this, true); | ||
rkflx: ? | |||||
Oops, somehow arc merged this patch with D12333 when I downloaded it. Not sure how I managed to do that. Cleaned up now. ngraham: Oops, somehow `arc` merged this patch with D12333 when I downloaded it. Not sure how I managed… | |||||
366 | d->toolbar->setObjectName(QStringLiteral("KFileWidget::toolbar")); | 366 | d->toolbar->setObjectName(QStringLiteral("KFileWidget::toolbar")); | ||
367 | d->toolbar->setMovable(false); | 367 | d->toolbar->setMovable(false); | ||
368 | 368 | | |||
rkflx: ? | |||||
ngraham: Same, sorry. | |||||
369 | d->model = new KFilePlacesModel(this); | 369 | d->model = new KFilePlacesModel(this); | ||
370 | 370 | | |||
371 | // Resolve this now so that a 'kfiledialog:' URL, if specified, | 371 | // Resolve this now so that a 'kfiledialog:' URL, if specified, | ||
372 | // does not get inserted into the urlNavigator history. | 372 | // does not get inserted into the urlNavigator history. | ||
373 | d->url = getStartUrl(startDir, d->fileClass, filename); | 373 | d->url = getStartUrl(startDir, d->fileClass, filename); | ||
374 | startDir = d->url; | 374 | startDir = d->url; | ||
375 | 375 | | |||
376 | // Don't pass startDir to the KUrlNavigator at this stage: as well as | 376 | // Don't pass startDir to the KUrlNavigator at this stage: as well as | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 404 | #endif | |||
479 | menu->setWhatsThis(i18n("<qt>This is the preferences menu for the file dialog. " | 479 | menu->setWhatsThis(i18n("<qt>This is the preferences menu for the file dialog. " | ||
480 | "Various options can be accessed from this menu including: <ul>" | 480 | "Various options can be accessed from this menu including: <ul>" | ||
481 | "<li>how files are sorted in the list</li>" | 481 | "<li>how files are sorted in the list</li>" | ||
482 | "<li>types of view, including icon and list</li>" | 482 | "<li>types of view, including icon and list</li>" | ||
483 | "<li>showing of hidden files</li>" | 483 | "<li>showing of hidden files</li>" | ||
484 | "<li>the Places navigation panel</li>" | 484 | "<li>the Places navigation panel</li>" | ||
485 | "<li>file previews</li>" | 485 | "<li>file previews</li>" | ||
486 | "<li>separating folders from files</li></ul></qt>")); | 486 | "<li>separating folders from files</li></ul></qt>")); | ||
487 | menu->addAction(coll->action(QStringLiteral("sorting menu"))); | | |||
488 | menu->addAction(coll->action(QStringLiteral("view menu"))); | 487 | menu->addAction(coll->action(QStringLiteral("view menu"))); | ||
489 | menu->addSeparator(); | 488 | menu->addSeparator(); | ||
490 | menu->addAction(coll->action(QStringLiteral("decoration menu"))); | 489 | menu->addAction(coll->action(QStringLiteral("decoration menu"))); | ||
491 | menu->addSeparator(); | 490 | menu->addSeparator(); | ||
492 | menu->addAction(coll->action(QStringLiteral("show hidden"))); | 491 | menu->addAction(coll->action(QStringLiteral("show hidden"))); | ||
493 | menu->addAction(showSidebarAction); | 492 | menu->addAction(showSidebarAction); | ||
494 | menu->addAction(showBookmarksAction); | 493 | menu->addAction(showBookmarksAction); | ||
495 | coll->action(QStringLiteral("inline preview")); | 494 | coll->action(QStringLiteral("inline preview")); | ||
Show All 18 Lines | |||||
514 | connect(d->ops, SIGNAL(currentIconSizeChanged(int)), | 513 | connect(d->ops, SIGNAL(currentIconSizeChanged(int)), | ||
515 | d->iconSizeSlider, SLOT(setValue(int))); | 514 | d->iconSizeSlider, SLOT(setValue(int))); | ||
516 | 515 | | |||
517 | QAction *furtherAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-out")), i18n("Zoom out"), this); | 516 | QAction *furtherAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-out")), i18n("Zoom out"), this); | ||
518 | connect(furtherAction, SIGNAL(triggered()), SLOT(_k_zoomOutIconsSize())); | 517 | connect(furtherAction, SIGNAL(triggered()), SLOT(_k_zoomOutIconsSize())); | ||
519 | QAction *closerAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-in")), i18n("Zoom in"), this); | 518 | QAction *closerAction = new QAction(QIcon::fromTheme(QStringLiteral("file-zoom-in")), i18n("Zoom in"), this); | ||
520 | connect(closerAction, SIGNAL(triggered()), SLOT(_k_zoomInIconsSize())); | 519 | connect(closerAction, SIGNAL(triggered()), SLOT(_k_zoomInIconsSize())); | ||
521 | 520 | | |||
522 | QWidget *midSpacer = new QWidget(this); | 521 | QWidget *midSpacer1 = new QWidget(this); | ||
523 | midSpacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | 522 | midSpacer1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | ||
523 | | ||||
524 | QWidget *midSpacer2 = new QWidget(this); | ||||
525 | midSpacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | ||||
524 | 526 | | |||
525 | QAction *separator = new QAction(this); | 527 | QAction *separator = new QAction(this); | ||
526 | separator->setSeparator(true); | 528 | separator->setSeparator(true); | ||
527 | 529 | | |||
528 | QAction *separator2 = new QAction(this); | 530 | QAction *separator2 = new QAction(this); | ||
529 | separator2->setSeparator(true); | 531 | separator2->setSeparator(true); | ||
530 | 532 | | |||
531 | QAction *separator3 = new QAction(this); | 533 | QAction *separator3 = new QAction(this); | ||
532 | separator3->setSeparator(true); | 534 | separator3->setSeparator(true); | ||
533 | 535 | | |||
534 | d->toolbar->addAction(coll->action(QStringLiteral("back"))); | 536 | d->toolbar->addAction(coll->action(QStringLiteral("back"))); | ||
535 | d->toolbar->addAction(coll->action(QStringLiteral("forward"))); | 537 | d->toolbar->addAction(coll->action(QStringLiteral("forward"))); | ||
536 | d->toolbar->addAction(coll->action(QStringLiteral("up"))); | 538 | d->toolbar->addAction(coll->action(QStringLiteral("up"))); | ||
537 | d->toolbar->addAction(coll->action(QStringLiteral("reload"))); | 539 | d->toolbar->addAction(coll->action(QStringLiteral("reload"))); | ||
538 | d->toolbar->addAction(separator); | 540 | d->toolbar->addAction(separator); | ||
539 | d->toolbar->addAction(coll->action(QStringLiteral("short view"))); | 541 | d->toolbar->addAction(coll->action(QStringLiteral("short view"))); | ||
540 | d->toolbar->addAction(coll->action(QStringLiteral("detailed tree view"))); | 542 | d->toolbar->addAction(coll->action(QStringLiteral("detailed tree view"))); | ||
541 | d->toolbar->addAction(separator2); | 543 | d->toolbar->addAction(separator2); | ||
542 | d->toolbar->addAction(coll->action(QStringLiteral("inline preview"))); | 544 | d->toolbar->addAction(coll->action(QStringLiteral("inline preview"))); | ||
543 | d->toolbar->addWidget(midSpacer); | 545 | d->toolbar->addWidget(midSpacer1); | ||
546 | d->toolbar->addAction(coll->action(QStringLiteral("sorting menu"))); | ||||
547 | d->toolbar->addWidget(midSpacer2); | ||||
544 | d->toolbar->addAction(furtherAction); | 548 | d->toolbar->addAction(furtherAction); | ||
545 | d->toolbar->addWidget(d->iconSizeSlider); | 549 | d->toolbar->addWidget(d->iconSizeSlider); | ||
546 | d->toolbar->addAction(closerAction); | 550 | d->toolbar->addAction(closerAction); | ||
547 | d->toolbar->addAction(separator3); | 551 | d->toolbar->addAction(separator3); | ||
548 | d->toolbar->addAction(coll->action(QStringLiteral("mkdir"))); | 552 | d->toolbar->addAction(coll->action(QStringLiteral("mkdir"))); | ||
549 | d->toolbar->addAction(menu); | 553 | d->toolbar->addAction(menu); | ||
550 | 554 | | |||
551 | d->toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); | 555 | d->toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); | ||
552 | d->toolbar->setMovable(false); | 556 | d->toolbar->setMovable(false); | ||
553 | 557 | | |||
558 | // Make any dropdown menu buttons open their menus without requiring a long press | ||||
559 | foreach(QToolButton* button, d->toolbar->findChildren<QToolButton*>()) { | ||||
560 | if (button->defaultAction() == coll->action(QStringLiteral("sorting menu"))) { | ||||
561 | button->setPopupMode(QToolButton::InstantPopup); | ||||
562 | button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||||
563 | } | ||||
This also worked for me, and would avoid the foreach: KActionMenu *x = new KActionMenu(QIcon::fromTheme(QStringLiteral("configure")), i18n("Options"), this); x->setMenu(coll->action(QStringLiteral("sorting menu"))->menu()); x->setDelayed(false); d->toolbar->addAction(x); rkflx: This also worked for me, and would avoid the `foreach`:
```
KActionMenu *x = new… | |||||
ngraham: Found an even simpler way. :) | |||||
564 | } | ||||
565 | | ||||
rkflx: Unintentional newline? | |||||
554 | KUrlCompletion *pathCompletionObj = new KUrlCompletion(KUrlCompletion::DirCompletion); | 566 | KUrlCompletion *pathCompletionObj = new KUrlCompletion(KUrlCompletion::DirCompletion); | ||
555 | pathCombo->setCompletionObject(pathCompletionObj); | 567 | pathCombo->setCompletionObject(pathCompletionObj); | ||
556 | pathCombo->setAutoDeleteCompletionObject(true); | 568 | pathCombo->setAutoDeleteCompletionObject(true); | ||
557 | 569 | | |||
558 | connect(d->urlNavigator, SIGNAL(urlChanged(QUrl)), | 570 | connect(d->urlNavigator, SIGNAL(urlChanged(QUrl)), | ||
559 | this, SLOT(_k_enterUrl(QUrl))); | 571 | this, SLOT(_k_enterUrl(QUrl))); | ||
560 | connect(d->urlNavigator, SIGNAL(returnPressed()), | 572 | connect(d->urlNavigator, SIGNAL(returnPressed()), | ||
561 | d->ops, SLOT(setFocus())); | 573 | d->ops, SLOT(setFocus())); | ||
▲ Show 20 Lines • Show All 832 Lines • ▼ Show 20 Line(s) | |||||
1394 | } | 1406 | } | ||
1395 | 1407 | | |||
1396 | void KFileWidgetPrivate::initGUI() | 1408 | void KFileWidgetPrivate::initGUI() | ||
1397 | { | 1409 | { | ||
1398 | delete boxLayout; // deletes all sub layouts | 1410 | delete boxLayout; // deletes all sub layouts | ||
1399 | 1411 | | |||
1400 | boxLayout = new QVBoxLayout(q); | 1412 | boxLayout = new QVBoxLayout(q); | ||
1401 | boxLayout->setMargin(0); // no additional margin to the already existing | 1413 | boxLayout->setMargin(0); // no additional margin to the already existing | ||
1402 | boxLayout->addWidget(toolbar); | 1414 | boxLayout->addWidget(toolbar); | ||
rkflx: ? | |||||
1403 | 1415 | | |||
1404 | placesViewSplitter = new QSplitter(q); | 1416 | placesViewSplitter = new QSplitter(q); | ||
1405 | placesViewSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | 1417 | placesViewSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | ||
1406 | placesViewSplitter->setChildrenCollapsible(false); | 1418 | placesViewSplitter->setChildrenCollapsible(false); | ||
1407 | boxLayout->addWidget(placesViewSplitter); | 1419 | boxLayout->addWidget(placesViewSplitter); | ||
1408 | 1420 | | |||
1409 | QObject::connect(placesViewSplitter, SIGNAL(splitterMoved(int,int)), | 1421 | QObject::connect(placesViewSplitter, SIGNAL(splitterMoved(int,int)), | ||
1410 | q, SLOT(_k_placesViewSplitterMoved(int,int))); | 1422 | q, SLOT(_k_placesViewSplitterMoved(int,int))); | ||
▲ Show 20 Lines • Show All 1456 Lines • Show Last 20 Lines |
?