mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
update translation and fix app can't uninstall
Change-Id: Icff64f76e156ac79ec4ba7d17fcca3bfccfcb8d8
This commit is contained in:
parent
e5565772df
commit
1b69f1180d
Notes:
Deepin Code Review
2016-06-14 07:19:47 +00:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: <mr.asianwang@gmail.com> Submitted-by: <mr.asianwang@gmail.com> Submitted-at: Tue, 29 Sep 2015 11:25:45 +0800 Reviewed-on: https://cr.deepin.io/7466 Project: dde/dde-dock Branch: refs/heads/master
@ -9,13 +9,15 @@ ClearTrashDialog::ClearTrashDialog(QWidget *parent):
|
||||
{
|
||||
|
||||
QString icon = ":/images/skin/dialogs/images/user-trash-full.png";
|
||||
QString message = tr("Are you sure to clear items in trash?");
|
||||
QString message = tr("Are you sure to empty trash?");
|
||||
QString tipMessage = tr("This action cannot be restored");
|
||||
QStringList buttons;
|
||||
buttons << tr("Cancel") << tr("Clear");
|
||||
QStringList buttons, buttonTexts;
|
||||
buttons << "Cancel" << "Empty";
|
||||
buttonTexts << tr("Cancel") << tr("Empty");
|
||||
initUI(icon, message, tipMessage, buttons, buttons);
|
||||
moveCenter();
|
||||
getButtonsGroup()->button(1)->setFocus();
|
||||
setButtonTexts(buttonTexts);
|
||||
}
|
||||
|
||||
void ClearTrashDialog::handleKeyEnter(){
|
||||
|
@ -7,13 +7,15 @@
|
||||
ConfirmUninstallDialog::ConfirmUninstallDialog(QWidget *parent) : DBaseDialog(parent)
|
||||
{
|
||||
QString icon = ":/images/skin/dialogs/images/user-trash-full.png";
|
||||
QString message = tr("Are you sure to uninstall this application?");
|
||||
QString tipMessage = tr("This action cannot be restored");
|
||||
QStringList buttons;
|
||||
buttons << tr("Cancel") << tr("Ok");
|
||||
QString message = "Are you sure to uninstall this application?";
|
||||
QString tipMessage = tr("All dependencies will be removed together");
|
||||
QStringList buttons, buttonTexts;
|
||||
buttons << "Cancel" << "Confirm";
|
||||
buttonTexts << tr("Cancel") << tr("Confirm");
|
||||
initUI(icon, message, tipMessage, buttons, buttons);
|
||||
moveCenter();
|
||||
getButtonsGroup()->button(1)->setFocus();
|
||||
setButtonTexts(buttonTexts);
|
||||
}
|
||||
|
||||
void ConfirmUninstallDialog::handleKeyEnter(){
|
||||
|
@ -81,29 +81,29 @@ void MainItem::dropEvent(QDropEvent *event)
|
||||
if (event->source())
|
||||
return;
|
||||
|
||||
QStringList formats = event->mimeData()->formats();
|
||||
if (formats.indexOf("_DEEPIN_DND") != -1 && formats.indexOf("text/plain") != -1)//Application
|
||||
{
|
||||
QString jsonStr = QString(event->mimeData()->data("_DEEPIN_DND")).split("uninstall").last().trimmed();
|
||||
if (event->mimeData()->formats().indexOf("RequestDock") != -1){ //from desktop or launcher
|
||||
QJsonObject dataObj = QJsonDocument::fromJson(event->mimeData()->data("RequestDock")).object();
|
||||
if (!dataObj.isEmpty()){
|
||||
QString appKey = dataObj.value("appKey").toString();
|
||||
QString appName = dataObj.value("appName").toString();
|
||||
if (appKey.isEmpty())
|
||||
return;
|
||||
event->ignore();
|
||||
|
||||
//Tim at both ends of the string is added to a character SOH (start of heading)
|
||||
jsonStr = jsonStr.mid(1,jsonStr.length() - 2);
|
||||
QJsonObject dataObj = QJsonDocument::fromJson(jsonStr.trimmed().toUtf8()).object();
|
||||
if (dataObj.isEmpty())
|
||||
return;
|
||||
|
||||
ConfirmUninstallDialog *dialog = new ConfirmUninstallDialog;
|
||||
QString message = tr("Are you sure to uninstall \"%1\"").arg(dataObj.value("name").toString());
|
||||
dialog->setMessage(message);
|
||||
dialog->setIcon(getThemeIconPath(dataObj.value("icon").toString()));
|
||||
connect(dialog, &ConfirmUninstallDialog::buttonClicked, [=](int key){
|
||||
dialog->deleteLater();
|
||||
if (key == 1){
|
||||
qWarning() << "Uninstall application:" << dataObj.value("id").toString();
|
||||
m_launcher->RequestUninstall(dataObj.value("id").toString(), true);
|
||||
}
|
||||
});
|
||||
dialog->exec();
|
||||
ConfirmUninstallDialog *dialog = new ConfirmUninstallDialog;
|
||||
//TODO: need real icon name
|
||||
dialog->setIcon(getThemeIconPath(appKey));
|
||||
QString message = tr("Are you sure to uninstall %1?").arg(appName);
|
||||
dialog->setMessage(message);
|
||||
connect(dialog, &ConfirmUninstallDialog::buttonClicked, [=](int key){
|
||||
dialog->deleteLater();
|
||||
if (key == 1){
|
||||
qWarning() << "Uninstall application:" << appKey << appName;
|
||||
m_launcher->RequestUninstall(appKey, true);
|
||||
}
|
||||
});
|
||||
dialog->exec();
|
||||
}
|
||||
}
|
||||
else//File or Dirctory
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user