diff --git a/src/settings-widget.cpp b/src/settings-widget.cpp index 1e921b7..69624a3 100644 --- a/src/settings-widget.cpp +++ b/src/settings-widget.cpp @@ -264,9 +264,11 @@ void SettingsWidget::refreshIndexState() * @param path 文件夹路径 */ void SettingsWidget::onBtnDelClicked(const QString& path) { - QMessageBox message(QMessageBox::Question, tr("Search"), tr("Whether to delete this directory?"), QMessageBox::No | QMessageBox::Yes, this); + QMessageBox message(QMessageBox::Question, tr("Search"), tr("Whether to delete this directory?")); + QPushButton * buttonYes = message.addButton(tr("Yes"), QMessageBox::YesRole); + QPushButton * buttonNo = message.addButton(tr("No"), QMessageBox::NoRole); message.exec(); - if (message.clickedButton() != message.button(QMessageBox::Yes)) { + if (message.clickedButton() != buttonYes) { return; } @@ -283,11 +285,7 @@ void SettingsWidget::onBtnDelClicked(const QString& path) { } } } else { -// qWarning()<selectedFiles().first(); qDebug()<<"Selected a folder in onBtnAddClicked(): "<settings-widget.cpp #238"; @@ -372,12 +369,7 @@ void SettingsWidget::onBtnAddClicked() { setupBlackList(GlobalSettings::getInstance()->getBlockDirs()); qDebug()<<"Add block dir in onBtnAddClicked() successed. ->settings-widget.cpp #238"; } else { -// qWarning()<settings-widget.cpp #238"; -// QMessageBox::warning(this, tr("Search"), returnMessage); - - QMessageBox message(QMessageBox::Warning, tr("Search"), QString::number(returnCode), QMessageBox::Ok, this); - message.exec(); + showWarningDialog(returnCode); } } @@ -439,12 +431,42 @@ void SettingsWidget::resize() // } else { // this->setFixedSize(528, 515); // } - if (m_blockdirs <= 3) { - m_dirListArea->setFixedHeight(32 * m_blockdirs); + if (m_blockdirs <= 4) { + m_dirListArea->setFixedHeight(32 * m_blockdirs + 5); m_dirListWidget->setFixedHeight(32 * m_blockdirs); } else { - m_dirListWidget->setFixedHeight(32 * m_blockdirs); - m_dirListArea->setFixedHeight(32 * 3); + m_dirListWidget->setFixedHeight(32 * m_blockdirs + 5); + m_dirListArea->setFixedHeight(32 * 4); } this->setFixedSize(528, 455); } + +/** + * @brief SettingsWidget::showWarningDialog 显示警告弹窗 + * @param errorCode 错误码 + */ +void SettingsWidget::showWarningDialog(const int & errorCode) +{ + qWarning()<<"Add block dir in onBtnAddClicked() failed. Code: "<settings-widget.cpp #238"; + QString errorMessage; + switch (errorCode) { + case 1: { + errorMessage = tr("Choosen path is Empty!"); + break; + } + case 2: { + errorMessage = tr("Choosen path is not in \"home\"!"); + break; + } + case 3: { + errorMessage = tr("Its' parent folder has been blocked!"); + break; + } + default: { + errorMessage = tr("Set blocked folder failed!"); + break; + } + } + QMessageBox message(QMessageBox::Warning, tr("Search"), errorMessage, QMessageBox::Ok, this); + message.exec(); +} diff --git a/src/settings-widget.h b/src/settings-widget.h index 7ed2628..bab5124 100644 --- a/src/settings-widget.h +++ b/src/settings-widget.h @@ -51,6 +51,7 @@ private: void refreshIndexState(); void paintEvent(QPaintEvent *); void resize(); + void showWarningDialog(const int&); //标题栏 QVBoxLayout * m_mainLyt = nullptr; QFrame * m_titleFrame = nullptr; diff --git a/translations/ukui-search/bo.ts b/translations/ukui-search/bo.ts index 71aef87..0fc759c 100644 --- a/translations/ukui-search/bo.ts +++ b/translations/ukui-search/bo.ts @@ -4,52 +4,52 @@ ContentWidget - + Recently Opened - + Open Quickly - + Commonly Used - + Apps - + Settings - + Files - + Dirs - + File Contents - + Best Matches - + Unknown @@ -57,7 +57,7 @@ FolderListItem - + Delete the folder out of blacklist @@ -65,17 +65,17 @@ MainWindow - + ukui-search - + Global Search - + Search @@ -83,27 +83,27 @@ OptionView - + Open - + Add Shortcut to Desktop - + Add Shortcut to Panel - + Open path - + Copy path @@ -111,7 +111,7 @@ QObject - + ukui-search is already running! @@ -119,7 +119,7 @@ SearchBarHLayout - + Search @@ -127,22 +127,22 @@ SearchDetailView - + Path - + Last time modified - + Application - + Document @@ -150,161 +150,190 @@ SettingsWidget - - - - + + + Search - - + + ... - + Following folders will not be searched. You can set it by adding and removing folders. - + Add ignored folders - + Please select search engine you preferred. - + baidu - + sougou - + 360 - + Cancel - + Creating ... - + ukui-search - + <h2>Settings</h2> - + <h3>Index State</h3> - + <h3>File Index Settings</h3> - + <h3>Search Engine Settings</h3> - + Whether to delete this directory? - + + Yes + + + + + No + + + + Done - + Index Entry: %1 - + Directories - + select blocked folder - + Select - + Position: - + FileName: - + FileType: + + + Choosen path is Empty! + + + + + Choosen path is not in "home"! + + + + + Its' parent folder has been blocked! + + + + + Set blocked folder failed! + + ShowMoreLabel - - - + + + Show More... - + Retract - + Loading - + Loading. - + Loading.. - + Loading... diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index 71aef87..0fc759c 100644 --- a/translations/ukui-search/tr.ts +++ b/translations/ukui-search/tr.ts @@ -4,52 +4,52 @@ ContentWidget - + Recently Opened - + Open Quickly - + Commonly Used - + Apps - + Settings - + Files - + Dirs - + File Contents - + Best Matches - + Unknown @@ -57,7 +57,7 @@ FolderListItem - + Delete the folder out of blacklist @@ -65,17 +65,17 @@ MainWindow - + ukui-search - + Global Search - + Search @@ -83,27 +83,27 @@ OptionView - + Open - + Add Shortcut to Desktop - + Add Shortcut to Panel - + Open path - + Copy path @@ -111,7 +111,7 @@ QObject - + ukui-search is already running! @@ -119,7 +119,7 @@ SearchBarHLayout - + Search @@ -127,22 +127,22 @@ SearchDetailView - + Path - + Last time modified - + Application - + Document @@ -150,161 +150,190 @@ SettingsWidget - - - - + + + Search - - + + ... - + Following folders will not be searched. You can set it by adding and removing folders. - + Add ignored folders - + Please select search engine you preferred. - + baidu - + sougou - + 360 - + Cancel - + Creating ... - + ukui-search - + <h2>Settings</h2> - + <h3>Index State</h3> - + <h3>File Index Settings</h3> - + <h3>Search Engine Settings</h3> - + Whether to delete this directory? - + + Yes + + + + + No + + + + Done - + Index Entry: %1 - + Directories - + select blocked folder - + Select - + Position: - + FileName: - + FileType: + + + Choosen path is Empty! + + + + + Choosen path is not in "home"! + + + + + Its' parent folder has been blocked! + + + + + Set blocked folder failed! + + ShowMoreLabel - - - + + + Show More... - + Retract - + Loading - + Loading. - + Loading.. - + Loading... diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index 859406e..b8f85eb 100644 --- a/translations/ukui-search/zh_CN.ts +++ b/translations/ukui-search/zh_CN.ts @@ -4,52 +4,52 @@ ContentWidget - + Recently Opened 最近 - + Open Quickly 快速 - + Commonly Used 常用 - + Apps 应用 - + Settings 配置项 - + Files 文件 - + Dirs 文件夹 - + File Contents 文件内容 - + Best Matches 最佳匹配 - + Unknown 未知 @@ -57,7 +57,7 @@ FolderListItem - + Delete the folder out of blacklist 删除 @@ -65,17 +65,17 @@ MainWindow - + ukui-search 搜索 - + Global Search 搜索 - + Search 搜索 @@ -83,27 +83,27 @@ OptionView - + Open 打开 - + Add Shortcut to Desktop 添加到桌面快捷方式 - + Add Shortcut to Panel 添加到任务栏快捷方式 - + Open path 打开文件所在路径 - + Copy path 复制文件路径 @@ -111,7 +111,7 @@ QObject - + ukui-search is already running! @@ -119,7 +119,7 @@ SearchBarHLayout - + Search 搜索 @@ -127,22 +127,22 @@ SearchDetailView - + Path 路径 - + Last time modified 上次修改时间 - + Application 应用 - + Document 文件 @@ -150,126 +150,155 @@ SettingsWidget - - - - + + + Search 搜索 - + <h2>Settings</h2> <h2>设置</h2> - + <h3>Index State</h3> <h3>索引状态</h3> - - + + ... - + <h3>File Index Settings</h3> <h3>文件索引设置</h3> - + Following folders will not be searched. You can set it by adding and removing folders. 搜索将不再查看以下文件夹。通过增加和删除文件夹可进行文件索引设置。 - + Add ignored folders 添加文件夹至黑名单 - + <h3>Search Engine Settings</h3> <h3>搜索引擎设置</h3> - + Please select search engine you preferred. 设置互联网搜索引擎 - + baidu 百度 - + sougou 搜狗 - + 360 360 - + Whether to delete this directory? 是否要删除此目录 - + + Yes + 是(Y) + + + + No + 否(N) + + + Cancel 取消 - + + Choosen path is Empty! + 选择的路径不存在! + + + + Choosen path is not in "home"! + 请选择家目录下的文件夹! + + + + Its' parent folder has been blocked! + 父文件夹已被屏蔽! + + + + Set blocked folder failed! + + + + Creating ... 正在索引 - + ukui-search 搜索 - + Done 索引完成 - + Index Entry: %1 索引项: %1 - + Directories 文件夹 - + select blocked folder 选择屏蔽文件夹 - + Select 选择 - + Position: 位置: - + FileName: 名称: - + FileType: 类型: @@ -277,34 +306,34 @@ ShowMoreLabel - - - + + + Show More... 显示更多... - + Retract 收起 - + Loading 加载中 - + Loading. 加载中. - + Loading.. 加载中.. - + Loading... 加载中...