Changeset View
Changeset View
Standalone View
Standalone View
src/kftabdlg.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
48 | 48 | | |||
49 | #include <QtConcurrent/QtConcurrent> | 49 | #include <QtConcurrent/QtConcurrent> | ||
50 | 50 | | |||
51 | #include "kquery.h" | 51 | #include "kquery.h" | ||
52 | 52 | | |||
53 | // Static utility functions | 53 | // Static utility functions | ||
54 | static void save_pattern(KComboBox *, const QString &, const QString &); | 54 | static void save_pattern(KComboBox *, const QString &, const QString &); | ||
55 | 55 | | |||
56 | #define SPECIAL_TYPES 7 | 56 | #define SPECIAL_TYPES 10 | ||
dfaure: static const int, while you're at it ;) | |||||
57 | 57 | | |||
58 | struct LessMimeType_ByComment | 58 | struct LessMimeType_ByComment | ||
59 | { | 59 | { | ||
60 | bool operator()(const KMimeType::Ptr &lhs, const KMimeType::Ptr &rhs) const | 60 | bool operator()(const KMimeType::Ptr &lhs, const KMimeType::Ptr &rhs) const | ||
61 | { | 61 | { | ||
62 | return lhs->comment() < rhs->comment(); | 62 | return lhs->comment() < rhs->comment(); | ||
63 | } | 63 | } | ||
64 | }; | 64 | }; | ||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Line(s) | 69 | { | |||
350 | typeBox->addItem(i18n("Folders")); | 350 | typeBox->addItem(i18n("Folders")); | ||
351 | typeBox->addItem(i18n("Symbolic Links")); | 351 | typeBox->addItem(i18n("Symbolic Links")); | ||
352 | typeBox->addItem(i18n("Special Files (Sockets, Device Files, ...)")); | 352 | typeBox->addItem(i18n("Special Files (Sockets, Device Files, ...)")); | ||
353 | typeBox->addItem(i18n("Executable Files")); | 353 | typeBox->addItem(i18n("Executable Files")); | ||
354 | typeBox->addItem(i18n("SUID Executable Files")); | 354 | typeBox->addItem(i18n("SUID Executable Files")); | ||
355 | typeBox->addItem(i18n("All Images")); | 355 | typeBox->addItem(i18n("All Images")); | ||
356 | typeBox->addItem(i18n("All Video")); | 356 | typeBox->addItem(i18n("All Video")); | ||
357 | typeBox->addItem(i18n("All Sounds")); | 357 | typeBox->addItem(i18n("All Sounds")); | ||
358 | typeBox->insertSeparator(typeBox->count()); // append separator | ||||
358 | 359 | | |||
359 | QtConcurrent::run([this] { | 360 | QtConcurrent::run([this] { | ||
360 | initMimeTypes(); | 361 | initMimeTypes(); | ||
361 | initSpecialMimeTypes(); | 362 | initSpecialMimeTypes(); | ||
362 | 363 | | |||
363 | for (auto it = m_types.constBegin(), end = m_types.constEnd(); it != end; ++it) { | 364 | for (auto it = m_types.constBegin(), end = m_types.constEnd(); it != end; ++it) { | ||
364 | KMimeType::Ptr typ = *it; | 365 | KMimeType::Ptr typ = *it; | ||
365 | typeBox->addItem(QIcon::fromTheme(typ->iconName()), typ->comment()); | 366 | typeBox->addItem(QIcon::fromTheme(typ->iconName()), typ->comment()); | ||
▲ Show 20 Lines • Show All 385 Lines • ▼ Show 20 Line(s) | 751 | } else { | |||
751 | query->setTimeRange(0, 0); | 752 | query->setTimeRange(0, 0); | ||
752 | } | 753 | } | ||
753 | 754 | | |||
754 | query->setUsername(m_usernameBox->currentText()); | 755 | query->setUsername(m_usernameBox->currentText()); | ||
755 | query->setGroupname(m_groupBox->currentText()); | 756 | query->setGroupname(m_groupBox->currentText()); | ||
756 | 757 | | |||
757 | query->setFileType(typeBox->currentIndex()); | 758 | query->setFileType(typeBox->currentIndex()); | ||
758 | 759 | | |||
759 | int id = typeBox->currentIndex()-10; | 760 | int id = typeBox->currentIndex() - SPECIAL_TYPES - 1 /*the separator*/; | ||
760 | 761 | | |||
761 | if ((id >= -3) && (id < (int)m_types.count())) { | 762 | if ((id >= -4) && (id < (int)m_types.count())) { | ||
762 | switch (id) { | 763 | switch (id) { | ||
763 | case -3: | 764 | case -4: | ||
764 | query->setMimeType(m_ImageTypes); | 765 | query->setMimeType(m_ImageTypes); | ||
765 | break; | 766 | break; | ||
766 | case -2: | 767 | case -3: | ||
767 | query->setMimeType(m_VideoTypes); | 768 | query->setMimeType(m_VideoTypes); | ||
768 | break; | 769 | break; | ||
769 | case -1: | 770 | case -2: | ||
770 | query->setMimeType(m_AudioTypes); | 771 | query->setMimeType(m_AudioTypes); | ||
771 | break; | 772 | break; | ||
772 | default: | 773 | default: | ||
773 | query->setMimeType(QStringList() += m_types[id]->name()); | 774 | query->setMimeType(QStringList() += m_types[id]->name()); | ||
774 | } | 775 | } | ||
775 | } else { | 776 | } else { | ||
776 | query->setMimeType(QStringList()); | 777 | query->setMimeType(QStringList()); | ||
777 | } | 778 | } | ||
▲ Show 20 Lines • Show All 180 Lines • Show Last 20 Lines |
static const int, while you're at it ;)