diff --git a/CMakeLists.txt b/CMakeLists.txt index 808101a86..4c535dfa2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,6 +245,7 @@ set(APP_SOURCES src/gui/feedsview.cpp src/gui/messagesview.cpp src/gui/statusbar.cpp + src/gui/messagebox.cpp # CORE sources. src/core/debugging.cpp @@ -297,6 +298,7 @@ set(APP_HEADERS src/gui/feedsview.h src/gui/messagesview.h src/gui/statusbar.h + src/gui/messagebox.h # CORE headers. src/core/settings.h diff --git a/resources/graphics/icons/mini-kfaenza/qtassistant.png b/resources/graphics/icons/mini-kfaenza/qtassistant.png new file mode 100644 index 000000000..cffbf4769 Binary files /dev/null and b/resources/graphics/icons/mini-kfaenza/qtassistant.png differ diff --git a/src/core/databasefactory.cpp b/src/core/databasefactory.cpp index 55569c651..66259ef07 100644 --- a/src/core/databasefactory.cpp +++ b/src/core/databasefactory.cpp @@ -127,8 +127,20 @@ QSqlDatabase DatabaseFactory::addConnection(const QString &connection_name) { return initialize(connection_name); } else { - return QSqlDatabase::addDatabase(DATABASE_DRIVER, - connection_name); + QSqlDatabase database = QSqlDatabase::addDatabase(DATABASE_DRIVER, + connection_name); + QDir db_path(getDatabasePath()); + QFile db_file(db_path.absoluteFilePath(APP_DB_FILE)); + + // Setup database file path. + database.setDatabaseName(db_file.fileName()); + + if (!database.open()) { + qFatal("Database was NOT opened. Delivered error message: '%s'", + qPrintable(database.lastError().text())); + } + + return database; } } diff --git a/src/core/defs.h.in b/src/core/defs.h.in index 0cfc4c450..decdacfb8 100755 --- a/src/core/defs.h.in +++ b/src/core/defs.h.in @@ -5,7 +5,7 @@ #if QT_VERSION >= 0x050000 #include -#elif QT_VERSION >= 0x040600 +#else #include #endif @@ -19,10 +19,7 @@ #define APP_AUTHORS "@APP_AUTHOR@" #define APP_URL "@APP_URL@" #define APP_VERSION "@APP_VERSION@" - -#if QT_VERSION >= 0x040600 #define APP_USERAGENT QString("@APP_NAME@/@APP_VERSION@ (@APP_URL@) on @CMAKE_SYSTEM@; Webkit/") + qWebKitVersion() -#endif #define TEXT_TITLE_LIMIT 30 #define MAX_ZOOM_FACTOR 10.0 diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index 1805159f9..6da8bbb34 100644 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -34,6 +34,9 @@ void FeedMessageViewer::createConnections() { m_messagesBrowser, SLOT(clear())); connect(m_messagesView, SIGNAL(currentMessageChanged(Message)), m_messagesBrowser, SLOT(navigateToMessage(Message))); + connect(m_messagesView, SIGNAL(openMessageNewTabRequested(Message)), + FormMain::getInstance()->m_ui->m_tabWidget, + SLOT(addBrowserWithMessage(Message))); // Toolbar forwardings. connect(FormMain::getInstance()->m_ui->m_actionSwitchImportanceOfSelectedMessages, diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index fec611fae..ea2c31e48 100755 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -1,4 +1,5 @@ #include +#include #include "gui/formmain.h" #include "gui/formabout.h" @@ -146,6 +147,8 @@ void FormMain::display() { } void FormMain::onCommitData(QSessionManager &manager) { + Q_UNUSED(manager); + qDebug("OS asked application to commit its data."); } diff --git a/src/gui/formmain.h b/src/gui/formmain.h index bde361439..cd7a35526 100644 --- a/src/gui/formmain.h +++ b/src/gui/formmain.h @@ -76,7 +76,7 @@ class FormMain : public QMainWindow { // Displays various dialogs. void showSettings(); void showAbout(); - + private: Ui::FormMain *m_ui; QMenu *m_trayMenu; diff --git a/src/gui/messagebox.cpp b/src/gui/messagebox.cpp new file mode 100644 index 000000000..8ce123064 --- /dev/null +++ b/src/gui/messagebox.cpp @@ -0,0 +1,9 @@ +#include "gui/messagebox.h" + + +MessageBox::MessageBox(QWidget *parent) : QMessageBox(parent) { +} + +MessageBox::~MessageBox() { + qDebug("Destroying MessageBox instance."); +} diff --git a/src/gui/messagebox.h b/src/gui/messagebox.h new file mode 100644 index 000000000..f67de23d6 --- /dev/null +++ b/src/gui/messagebox.h @@ -0,0 +1,20 @@ +#ifndef MESSAGEBOX_H +#define MESSAGEBOX_H + +#include + + +class MessageBox : public QMessageBox { + Q_OBJECT + + public: + explicit MessageBox(QWidget *parent = 0); + virtual ~MessageBox(); + + signals: + + public slots: + +}; + +#endif // MESSAGEBOX_H diff --git a/src/gui/messagesview.cpp b/src/gui/messagesview.cpp index cd66f6a49..917b08f54 100644 --- a/src/gui/messagesview.cpp +++ b/src/gui/messagesview.cpp @@ -183,6 +183,10 @@ void MessagesView::openSelectedSourceMessagesInternally() { void MessagesView::openSelectedMessagesInternally() { // TODO: otevre vybrane nactene zpravy v internich tabech + + foreach (const QModelIndex &index, selectionModel()->selectedRows()) { + emit openMessageNewTabRequested(m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row())); + } } void MessagesView::markSelectedMessagesRead() { diff --git a/src/gui/messagesview.h b/src/gui/messagesview.h index 146670b6d..380c4cca1 100755 --- a/src/gui/messagesview.h +++ b/src/gui/messagesview.h @@ -51,6 +51,7 @@ class MessagesView : public QTreeView { const QItemSelection &deselected); signals: + void openMessageNewTabRequested(const Message &message); void currentMessageChanged(const Message &message); void currentMessageRemoved(); diff --git a/src/gui/tabwidget.cpp b/src/gui/tabwidget.cpp index 17a3dcd4c..036678cdc 100644 --- a/src/gui/tabwidget.cpp +++ b/src/gui/tabwidget.cpp @@ -174,6 +174,12 @@ int TabWidget::insertTab(int index, QWidget *widget, const QString &label, return tab_index; } +int TabWidget::addBrowserWithMessage(const Message &message) { + int new_index = addBrowser(false, false); + static_cast(widget(new_index))->navigateToMessage(message); + return new_index; +} + int TabWidget::addEmptyBrowser() { return addBrowser(false, true); } diff --git a/src/gui/tabwidget.h b/src/gui/tabwidget.h index de14f4b29..784cfd8eb 100644 --- a/src/gui/tabwidget.h +++ b/src/gui/tabwidget.h @@ -9,6 +9,7 @@ class CornerButton; +class Message; class TabWidget : public QTabWidget { Q_OBJECT @@ -72,6 +73,8 @@ class TabWidget : public QTabWidget { // Closes all "closable" tabs except the active tab. void closeAllTabsExceptCurrent(); + int addBrowserWithMessage(const Message &message); + // Adds new WebBrowser tab to global TabWidget. int addEmptyBrowser();