Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/shell/sessionchooserdialog.cpp
Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Line(s) | 190 | { | |||
---|---|---|---|---|---|
191 | return m_mainWidget; | 191 | return m_mainWidget; | ||
192 | } | 192 | } | ||
193 | 193 | | |||
194 | void SessionChooserDialog::deleteButtonPressed() | 194 | void SessionChooserDialog::deleteButtonPressed() | ||
195 | { | 195 | { | ||
196 | if(m_deleteCandidateRow == -1) | 196 | if(m_deleteCandidateRow == -1) | ||
197 | return; | 197 | return; | ||
198 | 198 | | |||
199 | QModelIndex index = m_model->index(m_deleteCandidateRow, 0); | 199 | QModelIndex uuidIndex = m_model->index(m_deleteCandidateRow, 0); | ||
200 | const QString uuid = m_model->data(index, Qt::DisplayRole).toString(); | 200 | QModelIndex sessionNameIndex = m_model->index(m_deleteCandidateRow, 3); | ||
201 | const QString uuid = m_model->data(uuidIndex, Qt::DisplayRole).toString(); | ||||
202 | const QString sessionName = m_model->data(sessionNameIndex, Qt::DisplayRole).toString(); | ||||
201 | 203 | | |||
202 | TryLockSessionResult result = SessionController::tryLockSession( uuid ); | 204 | TryLockSessionResult result = SessionController::tryLockSession( uuid ); | ||
203 | if( !result.lock ) { | 205 | if( !result.lock ) { | ||
204 | const QString errCaption = i18nc("@title", "Cannot Delete Session"); | 206 | const QString errCaption = i18nc("@title", "Cannot Delete Session"); | ||
205 | QString errText = i18nc("@info", "<p>Cannot delete a locked session."); | 207 | QString errText = i18nc("@info", "<p>Cannot delete a locked session."); | ||
206 | 208 | | |||
207 | if( result.runInfo.holderPid != -1 ) { | 209 | if( result.runInfo.holderPid != -1 ) { | ||
208 | errText += i18nc("@info", "<p>The session is locked by %1 on %2 (PID %3).", | 210 | errText += i18nc("@info", "<p>The session <b>%1</b> is locked by %2 on %3 (PID %4).", | ||
209 | result.runInfo.holderApp, result.runInfo.holderHostname, result.runInfo.holderPid); | 211 | sessionName, result.runInfo.holderApp, result.runInfo.holderHostname, result.runInfo.holderPid); | ||
210 | } | 212 | } | ||
211 | 213 | | |||
212 | KMessageBox::error( this, errText, errCaption ); | 214 | KMessageBox::error( this, errText, errCaption ); | ||
213 | return; | 215 | return; | ||
214 | } | 216 | } | ||
215 | 217 | | |||
216 | const QString text = i18nc("@info", "The session and all contained settings will be deleted. The projects will stay unaffected. Do you really want to continue?"); | 218 | const QString text = i18nc("@info", "The session <b>%1</b> and all contained settings will be deleted. The projects will stay unaffected. Do you really want to continue?", sessionName); | ||
217 | const QString caption = i18nc("@title", "Delete Session"); | 219 | const QString caption = i18nc("@title", "Delete Session"); | ||
218 | const KGuiItem deleteItem = KStandardGuiItem::del(); | 220 | const KGuiItem deleteItem = KStandardGuiItem::del(); | ||
219 | const KGuiItem cancelItem = KStandardGuiItem::cancel(); | 221 | const KGuiItem cancelItem = KStandardGuiItem::cancel(); | ||
220 | 222 | | |||
221 | if(KMessageBox::warningYesNo(this, text, caption, deleteItem, cancelItem) == KMessageBox::Yes) { | 223 | if(KMessageBox::warningYesNo(this, text, caption, deleteItem, cancelItem) == KMessageBox::Yes) { | ||
222 | SessionController::deleteSessionFromDisk(result.lock); | 224 | SessionController::deleteSessionFromDisk(result.lock); | ||
223 | 225 | | |||
224 | m_model->removeRows( m_deleteCandidateRow, 1 ); | 226 | m_model->removeRows( m_deleteCandidateRow, 1 ); | ||
225 | m_deleteCandidateRow = -1; | 227 | m_deleteCandidateRow = -1; | ||
226 | } | 228 | } | ||
227 | } | 229 | } | ||
228 | 230 | |