Fixed message counts when deleting feed.

This commit is contained in:
Martin Rotter 2014-03-09 17:45:40 +01:00
parent 1db722eb6f
commit 75b4be0077
4 changed files with 28 additions and 21 deletions

View File

@ -307,16 +307,16 @@ void FeedMessageViewer::initialize() {
}
void FeedMessageViewer::initializeViews() {
// Instantiate needed components.
QVBoxLayout *central_layout = new QVBoxLayout(this);
QVBoxLayout *feed_layout = new QVBoxLayout(this);
QVBoxLayout *message_layout = new QVBoxLayout(this);
QWidget *message_widget = new QWidget(this);
m_feedsWidget = new QWidget(this);
m_messagesWidget = new QWidget(this);
m_feedSplitter = new QSplitter(Qt::Horizontal, this);
m_messageSplitter = new QSplitter(Qt::Vertical, this);
// Instantiate needed components.
QVBoxLayout *central_layout = new QVBoxLayout(this);
QVBoxLayout *feed_layout = new QVBoxLayout(m_feedsWidget);
QVBoxLayout *message_layout = new QVBoxLayout(m_messagesWidget);
// Set layout properties.
central_layout->setMargin(0);
central_layout->setSpacing(0);
@ -330,6 +330,7 @@ void FeedMessageViewer::initializeViews() {
m_messagesView->setFrameStyle(QFrame::NoFrame);
// Setup message splitter.
m_messageSplitter->setObjectName("MessageSplitter");
m_messageSplitter->setHandleWidth(1);
m_messageSplitter->setOpaqueResize(false);
m_messageSplitter->setChildrenCollapsible(false);
@ -339,25 +340,20 @@ void FeedMessageViewer::initializeViews() {
// Assemble message-related components to single widget.
message_layout->addWidget(m_toolBarMessages);
message_layout->addWidget(m_messageSplitter);
message_widget->setLayout(message_layout);
// Assemble feed-related components to another widget.
feed_layout->addWidget(m_toolBarFeeds);
feed_layout->addWidget(m_feedsView);
m_feedsWidget->setLayout(feed_layout);
// Assembler everything together.
m_feedSplitter->setHandleWidth(1);
m_feedSplitter->setOpaqueResize(false);
m_feedSplitter->setChildrenCollapsible(false);
m_feedSplitter->addWidget(m_feedsWidget);
m_feedSplitter->addWidget(message_widget);
m_feedSplitter->addWidget(m_messagesWidget);
// Add toolbar and main feeds/messages widget to main layout.
central_layout->addWidget(m_feedSplitter);
// Set layout as active.
setLayout(central_layout);
}
void FeedMessageViewer::vacuumDatabase() {

View File

@ -100,6 +100,7 @@ class FeedMessageViewer : public TabContent {
MessagesView *m_messagesView;
FeedsView *m_feedsView;
QWidget *m_feedsWidget;
QWidget *m_messagesWidget;
WebBrowser *m_messagesBrowser;
QThread *m_feedDownloaderThread;

View File

@ -416,16 +416,17 @@ void FeedsView::deleteSelectedItem() {
}
if (selection_model->selectedRows().size() > 1) {
// pridat BalloonTip z qonverteru a tady
// ho odpalit pokud todle nastane
// s hlaskou "More than one item selected, removing
// only current one."
// User selected more than one item.
// Note that we can remove items only one by one.
// TODO: Display information balloon tip
// here, but only if tray icon is active.
selection_model->clearSelection();
selection_model->select(current_index, QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
}
if (m_sourceModel->removeItem(m_proxyModel->mapToSource(current_index))) {
// Item WAS removed.
// Item WAS removed, update counts.
updateCountsOfAllFeeds(true);
}
else {
// Item WAS NOT removed, either database-related error occurred

View File

@ -284,10 +284,19 @@ void FormSettings::promptForRestart() {
if (question_result == QMessageBox::Yes) {
if (!QProcess::startDetached(qApp->applicationFilePath())) {
MessageBox::show(this,
QMessageBox::Warning,
tr("Problem with application restart"),
tr("Application couldn't be restarted. Please, restart it manually for changes to take effect."));
if (SystemTrayIcon::isSystemTrayActivated()) {
SystemTrayIcon::instance()->showMessage(tr("Problem with application restart"),
tr("Application couldn't be restarted. "
"Please, restart it manually for changes to take effect."),
QSystemTrayIcon::Warning);
}
else {
MessageBox::show(this,
QMessageBox::Warning,
tr("Problem with application restart"),
tr("Application couldn't be restarted. "
"Please, restart it manually for changes to take effect."));
}
}
else {
QtSingleApplication::instance()->unlock();