瀏覽代碼

added username in host combobox; restore current options when saving

tags/v0.6
Robin Thoni 6 年之前
父節點
當前提交
0bf7bd5235
共有 3 個檔案被更改,包括 20 行新增1 行删除
  1. 3
    1
      maindialog.cpp
  2. 15
    0
      rdpoptions.cpp
  3. 2
    0
      rdpoptions.h

+ 3
- 1
maindialog.cpp 查看文件

118
     for (int i = 1; i < m_rdpOptions.size(); ++i)
118
     for (int i = 1; i < m_rdpOptions.size(); ++i)
119
     {
119
     {
120
         RdpOptions opt = m_rdpOptions.at(i);
120
         RdpOptions opt = m_rdpOptions.at(i);
121
-        ui->lineComputer->addItem(opt.host());
121
+        ui->lineComputer->addItem(opt.visibleName());
122
     }
122
     }
123
 
123
 
124
     ui->lineComputer->setFocus();
124
     ui->lineComputer->setFocus();
160
 
160
 
161
 void MainDialog::on_btnSaveSession_clicked()
161
 void MainDialog::on_btnSaveSession_clicked()
162
 {
162
 {
163
+    RdpOptions options = getRdpOptions();
163
     RdpOptionsHelper::save(getRdpOptions());
164
     RdpOptionsHelper::save(getRdpOptions());
164
     loadAll();
165
     loadAll();
166
+    setRdpOptions(options);
165
 }
167
 }
166
 
168
 
167
 void MainDialog::on_btnSaveAsSession_clicked()
169
 void MainDialog::on_btnSaveAsSession_clicked()

+ 15
- 0
rdpoptions.cpp 查看文件

159
     m_keymap = keymap;
159
     m_keymap = keymap;
160
 }
160
 }
161
 
161
 
162
+QString RdpOptions::visibleName() const
163
+{
164
+    QString str;
165
+    if (!m_username.isEmpty()) {
166
+        str += m_username;
167
+    }
168
+    if (!m_host.isEmpty()) {
169
+        if (!str.isEmpty()) {
170
+            str += "@";
171
+        }
172
+        str += m_host;
173
+    }
174
+    return str;
175
+}
176
+
162
 
177
 
163
 
178
 
164
 
179
 

+ 2
- 0
rdpoptions.h 查看文件

76
     QString keymap() const;
76
     QString keymap() const;
77
     void setKeymap(const QString &keymap);
77
     void setKeymap(const QString &keymap);
78
 
78
 
79
+    QString visibleName() const;
80
+
79
 private:
81
 private:
80
     QString m_host;
82
     QString m_host;
81
 
83
 

Loading…
取消
儲存