Changeset View
Changeset View
Standalone View
Standalone View
krfb/mainwindow.cpp
Show First 20 Lines • Show All 220 Lines • ▼ Show 20 Line(s) | 220 | { | |||
---|---|---|---|---|---|
221 | KMessageBox::about(this, | 221 | KMessageBox::about(this, | ||
222 | i18n("Any remote user with normal desktop sharing password will have to be authenticated.\n\nIf unattended access is on, and the remote user provides unattended mode password, desktop sharing access will be granted without explicit confirmation."), | 222 | i18n("Any remote user with normal desktop sharing password will have to be authenticated.\n\nIf unattended access is on, and the remote user provides unattended mode password, desktop sharing access will be granted without explicit confirmation."), | ||
223 | i18n("KDE Desktop Sharing")); | 223 | i18n("KDE Desktop Sharing")); | ||
224 | } | 224 | } | ||
225 | 225 | | |||
226 | void MainWindow::showConfiguration() | 226 | void MainWindow::showConfiguration() | ||
227 | { | 227 | { | ||
228 | static QString s_prevFramebufferPlugin; | 228 | static QString s_prevFramebufferPlugin; | ||
229 | static bool s_prevNoWallet; | ||||
229 | // ^^ needs to be static, because lambda will be called long time | 230 | // ^^ needs to be static, because lambda will be called long time | ||
230 | // after showConfiguration() ends, so auto variable would go out of scope | 231 | // after showConfiguration() ends, so auto variable would go out of scope | ||
231 | // save previously selected framebuffer plugin config | 232 | // save previously selected framebuffer plugin config | ||
232 | s_prevFramebufferPlugin = KrfbConfig::preferredFrameBufferPlugin(); | 233 | s_prevFramebufferPlugin = KrfbConfig::preferredFrameBufferPlugin(); | ||
234 | s_prevNoWallet = KrfbConfig::noWallet(); | ||||
233 | 235 | | |||
234 | if (KConfigDialog::showDialog("settings")) { | 236 | if (KConfigDialog::showDialog("settings")) { | ||
235 | return; | 237 | return; | ||
236 | } | 238 | } | ||
237 | 239 | | |||
238 | KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self()); | 240 | KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self()); | ||
239 | dialog->addPage(new TCP, i18n("Network"), "network-wired"); | 241 | dialog->addPage(new TCP, i18n("Network"), "network-wired"); | ||
240 | dialog->addPage(new Security, i18n("Security"), "security-high"); | 242 | dialog->addPage(new Security, i18n("Security"), "security-high"); | ||
241 | dialog->addPage(new ConfigFramebuffer, i18n("Screen capture"), "video-display"); | 243 | dialog->addPage(new ConfigFramebuffer, i18n("Screen capture"), "video-display"); | ||
242 | dialog->show(); | 244 | dialog->show(); | ||
243 | connect(dialog, &KConfigDialog::settingsChanged, [this] () { | 245 | connect(dialog, &KConfigDialog::settingsChanged, [this] () { | ||
244 | // check if framebuffer plugin config has changed | 246 | // check if framebuffer plugin config has changed | ||
245 | if (s_prevFramebufferPlugin != KrfbConfig::preferredFrameBufferPlugin()) { | 247 | if (s_prevFramebufferPlugin != KrfbConfig::preferredFrameBufferPlugin()) { | ||
246 | KMessageBox::information(this, i18n("To apply framebuffer plugin setting, " | 248 | KMessageBox::information(this, i18n("To apply framebuffer plugin setting, " | ||
247 | "you need to restart the program.")); | 249 | "you need to restart the program.")); | ||
248 | } | 250 | } | ||
251 | // check if kwallet config has changed | ||||
252 | if (s_prevNoWallet != KrfbConfig::noWallet()) { | ||||
253 | // try to apply settings immediately | ||||
254 | if (KrfbConfig::noWallet()) { | ||||
255 | InvitationsRfbServer::instance->closeKWallet(); | ||||
256 | } else { | ||||
257 | InvitationsRfbServer::instance->openKWallet(); | ||||
258 | // erase stored passwords from krfbconfig file | ||||
259 | KConfigGroup securityConfigGroup(KSharedConfig::openConfig(), "Security"); | ||||
260 | securityConfigGroup.deleteEntry("desktopPassword"); | ||||
261 | securityConfigGroup.deleteEntry("unattendedPassword"); | ||||
262 | } | ||||
263 | } | ||||
249 | }); | 264 | }); | ||
250 | } | 265 | } | ||
251 | 266 | | |||
252 | void MainWindow::readProperties(const KConfigGroup& group) | 267 | void MainWindow::readProperties(const KConfigGroup& group) | ||
253 | { | 268 | { | ||
254 | if (group.readEntry("Visible", true)) { | 269 | if (group.readEntry("Visible", true)) { | ||
255 | show(); | 270 | show(); | ||
256 | } | 271 | } | ||
257 | KMainWindow::readProperties(group); | 272 | KMainWindow::readProperties(group); | ||
258 | } | 273 | } | ||
259 | 274 | | |||
260 | void MainWindow::saveProperties(KConfigGroup& group) | 275 | void MainWindow::saveProperties(KConfigGroup& group) | ||
261 | { | 276 | { | ||
262 | group.writeEntry("Visible", isVisible()); | 277 | group.writeEntry("Visible", isVisible()); | ||
263 | KMainWindow::saveProperties(group); | 278 | KMainWindow::saveProperties(group); | ||
264 | } | 279 | } |