Changeset View
Changeset View
Standalone View
Standalone View
src/search/dolphinsearchbox.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | #include <QToolButton> | 44 | #include <QToolButton> | ||
45 | #include <QUrlQuery> | 45 | #include <QUrlQuery> | ||
46 | 46 | | |||
47 | DolphinSearchBox::DolphinSearchBox(QWidget* parent) : | 47 | DolphinSearchBox::DolphinSearchBox(QWidget* parent) : | ||
48 | QWidget(parent), | 48 | QWidget(parent), | ||
49 | m_startedSearching(false), | 49 | m_startedSearching(false), | ||
50 | m_active(true), | 50 | m_active(true), | ||
51 | m_topLayout(nullptr), | 51 | m_topLayout(nullptr), | ||
52 | m_searchLabel(nullptr), | | |||
53 | m_searchInput(nullptr), | 52 | m_searchInput(nullptr), | ||
54 | m_saveSearchAction(nullptr), | 53 | m_saveSearchAction(nullptr), | ||
55 | m_optionsScrollArea(nullptr), | 54 | m_optionsScrollArea(nullptr), | ||
56 | m_fileNameButton(nullptr), | 55 | m_fileNameButton(nullptr), | ||
57 | m_contentButton(nullptr), | 56 | m_contentButton(nullptr), | ||
58 | m_separator(nullptr), | 57 | m_separator(nullptr), | ||
59 | m_fromHereButton(nullptr), | 58 | m_fromHereButton(nullptr), | ||
60 | m_everywhereButton(nullptr), | 59 | m_everywhereButton(nullptr), | ||
▲ Show 20 Lines • Show All 289 Lines • ▼ Show 20 Line(s) | |||||
350 | { | 349 | { | ||
351 | // Create close button | 350 | // Create close button | ||
352 | QToolButton* closeButton = new QToolButton(this); | 351 | QToolButton* closeButton = new QToolButton(this); | ||
353 | closeButton->setAutoRaise(true); | 352 | closeButton->setAutoRaise(true); | ||
354 | closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close"))); | 353 | closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close"))); | ||
355 | closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching")); | 354 | closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching")); | ||
356 | connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest); | 355 | connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest); | ||
357 | 356 | | |||
358 | // Create search label | | |||
359 | m_searchLabel = new QLabel(this); | | |||
360 | | ||||
361 | // Create search box | 357 | // Create search box | ||
362 | m_searchInput = new QLineEdit(this); | 358 | m_searchInput = new QLineEdit(this); | ||
359 | m_searchInput->setPlaceholderText(i18n("Search...")); | ||||
yurchor: Should it be "Search..." or even "Search…" (GNOME has already switched to the Unicode ellipsis)? | |||||
ognarb: Unicode ellipsis are better thanks ;) | |||||
I think we agreed in the VDG chat to use three periods instead of the actual ellipsis character for now. ngraham: I think we agreed in the VDG chat to use three periods instead of the actual ellipsis character… | |||||
This will not be translatable, please read https://api.kde.org/frameworks/ki18n/html/prg_guide.html elvisangelaccio: This will not be translatable, please read https://api.kde.org/frameworks/ki18n/html/prg_guide. | |||||
363 | m_searchInput->installEventFilter(this); | 360 | m_searchInput->installEventFilter(this); | ||
364 | m_searchInput->setClearButtonEnabled(true); | 361 | m_searchInput->setClearButtonEnabled(true); | ||
365 | m_searchInput->setFont(QFontDatabase::systemFont(QFontDatabase::GeneralFont)); | 362 | m_searchInput->setFont(QFontDatabase::systemFont(QFontDatabase::GeneralFont)); | ||
366 | connect(m_searchInput, &QLineEdit::returnPressed, | 363 | connect(m_searchInput, &QLineEdit::returnPressed, | ||
367 | this, &DolphinSearchBox::slotReturnPressed); | 364 | this, &DolphinSearchBox::slotReturnPressed); | ||
368 | connect(m_searchInput, &QLineEdit::textChanged, | 365 | connect(m_searchInput, &QLineEdit::textChanged, | ||
369 | this, &DolphinSearchBox::slotSearchTextChanged); | 366 | this, &DolphinSearchBox::slotSearchTextChanged); | ||
370 | setFocusProxy(m_searchInput); | 367 | setFocusProxy(m_searchInput); | ||
371 | 368 | | |||
372 | // Add "Save search" button inside search box | 369 | // Add "Save search" button inside search box | ||
373 | m_saveSearchAction = new QAction(this); | 370 | m_saveSearchAction = new QAction(this); | ||
374 | m_saveSearchAction->setIcon (QIcon::fromTheme(QStringLiteral("document-save-symbolic"))); | 371 | m_saveSearchAction->setIcon (QIcon::fromTheme(QStringLiteral("document-save-symbolic"))); | ||
375 | m_saveSearchAction->setText(i18nc("action:button", "Save this search to quickly access it again in the future")); | 372 | m_saveSearchAction->setText(i18nc("action:button", "Save this search to quickly access it again in the future")); | ||
376 | m_saveSearchAction->setEnabled(false); | 373 | m_saveSearchAction->setEnabled(false); | ||
377 | m_searchInput->addAction(m_saveSearchAction, QLineEdit::TrailingPosition); | 374 | m_searchInput->addAction(m_saveSearchAction, QLineEdit::TrailingPosition); | ||
378 | connect(m_saveSearchAction, &QAction::triggered, this, &DolphinSearchBox::slotSearchSaved); | 375 | connect(m_saveSearchAction, &QAction::triggered, this, &DolphinSearchBox::slotSearchSaved); | ||
379 | 376 | | |||
380 | // Apply layout for the search input | 377 | // Apply layout for the search input | ||
381 | QHBoxLayout* searchInputLayout = new QHBoxLayout(); | 378 | QHBoxLayout* searchInputLayout = new QHBoxLayout(); | ||
382 | searchInputLayout->setContentsMargins(0, 0, 0, 0); | 379 | searchInputLayout->setContentsMargins(0, 0, 0, 0); | ||
383 | searchInputLayout->addWidget(closeButton); | 380 | searchInputLayout->addWidget(closeButton); | ||
384 | searchInputLayout->addWidget(m_searchLabel); | | |||
385 | searchInputLayout->addWidget(m_searchInput); | 381 | searchInputLayout->addWidget(m_searchInput); | ||
386 | 382 | | |||
387 | // Create "Filename" and "Content" button | 383 | // Create "Filename" and "Content" button | ||
388 | m_fileNameButton = new QToolButton(this); | 384 | m_fileNameButton = new QToolButton(this); | ||
389 | m_fileNameButton->setText(i18nc("action:button", "Filename")); | 385 | m_fileNameButton->setText(i18nc("action:button", "Filename")); | ||
390 | initButton(m_fileNameButton); | 386 | initButton(m_fileNameButton); | ||
391 | 387 | | |||
392 | m_contentButton = new QToolButton(); | 388 | m_contentButton = new QToolButton(); | ||
▲ Show 20 Lines • Show All 176 Lines • Show Last 20 Lines |
Should it be "Search..." or even "Search…" (GNOME has already switched to the Unicode ellipsis)?
Thanks in advance for your answer.