Commit 50f0cbb4 authored by Elvis Angelaccio's avatar Elvis Angelaccio

part: hide wrongly shown message widgets

This fixes all message widgets the are displayed in the Part even though they are not supposed to.

Differential Revision: D2095
parent 0505b346
......@@ -116,6 +116,9 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList& args)
vbox->addWidget(m_commentView);
m_commentBox->setLayout(vbox);
m_messageWidget = new KMessageWidget(parentWidget);
m_messageWidget->hide();
m_commentMsgWidget = new KMessageWidget();
m_commentMsgWidget->setText(i18n("Comment has been modified."));
m_commentMsgWidget->setMessageType(KMessageWidget::Information);
......@@ -135,6 +138,7 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList& args)
// Configure the QVBoxLayout and add widgets
m_vlayout->setContentsMargins(0,0,0,0);
m_vlayout->addWidget(m_messageWidget);
m_vlayout->addWidget(m_splitter);
// Vertical QSplitter for the file view and comment field.
......@@ -507,6 +511,13 @@ void Part::slotTestArchive()
job->start();
}
void Part::resetGui()
{
m_messageWidget->hide();
m_commentView->clear();
m_commentBox->hide();
}
void Part::slotTestingDone(KJob* job)
{
if (job->error() && job->error() != KJob::KilledJobError) {
......@@ -613,8 +624,7 @@ bool Part::openFile()
{
qCDebug(ARK) << "Attempting to open archive" << localFilePath();
m_commentView->clear();
m_commentBox->hide();
resetGui();
if (!isLocalFileValid()) {
return false;
......@@ -1256,6 +1266,9 @@ void Part::slotAddFilesDone(KJob* job)
{
if (job->error() && job->error() != KJob::KilledJobError) {
KMessageBox::error(widget(), job->errorString());
} else {
// Hide the "archive will be created as soon as you add a file" message.
m_messageWidget->hide();
}
}
......@@ -1366,11 +1379,11 @@ void Part::slotShowContextMenu()
void Part::displayMsgWidget(KMessageWidget::MessageType type, const QString& msg)
{
KMessageWidget *msgWidget = new KMessageWidget();
msgWidget->setText(msg);
msgWidget->setMessageType(type);
m_vlayout->insertWidget(0, msgWidget);
msgWidget->animatedShow();
// The widget could be already visible, so hide it.
m_messageWidget->hide();
m_messageWidget->setText(msg);
m_messageWidget->setMessageType(type);
m_messageWidget->animatedShow();
}
} // namespace Ark
......
......@@ -134,6 +134,7 @@ signals:
void quit();
private:
void resetGui();
void setupView();
void setupActions();
bool isSingleFolderArchive() const;
......@@ -174,6 +175,7 @@ private:
QGroupBox *m_commentBox;
QPlainTextEdit *m_commentView;
KMessageWidget *m_commentMsgWidget;
KMessageWidget *m_messageWidget;
};
} // namespace Ark
......
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