connect(&vncThread, SIGNAL(passwordRequest()), this, SLOT(requestPassword()), Qt::BlockingQueuedConnection);
connect(&vncThread, SIGNAL(outputErrorMessage(QString)), this, SLOT(outputErrorMessage(QString)));
+ //don't miss early connection failures
+ connect(&vncThread, SIGNAL(finished()), this, SLOT(startQuitting()));
+
m_clipboard = QApplication::clipboard();
connect(m_clipboard, SIGNAL(selectionChanged()), this, SLOT(clipboardSelectionChanged()));
connect(m_clipboard, SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
void VncView::startQuitting()
{
+ if(isQuitting())
+ return;
+
kDebug(5011) << "about to quit";
//const bool connected = status() == RemoteView::Connected;
QHBoxLayout layout1;
QVBoxLayout layout2;
layout2.addWidget(&passwordbox);
- layout2.addWidget(&save_password);
+ if(!m_host.isEmpty()) //don't save incomming connections
+ layout2.addWidget(&save_password);
layout1.addLayout(&layout2);
layout1.addWidget(&ok_button);
dialog.setLayout(&layout1);
if(dialog.exec()) { //dialog accepted
password = passwordbox.text();
- if(save_password.isChecked()) {
+ if(!m_host.isEmpty() and save_password.isChecked()) {
kDebug(5011) << "Saving password for host '" << m_host << "'";
settings.setValue(QString("%1/password").arg(m_host), password);
vncThread.setPassword(password);
} else {
- startQuitting();
+ vncThread.setPassword(QString()); //null string to exit
}
}
void VncView::outputErrorMessage(const QString &message)
{
- kDebug(5011) << message;
-
if (message == "INTERNAL:APPLE_VNC_COMPATIBILTY") {
setCursor(localDotCursor());
m_forceLocalCursor = true;
//to get at individual key presses, we split 'keys' into its components
QList<int> key_list;
- for(int i = 0; ; i++) {
- QString k = keys.toString().section('+', i, i);
+ int pos = 0;
+ while(true) {
+ QString k = keys.toString().section('+', pos, pos);
if(k.isEmpty())
break;
+
//kDebug(5011) << "found key: " << k;
if(k == "Alt") {
key_list.append(Qt::Key_Alt);
} else {
key_list.append(QKeySequence(k)[0]);
}
+
+ pos++;
}
for(int i = 0; i < key_list.count(); i++)