acsa
This commit is contained in:
parent
8bff38b66c
commit
832190edbd
11 changed files with 197 additions and 78 deletions
|
@ -15,13 +15,13 @@
|
||||||
#
|
#
|
||||||
# "-DUSE_QT_5=ON"
|
# "-DUSE_QT_5=ON"
|
||||||
# Specifies which major Qt version to use. Qt 4 and Qt 5 are supported.
|
# Specifies which major Qt version to use. Qt 4 and Qt 5 are supported.
|
||||||
# If "OFF" is passed as an argument, then Qt 4 is used.
|
# If "OFF" is passed as an argument, then Qt 4 is used. Default is "OFF".
|
||||||
#
|
#
|
||||||
# Other information:
|
# Other information:
|
||||||
|
# - supports Windows, Linux, OS/2 (eComStation),
|
||||||
# - Qt 4.7.3 and higher is required,
|
# - Qt 4.7.3 and higher is required,
|
||||||
# - resource compiler (windres.exe) is needed on MinGW,
|
# - resource compiler (windres.exe) is needed on MinGW,
|
||||||
# - resource compiler (rc.exe) is needed on OS/2,
|
# - resource compiler (rc.exe) is needed on OS/2.
|
||||||
# - supports Windows, Linux, OS/2 (eComStation).
|
|
||||||
#
|
#
|
||||||
# Authors and contributors:
|
# Authors and contributors:
|
||||||
# - Martin Rotter (project leader)
|
# - Martin Rotter (project leader)
|
||||||
|
@ -34,12 +34,14 @@ cmake_minimum_required(VERSION 2.8.11)
|
||||||
# Setup basic variables.
|
# Setup basic variables.
|
||||||
project(rssguard)
|
project(rssguard)
|
||||||
set(APP_NAME "RSS Guard")
|
set(APP_NAME "RSS Guard")
|
||||||
set(APP_UP_NAME "RSSGuard")
|
|
||||||
set(APP_LOW_NAME "rssguard")
|
set(APP_LOW_NAME "rssguard")
|
||||||
set(APP_VERSION "2.0.0-prealpha-3")
|
set(APP_VERSION "2.0.0-prealpha-3")
|
||||||
|
set(FILE_VERSION "2,0,0,0")
|
||||||
set(APP_AUTHOR "Martin Rotter")
|
set(APP_AUTHOR "Martin Rotter")
|
||||||
set(APP_URL "http://rssguard.sf.net")
|
set(APP_URL "http://rssguard.sf.net")
|
||||||
set(MINIMUM_QT_VERSION 4.7.3)
|
set(MINIMUM_QT_VERSION 4.7.3)
|
||||||
|
set(SOURCE_PACKAGE_SUFFIX "Source")
|
||||||
|
set(EXE_NAME ${APP_LOW_NAME})
|
||||||
|
|
||||||
option(USE_QT_5 "Use Qt 5 for building" ON)
|
option(USE_QT_5 "Use Qt 5 for building" ON)
|
||||||
|
|
||||||
|
@ -51,13 +53,6 @@ set(CMAKE_COLOR_MAKEFILE ON)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/resources/cmake ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/resources/cmake ${CMAKE_MODULE_PATH})
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
# Setup name for executable file.
|
|
||||||
if(APPLE)
|
|
||||||
set(EXE_NAME ${APP_UP_NAME})
|
|
||||||
else(APPLE)
|
|
||||||
set(EXE_NAME ${APP_LOW_NAME})
|
|
||||||
endif(APPLE)
|
|
||||||
|
|
||||||
# Select which Qt version to use.
|
# Select which Qt version to use.
|
||||||
if(${USE_QT_5})
|
if(${USE_QT_5})
|
||||||
message(STATUS "[${APP_LOW_NAME}] Using Qt 5 library for building.")
|
message(STATUS "[${APP_LOW_NAME}] Using Qt 5 library for building.")
|
||||||
|
@ -159,14 +154,6 @@ endif(${USE_QT_5})
|
||||||
|
|
||||||
# Setup libraries.
|
# Setup libraries.
|
||||||
if(${USE_QT_5})
|
if(${USE_QT_5})
|
||||||
#find_package(Qt5Sql)
|
|
||||||
#find_package(Qt5WebKit)
|
|
||||||
#find_package(Qt5WebKitWidgets)
|
|
||||||
#find_package(Qt5Widgets)
|
|
||||||
#find_package(Qt5Xml)
|
|
||||||
#find_package(Qt5XmlPatterns)
|
|
||||||
#find_package(Qt5Network)
|
|
||||||
#find_package(Qt5LinguistTools)
|
|
||||||
find_package(Qt5 REQUIRED Sql WebKit WebKitWidgets Widgets Xml XmlPatterns Network LinguistTools)
|
find_package(Qt5 REQUIRED Sql WebKit WebKitWidgets Widgets Xml XmlPatterns Network LinguistTools)
|
||||||
else(${USE_QT_5})
|
else(${USE_QT_5})
|
||||||
set(QT_MIN_VERSION ${MINIMUM_QT_VERSION})
|
set(QT_MIN_VERSION ${MINIMUM_QT_VERSION})
|
||||||
|
@ -490,7 +477,7 @@ set(CPACK_PACKAGE_NAME ${APP_LOW_NAME})
|
||||||
set(CPACK_PACKAGE_VERSION ${APP_VERSION})
|
set(CPACK_PACKAGE_VERSION ${APP_VERSION})
|
||||||
set(CPACK_IGNORE_FILES "/resources/aur/;\\\\.psd$;/resources/deployment;/CVS/;/\\\\.svn/;/\\\\.git/;\\\\.swp$;/CMakeLists.txt.user;\\\\.#;/#;\\\\.tar.gz$;/CMakeFiles/;CMakeCache.txt;\\\\.qm$;/build/;\\\\.diff$;.DS_Store'")
|
set(CPACK_IGNORE_FILES "/resources/aur/;\\\\.psd$;/resources/deployment;/CVS/;/\\\\.svn/;/\\\\.git/;\\\\.swp$;/CMakeLists.txt.user;\\\\.#;/#;\\\\.tar.gz$;/CMakeFiles/;CMakeCache.txt;\\\\.qm$;/build/;\\\\.diff$;.DS_Store'")
|
||||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-src")
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${SOURCE_PACKAGE_SUFFIX}")
|
||||||
set(CPACK_SOURCE_IGNORE_FILES ${CPACK_IGNORE_FILES})
|
set(CPACK_SOURCE_IGNORE_FILES ${CPACK_IGNORE_FILES})
|
||||||
|
|
||||||
# Load packaging facilities.
|
# Load packaging facilities.
|
||||||
|
|
|
@ -1,30 +1,33 @@
|
||||||
|
// This is resource file for MS Windows platform.
|
||||||
|
|
||||||
|
|
||||||
IDI_ICON1 ICON DISCARDABLE "@PROJECT_SOURCE_DIR@/resources/graphics/rssguard.ico"
|
IDI_ICON1 ICON DISCARDABLE "@PROJECT_SOURCE_DIR@/resources/graphics/rssguard.ico"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,0,0,0
|
FILEVERSION @FILE_VERSION@
|
||||||
PRODUCTVERSION 1,0,0,0
|
PRODUCTVERSION @FILE_VERSION@
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904E4"
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4"
|
VALUE "CompanyName", "@APP_AUTHOR@"
|
||||||
BEGIN
|
VALUE "FileDescription", "@APP_NAME@"
|
||||||
VALUE "CompanyName", "@APP_AUTHOR@"
|
VALUE "FileVersion", "@APP_VERSION@"
|
||||||
VALUE "FileDescription", "@APP_NAME@"
|
VALUE "InternalName", "@APP_AUTHOR@"
|
||||||
VALUE "FileVersion", "@APP_VERSION@"
|
VALUE "LegalCopyright", "Copyright © 2011-2013 Martin Rotter"
|
||||||
VALUE "InternalName", "@APP_AUTHOR@"
|
VALUE "LegalTrademarks1", "Some rights reserved"
|
||||||
VALUE "LegalCopyright", "Copyright © 2011-2013 Martin Rotter"
|
VALUE "LegalTrademarks2", "Some rights reserved"
|
||||||
VALUE "LegalTrademarks1", "Some rights reserved"
|
VALUE "OriginalFilename", "@EXE_NAME@.exe"
|
||||||
VALUE "LegalTrademarks2", "Some rights reserved"
|
VALUE "ProductName", "@APP_NAME@"
|
||||||
VALUE "OriginalFilename", "@EXE_NAME@.exe"
|
VALUE "ProductVersion", "@APP_VERSION@"
|
||||||
VALUE "ProductName", "@APP_NAME@"
|
|
||||||
VALUE "ProductVersion", "@APP_VERSION@"
|
|
||||||
END
|
|
||||||
END
|
END
|
||||||
|
END
|
||||||
|
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Translation", 0x409, 1252
|
VALUE "Translation", 0x409, 1252
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
@ -51,8 +51,8 @@ void FeedMessageViewer::initialize() {
|
||||||
QToolButton *update_button = new QToolButton(m_toolBar);
|
QToolButton *update_button = new QToolButton(m_toolBar);
|
||||||
update_button->setPopupMode(QToolButton::InstantPopup);
|
update_button->setPopupMode(QToolButton::InstantPopup);
|
||||||
update_button->setIcon(IconThemeFactory::getInstance()->fromTheme("view-refresh"));
|
update_button->setIcon(IconThemeFactory::getInstance()->fromTheme("view-refresh"));
|
||||||
update_button->setText(FormMain::getInstance()->m_ui->m_actionUpdateAllFeeds->text());
|
update_button->setText(tr("Update selected/all feeds"));
|
||||||
update_button->setToolTip(FormMain::getInstance()->m_ui->m_actionUpdateAllFeeds->toolTip());
|
update_button->setToolTip(tr("Select which feeds you want to update."));
|
||||||
|
|
||||||
QMenu *update_menu = new QMenu(tr("Feed update menu"), update_button);
|
QMenu *update_menu = new QMenu(tr("Feed update menu"), update_button);
|
||||||
update_menu->addAction(FormMain::getInstance()->m_ui->m_actionUpdateAllFeeds);
|
update_menu->addAction(FormMain::getInstance()->m_ui->m_actionUpdateAllFeeds);
|
||||||
|
|
|
@ -58,13 +58,33 @@ TabWidget *FormMain::getTabWidget() {
|
||||||
|
|
||||||
QList<QAction*> FormMain::getActions() {
|
QList<QAction*> FormMain::getActions() {
|
||||||
QList<QAction*> actions;
|
QList<QAction*> actions;
|
||||||
|
|
||||||
|
// Add basic actions.
|
||||||
actions << m_ui->m_actionImport << m_ui->m_actionExport <<
|
actions << m_ui->m_actionImport << m_ui->m_actionExport <<
|
||||||
m_ui->m_actionSettings << m_ui->m_actionQuit <<
|
m_ui->m_actionSettings << m_ui->m_actionQuit <<
|
||||||
m_ui->m_actionFullscreen << m_ui->m_actionAboutGuard <<
|
m_ui->m_actionFullscreen;
|
||||||
m_ui->m_actionAddBrowser << m_ui->m_actionCloseCurrentTab <<
|
|
||||||
|
// Add web browser actions
|
||||||
|
actions << m_ui->m_actionAddBrowser << m_ui->m_actionCloseCurrentTab <<
|
||||||
m_ui->m_actionCloseAllTabs;
|
m_ui->m_actionCloseAllTabs;
|
||||||
|
|
||||||
return actions;
|
// Add feeds/messages actions.
|
||||||
|
actions << m_ui->m_actionOpenSelectedSourceArticlesExternally <<
|
||||||
|
m_ui->m_actionOpenSelectedMessagesExternally <<
|
||||||
|
m_ui->m_actionOpenSelectedMessagesInternally <<
|
||||||
|
m_ui->m_actionMarkAllMessagesAsRead <<
|
||||||
|
m_ui->m_actionMarkAllMessagesAsUnread <<
|
||||||
|
m_ui->m_actionDeleteAllMessages <<
|
||||||
|
m_ui->m_actionMarkSelectedMessagesAsRead <<
|
||||||
|
m_ui->m_actionMarkSelectedMessagesAsUnread <<
|
||||||
|
m_ui->m_actionSwitchImportanceOfSelectedMessages <<
|
||||||
|
m_ui->m_actionDeleteSelectedMessages <<
|
||||||
|
m_ui->m_actionUpdateAllFeeds <<
|
||||||
|
m_ui->m_actionUpdateSelectedFeeds <<
|
||||||
|
m_ui->m_actionEditSelectedFeed <<
|
||||||
|
m_ui->m_actionDeleteSelectedFeeds;
|
||||||
|
|
||||||
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormMain::prepareMenus() {
|
void FormMain::prepareMenus() {
|
||||||
|
@ -125,7 +145,7 @@ void FormMain::display() {
|
||||||
QtSingleApplication::alert(this);
|
QtSingleApplication::alert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormMain::onCommitData(QSessionManager &manager) {
|
void FormMain::onCommitData(QSessionManager &manager) {
|
||||||
qDebug("OS asked application to commit its data.");
|
qDebug("OS asked application to commit its data.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +186,9 @@ void FormMain::setupIcons() {
|
||||||
m_ui->m_actionMarkSelectedMessagesAsRead->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-read"));
|
m_ui->m_actionMarkSelectedMessagesAsRead->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-read"));
|
||||||
m_ui->m_actionMarkSelectedMessagesAsUnread->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-unread"));
|
m_ui->m_actionMarkSelectedMessagesAsUnread->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-unread"));
|
||||||
m_ui->m_actionSwitchImportanceOfSelectedMessages->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-important"));
|
m_ui->m_actionSwitchImportanceOfSelectedMessages->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-important"));
|
||||||
|
m_ui->m_actionOpenSelectedMessagesExternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open"));
|
||||||
|
m_ui->m_actionOpenSelectedSourceArticlesExternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open"));
|
||||||
|
m_ui->m_actionOpenSelectedMessagesInternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open"));
|
||||||
|
|
||||||
// Setup icons for underlying components: opened web browsers...
|
// Setup icons for underlying components: opened web browsers...
|
||||||
foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) {
|
foreach (WebBrowser *browser, WebBrowser::runningWebBrowsers()) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ class FormMain : public QMainWindow {
|
||||||
|
|
||||||
friend class TabWidget;
|
friend class TabWidget;
|
||||||
friend class FeedMessageViewer;
|
friend class FeedMessageViewer;
|
||||||
|
friend class MessagesView;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructors and destructors.
|
// Constructors and destructors.
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>19</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="m_menuFile">
|
<widget class="QMenu" name="m_menuFile">
|
||||||
|
@ -357,6 +357,36 @@
|
||||||
<string>Add new feed.</string>
|
<string>Add new feed.</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="m_actionOpenSelectedMessagesExternally">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open selected messages in external browser</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Open selected messages in external browser.</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="m_actionOpenSelectedMessagesInternally">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open selected messages in internal browser</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Open selected messages in internal browser.</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="m_actionOpenSelectedSourceArticlesExternally">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open selected source articles in external browser</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Open selected source messages in external browser.</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -125,18 +125,30 @@ void FormSettings::displayProxyPassword(int state) {
|
||||||
|
|
||||||
bool FormSettings::doSaveCheck() {
|
bool FormSettings::doSaveCheck() {
|
||||||
bool everything_ok = true;
|
bool everything_ok = true;
|
||||||
QString resulting_information;
|
QStringList resulting_information;
|
||||||
|
QMessageBox msg_error(this);
|
||||||
|
|
||||||
|
// Setup indication of settings consistence.
|
||||||
everything_ok &= m_ui->m_shortcuts->areShortcutsUnique();
|
everything_ok &= m_ui->m_shortcuts->areShortcutsUnique();
|
||||||
|
|
||||||
if (!m_ui->m_shortcuts->areShortcutsUnique()) {
|
if (!m_ui->m_shortcuts->areShortcutsUnique()) {
|
||||||
resulting_information = resulting_information.append(tr("Some keyboard shortcuts are not unique.\n"));
|
#if QT_VERSION >= 0x050000
|
||||||
|
resulting_information.append(tr(" • some keyboard shortcuts are not unique"));
|
||||||
|
#else
|
||||||
|
resulting_information.append(trUtf8(" • some keyboard shortcuts are not unique"));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup dialog.
|
||||||
|
msg_error.setText(tr("Some critical settings are not set. You must fix these settings in order confirm new settings."));
|
||||||
|
msg_error.setWindowTitle(tr("Cannot save settings"));
|
||||||
|
msg_error.setDetailedText(tr("List of errors:\n %1.").arg(resulting_information.join(",\n")));
|
||||||
|
msg_error.setIcon(QMessageBox::Critical);
|
||||||
|
msg_error.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msg_error.setDefaultButton(QMessageBox::Ok);
|
||||||
|
|
||||||
if (!everything_ok) {
|
if (!everything_ok) {
|
||||||
QMessageBox::warning(this,
|
msg_error.exec();
|
||||||
tr("Cannot save settings"),
|
|
||||||
resulting_information);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return everything_ok;
|
return everything_ok;
|
||||||
|
@ -494,6 +506,7 @@ void FormSettings::saveInterface() {
|
||||||
QString original_icon_theme = IconThemeFactory::getInstance()->getCurrentIconTheme();
|
QString original_icon_theme = IconThemeFactory::getInstance()->getCurrentIconTheme();
|
||||||
IconThemeFactory::getInstance()->setCurrentIconTheme(selected_icon_theme);
|
IconThemeFactory::getInstance()->setCurrentIconTheme(selected_icon_theme);
|
||||||
|
|
||||||
|
// Check if icon theme was changed.
|
||||||
if (selected_icon_theme != original_icon_theme) {
|
if (selected_icon_theme != original_icon_theme) {
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
m_changedDataTexts.append(tr(" • icon theme changed"));
|
m_changedDataTexts.append(tr(" • icon theme changed"));
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>910</width>
|
<width>966</width>
|
||||||
<height>445</height>
|
<height>445</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QStackedWidget" name="m_stackedSettings">
|
<widget class="QStackedWidget" name="m_stackedSettings">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="m_pageGeneral">
|
<widget class="QWidget" name="m_pageGeneral">
|
||||||
<layout class="QFormLayout" name="formLayout_5">
|
<layout class="QFormLayout" name="formLayout_5">
|
||||||
|
@ -69,8 +69,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>666</width>
|
<width>100</width>
|
||||||
<height>399</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
@ -147,8 +147,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>662</width>
|
<width>167</width>
|
||||||
<height>371</height>
|
<height>219</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
@ -634,6 +634,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="m_pageFeedsMessages"/>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
@ -663,7 +664,7 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentRow">
|
<property name="currentRow">
|
||||||
<number>0</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -690,6 +691,11 @@
|
||||||
<string>Web browser & proxy</string>
|
<string>Web browser & proxy</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Feeds & messages</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="1" column="0" colspan="2">
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
#include "gui/messagesview.h"
|
#include "gui/messagesview.h"
|
||||||
#include "core/messagesproxymodel.h"
|
#include "core/messagesproxymodel.h"
|
||||||
#include "core/messagesmodel.h"
|
#include "core/messagesmodel.h"
|
||||||
|
#include "gui/formmain.h"
|
||||||
|
|
||||||
|
|
||||||
MessagesView::MessagesView(QWidget *parent) : QTreeView(parent) {
|
MessagesView::MessagesView(QWidget *parent)
|
||||||
|
: QTreeView(parent), m_contextMenu(NULL) {
|
||||||
m_proxyModel = new MessagesProxyModel(this);
|
m_proxyModel = new MessagesProxyModel(this);
|
||||||
m_sourceModel = m_proxyModel->sourceModel();
|
m_sourceModel = m_proxyModel->sourceModel();
|
||||||
|
|
||||||
|
@ -98,6 +101,39 @@ void MessagesView::keyPressEvent(QKeyEvent *event) {
|
||||||
QTreeView::keyPressEvent(event);
|
QTreeView::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessagesView::contextMenuEvent(QContextMenuEvent *event) {
|
||||||
|
QModelIndex clicked_index = indexAt(event->pos());
|
||||||
|
|
||||||
|
if (!clicked_index.isValid()) {
|
||||||
|
qDebug("Context menu for MessagesView will not be shown because "
|
||||||
|
"user clicked on invalid item.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_contextMenu == NULL) {
|
||||||
|
// Context menu is not initialized, initialize.
|
||||||
|
initializeContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_contextMenu->exec(event->globalPos());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesView::initializeContextMenu() {
|
||||||
|
m_contextMenu = new QMenu(tr("Context menu for messages"), this);
|
||||||
|
|
||||||
|
connect(FormMain::getInstance()->m_ui->m_actionOpenSelectedMessagesExternally,
|
||||||
|
SIGNAL(triggered()), this, SLOT(openSelectedMessagesExternally()));
|
||||||
|
|
||||||
|
m_contextMenu->addActions(QList<QAction*>() <<
|
||||||
|
FormMain::getInstance()->m_ui->m_actionOpenSelectedSourceArticlesExternally <<
|
||||||
|
FormMain::getInstance()->m_ui->m_actionOpenSelectedMessagesExternally <<
|
||||||
|
FormMain::getInstance()->m_ui->m_actionOpenSelectedMessagesInternally <<
|
||||||
|
FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsRead <<
|
||||||
|
FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsUnread <<
|
||||||
|
FormMain::getInstance()->m_ui->m_actionSwitchImportanceOfSelectedMessages <<
|
||||||
|
FormMain::getInstance()->m_ui->m_actionDeleteSelectedMessages);
|
||||||
|
}
|
||||||
|
|
||||||
void MessagesView::mousePressEvent(QMouseEvent *event) {
|
void MessagesView::mousePressEvent(QMouseEvent *event) {
|
||||||
QTreeView::mousePressEvent(event);
|
QTreeView::mousePressEvent(event);
|
||||||
|
|
||||||
|
@ -140,36 +176,49 @@ void MessagesView::currentChanged(const QModelIndex ¤t,
|
||||||
QTreeView::currentChanged(current, previous);
|
QTreeView::currentChanged(current, previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessagesView::openSelectedMessagesExternally() {
|
||||||
|
// TODO: otevře vybrane zpravy v externim prohlizeci
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesView::openSelectedSourceMessagesInternally() {
|
||||||
|
// TODO: otevre vybrane nactene zpravy v internch tabech
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesView::openSelectedTargetMessagesInternally() {
|
||||||
|
// TODO: otevre vybrane zpravy ze zdrojovych webz v internich tabech
|
||||||
|
}
|
||||||
|
|
||||||
void MessagesView::switchSelectedMessagesImportance() {
|
void MessagesView::switchSelectedMessagesImportance() {
|
||||||
QModelIndex current_idx = selectionModel()->currentIndex();
|
QModelIndex current_index = selectionModel()->currentIndex();
|
||||||
QModelIndex mapped_current_idx = m_proxyModel->mapToSource(current_idx);
|
QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
|
||||||
QModelIndexList selected_idxs = selectionModel()->selectedRows();
|
QModelIndexList selected_indexes = selectionModel()->selectedRows();
|
||||||
QModelIndexList mapped_idxs = m_proxyModel->mapListToSource(selected_idxs);
|
QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes);
|
||||||
|
|
||||||
m_sourceModel->switchBatchMessageImportance(mapped_idxs);
|
m_sourceModel->switchBatchMessageImportance(mapped_indexes);
|
||||||
|
|
||||||
selected_idxs.clear();
|
selected_indexes.clear();
|
||||||
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
||||||
|
|
||||||
foreach (const QModelIndex &index, mapped_idxs) {
|
foreach (const QModelIndex &index, mapped_indexes) {
|
||||||
selected_idxs << m_proxyModel->mapFromSource(m_sourceModel->index(index.row(),
|
selected_indexes << m_proxyModel->mapFromSource(m_sourceModel->index(index.row(),
|
||||||
index.column()));
|
index.column()));
|
||||||
}
|
}
|
||||||
|
|
||||||
current_idx = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_idx.row(),
|
current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(),
|
||||||
mapped_current_idx.column()));
|
mapped_current_index.column()));
|
||||||
|
|
||||||
setCurrentIndex(current_idx);
|
setCurrentIndex(current_index);
|
||||||
scrollTo(current_idx);
|
scrollTo(current_index);
|
||||||
reselectIndexes(selected_idxs);
|
reselectIndexes(selected_indexes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesView::reselectIndexes(const QModelIndexList &indexes) {
|
void MessagesView::reselectIndexes(const QModelIndexList &indexes) {
|
||||||
selectionModel()->clearSelection();
|
selectionModel()->clearSelection();
|
||||||
|
|
||||||
foreach (const QModelIndex &idx, indexes) {
|
foreach (const QModelIndex &index, indexes) {
|
||||||
selectionModel()->select(idx,
|
selectionModel()->select(index,
|
||||||
QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
QItemSelectionModel::Select |
|
||||||
|
QItemSelectionModel::Rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ class MessagesView : public QTreeView {
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Message manipulators.
|
// Message manipulators.
|
||||||
|
void openSelectedMessagesExternally();
|
||||||
|
void openSelectedSourceMessagesInternally();
|
||||||
|
void openSelectedTargetMessagesInternally();
|
||||||
void switchSelectedMessagesImportance();
|
void switchSelectedMessagesImportance();
|
||||||
void setAllMessagesRead();
|
void setAllMessagesRead();
|
||||||
|
|
||||||
|
@ -31,7 +34,10 @@ class MessagesView : public QTreeView {
|
||||||
void reselectIndexes(const QModelIndexList &indexes);
|
void reselectIndexes(const QModelIndexList &indexes);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void initializeContextMenu();
|
||||||
void setupAppearance();
|
void setupAppearance();
|
||||||
|
|
||||||
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
void currentChanged(const QModelIndex ¤t,
|
void currentChanged(const QModelIndex ¤t,
|
||||||
|
@ -44,6 +50,8 @@ class MessagesView : public QTreeView {
|
||||||
void currentMessageRemoved();
|
void currentMessageRemoved();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QMenu *m_contextMenu;
|
||||||
|
|
||||||
MessagesProxyModel *m_proxyModel;
|
MessagesProxyModel *m_proxyModel;
|
||||||
MessagesModel *m_sourceModel;
|
MessagesModel *m_sourceModel;
|
||||||
};
|
};
|
||||||
|
|
|
@ -176,7 +176,7 @@ void WebBrowser::navigateToMessage(const Message &message) {
|
||||||
tr("Written by ") + message.m_author,
|
tr("Written by ") + message.m_author,
|
||||||
message.m_url,
|
message.m_url,
|
||||||
message.m_contents,
|
message.m_contents,
|
||||||
message.m_updated.toString(Qt::ISODate)));
|
message.m_updated.toString(Qt::DefaultLocaleLongDate)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::updateZoomGui() {
|
void WebBrowser::updateZoomGui() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue