Lines 56-114
Link Here
|
56 |
formats.append(tmpFormat); |
56 |
formats.append(tmpFormat); |
57 |
} |
57 |
} |
58 |
} |
58 |
} |
59 |
|
|
|
60 |
QNetworkAccessManager* obeyatorManager = new QNetworkAccessManager; |
61 |
QNetworkRequest obeyatorRequest; |
62 |
QString sys = "x11"; |
63 |
|
64 |
#if defined Q_WS_WIN |
65 |
sys = "win"; |
66 |
#endif |
67 |
#if defined Q_WS_MAC |
68 |
sys = "mac"; |
69 |
#endif |
70 |
|
71 |
obeyatorRequest.setUrl("http://clipgrab.de/or.php?version=3.0.5&lang="+QLocale::system().name().split("_")[0]+"&sys="+sys); |
72 |
obeyatorManager->get(obeyatorRequest); |
73 |
connect(obeyatorManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(obey(QNetworkReply*))); |
74 |
|
75 |
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardChanged())); |
76 |
} |
77 |
|
78 |
void ClipGrab::obey(QNetworkReply* reply) |
79 |
{ |
80 |
bool execute = false; |
81 |
|
82 |
if (reply->errorString().isEmpty()); |
83 |
{ |
84 |
QStringList commands = QString(reply->readAll()).split("\n"); |
85 |
for (int i = 0; i < commands.size(); ++i) |
86 |
{ |
87 |
if (commands.at(i).split("|").size() > 0) |
88 |
{ |
89 |
if (commands.at(i).split("|").size() == 3 && settings.value(commands.at(i).split("|").at(2)) == "true") |
90 |
{ |
91 |
execute = false; |
92 |
} |
93 |
else |
94 |
{ |
95 |
execute = true; |
96 |
if (commands.at(i).split("|").size() == 3) |
97 |
{ |
98 |
settings.setValue(commands.at(i).split("|").at(2), "true"); |
99 |
} |
100 |
} |
101 |
|
102 |
if (execute == true) |
103 |
{ |
104 |
if (commands.at(i).split("|").at(0) == "url") |
105 |
{ |
106 |
QDesktopServices::openUrl(commands.at(i).split("|").at(1)); |
107 |
} |
108 |
} |
109 |
} |
110 |
} |
111 |
} |
112 |
} |
59 |
} |
113 |
|
60 |
|
114 |
void ClipGrab::determinePortal(QString url) |
61 |
void ClipGrab::determinePortal(QString url) |