SessionMgr::SessionMgr(QObject *parent) : QObject(parent) { m_sig_map = new QSignalMapper(this); connect(m_sig_map, SIGNAL(mapped(QString)), SLOT(loadSession(QString))); updateSessions(); }
void SessionMgr::removeSession(QString name) { if(!name.contains("cldta")) name.append(".cldta"); QString folder = getFolder(); QFile::remove(folder + name); // Remove attachment files int at = 0; name.remove(".cldta"); name = QString("%1_%2_at%3.cldta").arg(folder).arg(name); while(QFile::remove(name.arg(at))) ++at; updateSessions(); }
void renameCurrent() { QListWidgetItem *item = mList->currentItem(); if (!item) return; QString oldName = item->text(); QString newName = QInputDialog::getText ( this, tr("Rename Session"), tr("Enter a new name for the session:"), QLineEdit::Normal, oldName ); if (newName.isEmpty() || newName == oldName ) return; mMng->renameSession(oldName, newName); updateSessions(); }
void SessionMgr::saveSessionAct() { QString name = SessionSaveDialog::getSessionName(this); if(name.isEmpty()) return; name.replace(QRegExp("[/\\\\<>\\*:\"\\|\\?]"), "_"); if(name.startsWith("..") || name.startsWith('_')) name.prepend("-"); try { saveSession(name); sWorkTabMgr.printToAllStatusBars(tr("Session %1 saved.").arg(name)); } catch(const QString& ex) { Utils::showErrorBox(ex); } updateSessions(); }