Adjust translation and move notify code to the front of copy clipboard.
Andy Stewart
6 years ago
57 | 57 |
Settings *settings = new Settings();
|
58 | 58 |
settings->setOption("color_type", colorType);
|
59 | 59 |
|
60 | |
// Copy to clipbard.
|
61 | |
QClipboard *clipboard = QApplication::clipboard();
|
62 | |
clipboard->setText(colorString);
|
63 | |
|
64 | 60 |
// Popup notify.
|
|
61 |
// We need poup notify in first time, because copy to clipboard maybe block event loop.
|
65 | 62 |
QDBusInterface notification("org.freedesktop.Notifications",
|
66 | 63 |
"/org/freedesktop/Notifications",
|
67 | 64 |
"org.freedesktop.Notifications",
|
|
71 | 68 |
QVariantMap hints;
|
72 | 69 |
|
73 | 70 |
QList<QVariant> arg;
|
74 | |
arg << (QCoreApplication::applicationName()) // appname
|
75 | |
<< ((unsigned int) 0) // id
|
76 | |
<< QString("deepin-picker") // icon
|
77 | |
<< tr("Deepin Picker") // summary
|
78 | |
<< QString(tr("Copy color %1 to system clipboard")).arg(colorString) // body
|
79 | |
<< actions // actions
|
80 | |
<< hints // hints
|
81 | |
<< (int) -1; // timeout
|
|
71 |
arg << (QCoreApplication::applicationName()) // appname
|
|
72 |
<< ((unsigned int) 0) // id
|
|
73 |
<< QString("deepin-picker") // icon
|
|
74 |
<< "" // summary
|
|
75 |
<< QString(tr("Copy color %1 to clipboard")).arg(colorString) // body
|
|
76 |
<< actions // actions
|
|
77 |
<< hints // hints
|
|
78 |
<< (int) -1; // timeout
|
82 | 79 |
notification.callWithArgumentList(QDBus::AutoDetect, "Notify", arg);
|
|
80 |
|
|
81 |
// Copy to clipbard.
|
|
82 |
QClipboard *clipboard = QApplication::clipboard();
|
|
83 |
clipboard->setText(colorString);
|
83 | 84 |
|
84 | 85 |
// Quit application.
|
85 | 86 |
QApplication::quit();
|
3 | 3 |
<context>
|
4 | 4 |
<name>Clipboard</name>
|
5 | 5 |
<message>
|
6 | |
<source>Deepin Picker</source>
|
7 | |
<translation type="unfinished"></translation>
|
8 | |
</message>
|
9 | |
<message>
|
10 | |
<source>Copy color %1 to system clipboard</source>
|
|
6 |
<source>Has copied the color %1 to the clipboard</source>
|
11 | 7 |
<translation type="unfinished"></translation>
|
12 | 8 |
</message>
|
13 | 9 |
</context>
|