Commit 0402a3ff authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Inform about projects in a session that failed to load

Inform the user about projects that failed to load as part
of a session.

Reviewed-by: dt
parent 3b007ef9
......@@ -59,6 +59,7 @@
#include <QtGui/QApplication>
#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
#include <QtCore/QTextCodec>
namespace {
......@@ -83,6 +84,7 @@ public:
void setFileName(const QString &fileName);
QStringList failedProjectFileNames() const;
void clearFailedProjectFileNames();
public slots:
void sessionLoadingProgress();
......@@ -303,6 +305,11 @@ QStringList SessionFile::failedProjectFileNames() const
return m_failedProjects;
}
void SessionFile::clearFailedProjectFileNames()
{
m_failedProjects.clear();
}
Internal::SessionNodeImpl::SessionNodeImpl(SessionManager *manager)
: ProjectExplorer::SessionNode(manager->currentSession(), manager)
{
......@@ -629,6 +636,25 @@ bool SessionManager::loadImpl(const QString &fileName)
// m_file->load() sets the m_file->startupProject
// but doesn't emit this signal, so we do it here
emit startupProjectChanged(m_file->m_startupProject);
QStringList failedProjects = m_file->failedProjectFileNames();
if (!failedProjects.isEmpty()) {
QString fileList =
QDir::toNativeSeparators(failedProjects.join(QLatin1String("<br>")));
QMessageBox * box = new QMessageBox(QMessageBox::Warning,
tr("Failed to restore project files"),
tr("Could not restore the following project files:<br><b>%1</b>").
arg(fileList));
QPushButton * keepButton = new QPushButton(tr("Keep projects in Session"), box);
QPushButton * removeButton = new QPushButton(tr("Remove projects from Session"), box);
box->addButton(keepButton, QMessageBox::AcceptRole);
box->addButton(removeButton, QMessageBox::DestructiveRole);
box->exec();
if (box->clickedButton() == removeButton)
m_file->clearFailedProjectFileNames();
}
}
if (success) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment