diff --git a/deepin-screenshot-no-notification.patch b/deepin-screenshot-no-notification.patch new file mode 100644 index 0000000..af753af --- /dev/null +++ b/deepin-screenshot-no-notification.patch @@ -0,0 +1,175 @@ +diff --git a/src/dbusservice/dbusscreenshotservice.cpp b/src/dbusservice/dbusscreenshotservice.cpp +index 75ea15b..de057f3 100644 +--- a/src/dbusservice/dbusscreenshotservice.cpp ++++ b/src/dbusservice/dbusscreenshotservice.cpp +@@ -80,8 +80,10 @@ void DBusScreenshotService::NoNotifyScreenshot() + { + qDebug() << "DBus screenshot service! nonofiy screenshot"; + // handle method call com.deepin.Screenshot.NoNotify +- if (!m_singleInstance) +- parent()->noNotifyScreenshot(); ++ if (!m_singleInstance) { ++ parent()->noNotify(); ++ parent()->startScreenshot(); ++ } + m_singleInstance = true; + } + +diff --git a/src/main.cpp b/src/main.cpp +index 2ce8658..74668c6 100644 +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -91,6 +91,11 @@ int main(int argc, char *argv[]) + return 0; + } + ++ if (cmdParser.isSet(prohibitNotifyOption)) { ++ qDebug() << "screenshot no notify!"; ++ w.noNotify(); ++ } ++ + if (cmdParser.isSet(dbusOption)) + { + qDebug() << "dbus register waiting!"; +@@ -108,9 +113,6 @@ int main(int argc, char *argv[]) + } else if (cmdParser.isSet(savePathOption)) { + qDebug() << "cmd savepath screenshot"; + w.savePathScreenshot(cmdParser.value(savePathOption)); +- } else if (cmdParser.isSet(prohibitNotifyOption)) { +- qDebug() << "screenshot no notify!"; +- w.noNotifyScreenshot(); + } else if (cmdParser.isSet(iconOption)) { + w.delayScreenshot(0.2); + } else { +diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp +index def901e..f1e0a59 100644 +--- a/src/mainwindow.cpp ++++ b/src/mainwindow.cpp +@@ -1042,8 +1042,9 @@ void MainWindow::saveSpecificedPath(QString path) + + QString summary = QString(tr("Picture has been saved to %1")).arg(savePath); + +- m_notifyDBInterface->Notify("Deepin Screenshot", 0, "deepin-screenshot", "", +- summary, actions, hints, 0); ++ if (!m_noNotify) ++ m_notifyDBInterface->Notify("Deepin Screenshot", 0, "deepin-screenshot", "", ++ summary, actions, hints, 0); + exitApp(); + } + +@@ -1073,15 +1074,7 @@ void MainWindow::saveSpecificedPath(QString path) + + void MainWindow::noNotify() + { +- m_controlCenterDBInterface = new DBusControlCenter(this); +- m_hotZoneInterface = new DBusZone(this); +- m_interfaceExist = true; + m_noNotify = true; +- +- initOriginUI(); +- this->show(); +- initSecondUI(); +- initShortcut(); + } + + void MainWindow::topWindow() +@@ -1414,7 +1407,8 @@ void MainWindow::sendNotify(SaveAction saveAction, QString saveFilePath, const b + if (!succeed) + { + const auto tips = tr("Save failed. Please save it in your home directory."); +- m_notifyDBInterface->Notify("Deepin Screenshot", 0, "deepin-screenshot", QString(), tips, QStringList(), QVariantMap(), 0); ++ if (!m_noNotify) ++ m_notifyDBInterface->Notify("Deepin Screenshot", 0, "deepin-screenshot", QString(), tips, QStringList(), QVariantMap(), 0); + + exit(0); + } +diff --git a/src/mainwindow.h b/src/mainwindow.h +index d27eade..8915eff 100644 +--- a/src/mainwindow.h ++++ b/src/mainwindow.h +@@ -72,6 +72,7 @@ public: + void initShapeWidget(QString type); + void initDBusInterface(); + void initShortcut(); ++ void noNotify(); + + signals: + void deleteShapes(); +@@ -86,7 +87,6 @@ public slots: + void savePath(const QString &path); + void saveSpecificedPath(QString path); + // void delayScreenshot(int num); +- void noNotify(); + void topWindow(); + void expressSaveScreenshot(); + //Indicate that this program's started by clicking desktop file. +diff --git a/src/screenshot.cpp b/src/screenshot.cpp +index 4ced427..94542f4 100644 +--- a/src/screenshot.cpp ++++ b/src/screenshot.cpp +@@ -38,6 +38,14 @@ Screenshot::Screenshot(QObject *parent) + void Screenshot::initUI() { + m_eventContainer = new EventContainer(this); + m_window = new MainWindow; ++ if (m_noNotify) { ++ m_window->noNotify(); ++ } ++} ++ ++void Screenshot::noNotify() ++{ ++ m_noNotify = true; + } + + void Screenshot::startScreenshot() +@@ -54,7 +62,7 @@ void Screenshot::delayScreenshot(double num) + QStringList actions = QStringList(); + QVariantMap hints; + DBusNotify* notifyDBus = new DBusNotify(this); +- if (num >= 2) { ++ if (num >= 2 && !m_noNotify) { + notifyDBus->Notify("Deepin Screenshot", 0, "deepin-screenshot", "", + summary, actions, hints, 0); + } +@@ -82,13 +90,6 @@ void Screenshot::topWindowScreenshot() + m_window->topWindow(); + } + +-void Screenshot::noNotifyScreenshot() +-{ +- initUI(); +- m_window->show(); +- m_window->noNotify(); +-} +- + void Screenshot::savePathScreenshot(const QString &path) + { + initUI(); +diff --git a/src/screenshot.h b/src/screenshot.h +index 76d3e72..1c1f0dd 100644 +--- a/src/screenshot.h ++++ b/src/screenshot.h +@@ -29,12 +29,13 @@ public: + Screenshot(QObject* parent = 0); + ~Screenshot(); + ++ void noNotify(); ++ + public slots: + void startScreenshot(); + void delayScreenshot(double num); + void fullscreenScreenshot(); + void topWindowScreenshot(); +- void noNotifyScreenshot(); + void savePathScreenshot(const QString &path); + + private: +@@ -42,7 +43,7 @@ private: + + EventContainer* m_eventContainer = nullptr; + MainWindow* m_window = nullptr; +- ++ bool m_noNotify = false; + }; + + #endif // SCREENSHOT_H diff --git a/deepin-screenshot.spec b/deepin-screenshot.spec index 9f8cf0d..f8f0c81 100644 --- a/deepin-screenshot.spec +++ b/deepin-screenshot.spec @@ -1,12 +1,14 @@ Name: deepin-screenshot Version: 5.0.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Deepin Screenshot Tool Summary(zh_CN): 深度截图工具 License: GPLv3 Url: https://github.com/linuxdeepin/deepin-screenshot Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Source1: %{name}-appdata.xml +# follow changes from Arch +Patch0: https://raw.githubusercontent.com/archlinux/svntogit-community/e244b11755511b0eb84636302993a84a7bc7273c/trunk/deepin-screenshot-no-notification.patch BuildRequires: cmake BuildRequires: pkgconfig(dtkwidget) >= 2.0.6 @@ -39,6 +41,8 @@ Provide a quite easy-to-use screenshot tool. Features: %prep %setup -q +# fix for Qt 5.15 +sed -i '1i #include ' src/widgets/shapeswidget.cpp # Disable using deepin-turbo, which is not yet available in Fedora sed -i 's/deepin-turbo-invoker.*deepin/deepin/' \ src/dbusservice/com.deepin.Screenshot.service deepin-screenshot.desktop @@ -76,6 +80,9 @@ fi %{_datadir}/icons/hicolor/scalable/apps/%{name}.svg %changelog +* Fri Nov 13 2020 Robin Lee - 5.0.0-5 +- Rebuild for DTK5 + * Fri Aug 7 2020 Robin Lee - 5.0.0-4 - Improve compatibility with new CMake macro