Skip to content

Commit 0c8a32e

Browse files
author
g_j_m
committed
- Change to API for QgsMessageViewer (allow plain text or html input,
required changes in all code that uses QgsMessageViewer) - Improvements to messages when qgis can't find a key column in a postgres table - Fix a couple of bugs when loading postgres tables (invalid layers would appear to load, giving a legend entry, but not show anything on the map) - Tidy up of #includes in postgres files git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4911 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 193a00b commit 0c8a32e

10 files changed

+328
-203
lines changed

src/gui/qgisapp.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -4567,8 +4567,8 @@ void QgisApp::socketConnectionClosed()
45674567
{
45684568
// show more info
45694569
QgsMessageViewer *mv = new QgsMessageViewer(this);
4570-
mv->setCaption(tr("QGIS - Changes in CVS Since Last Release"));
4571-
mv->setMessage(parts[2]);
4570+
mv->setCaption(tr("QGIS - Changes in SVN Since Last Release"));
4571+
mv->setMessageAsPlainText(parts[2]);
45724572
mv->exec();
45734573
}
45744574
}

src/gui/qgsdbsourceselect.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ void QgsDbSourceSelect::on_btnConnect_clicked()
315315
{
316316
QMessageBox::warning(this, tr("Connection failed"),
317317
tr
318-
("Connection to %1 on %2 failed. Either the database is down or your settings are incorrect.%3Check your username and password and try again.%4%5").
319-
arg(settings.readEntry(key + "/database")).arg(settings.readEntry(key + "/host")).arg("\n\n").arg("\n\n").arg(PQerrorMessage(pd)));
318+
("Connection to %1 on %2 failed. Either the database is down or your settings are incorrect.%3Check your username and password and try again.%4The database said:%5%6").
319+
arg(settings.readEntry(key + "/database")).arg(settings.readEntry(key + "/host")).arg("\n\n").arg("\n\n").arg("\n").arg(PQerrorMessage(pd)));
320320
}
321321
}
322322
}

src/gui/qgsmessageviewer.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@ QgsMessageViewer::~QgsMessageViewer()
2929
{
3030
}
3131

32-
void QgsMessageViewer::setMessage(const QString& msg)
32+
void QgsMessageViewer::setMessageAsHtml(const QString& msg)
3333
{
3434
txtMessage->setHtml(msg);
3535
}
3636

37+
void QgsMessageViewer::setMessageAsPlainText(const QString& msg)
38+
{
39+
txtMessage->setPlainText(msg);
40+
}
41+
3742
void QgsMessageViewer::appendMessage(const QString& msg)
3843
{
3944
txtMessage->append(msg);

src/gui/qgsmessageviewer.h

+10-3
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,22 @@
1818
#ifndef QGSMESSAGEVIEWER_H
1919
#define QGSMESSAGEVIEWER_H
2020

21-
#include "ui_qgsmessageviewer.h"
22-
#include "qgisgui.h"
21+
#include <ui_qgsmessageviewer.h>
22+
#include <qgisgui.h>
2323

2424
class QgsMessageViewer: public QDialog, private Ui::QgsMessageViewer
2525
{
2626
public:
2727
QgsMessageViewer(QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags);
2828
~QgsMessageViewer();
29-
void setMessage(const QString& msg);
29+
// Call one of the setMessage...() functions first.
30+
// Subsequent calls to appendMessage use the format as determined
31+
// by the call to setMessage...()
32+
33+
// Treats the given text as html.
34+
void setMessageAsHtml(const QString& msg);
35+
// Treats the given text as plain text
36+
void setMessageAsPlainText(const QString& msg);
3037
void appendMessage(const QString& msg);
3138
};
3239

src/gui/qgsrunprocess.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ QgsRunProcess::QgsRunProcess(const QStringList& args,
6363
// needs. It will delete itself when the dialog box is closed.
6464
mLogViewer = new QgsMessageViewer(0, Qt::WDestructiveClose);
6565
mLogViewer->setCaption(whole_cmd);
66-
mLogViewer->appendMessage( "<b>" + tr("Starting") + " " + whole_cmd + "...</b>" );
66+
mLogViewer->setMessageAsHtml( "<b>" + tr("Starting") + " " + whole_cmd + "...</b>" );
6767
mLogViewer->show();
6868
// Be told when the dialog box is closed (it gets destroyed when
6969
// closed because of the Qt flag used when it was created above).

src/plugins/spit/qgsconnectiondialog.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* *
1616
***************************************************************************/
1717

18-
// $Id:$
18+
// $Id$
1919

2020
#include <iostream>
2121

@@ -106,6 +106,6 @@ void QgsConnectionDialog::saveConnection()
106106
void QgsConnectionDialog::helpInfo(){
107107
QString message = tr("General Interface Help:\n\n");
108108
QgsMessageViewer * e = new QgsMessageViewer(this);
109-
e->setMessage(message);
109+
e->setMessageAsPlainText(message);
110110
e->exec();
111111
}

src/plugins/spit/qgsspit.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ void QgsSpit::addFile()
301301
error2 += "\n" + tr("REASON: One or both of the Shapefile files (*.dbf, *.shx) missing") + "\n\n";
302302
}
303303
QgsMessageViewer * e = new QgsMessageViewer( this );
304-
e->setMessage( message + error1 + error2 );
304+
e->setMessageAsPlainText( message + error1 + error2 );
305305
e->exec();
306306
}
307307
}
@@ -397,7 +397,7 @@ void QgsSpit::helpInfo()
397397
tr("[Quit] - quit the program\n") ) + QString(
398398
tr("[Help] - display this help dialog") + "\n\n" );
399399
QgsMessageViewer * e = new QgsMessageViewer( this );
400-
e->setMessage( message );
400+
e->setMessageAsPlainText( message );
401401
e->exec();
402402
}
403403

src/providers/postgres/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
INCLUDES = -I../../core/ -I../../gui/
1+
INCLUDES = -I../../core/ -I../../gui/ -I../../ui/
22

33
%.moc.cpp: %.h
44
$(MOC) -o $@ $<

0 commit comments

Comments
 (0)