diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index f80ae0836..6522b313c 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -66,6 +66,16 @@ #define ROLE_UNREAD Qt::UserRole + 3 #define ROLE_MSGFLAGS Qt::UserRole + 4 +#define ROLE_QUICKVIEW_TYPE Qt::UserRole +#define ROLE_QUICKVIEW_ID Qt::UserRole + 1 +#define ROLE_QUICKVIEW_TEXT Qt::UserRole + 2 + +#define QUICKVIEW_TYPE_NOTHING 0 +#define QUICKVIEW_TYPE_STATIC 1 +#define QUICKVIEW_TYPE_TAG 2 + +#define QUICKVIEW_STATIC_ID_STARRED 1 + #define ROW_INBOX 0 #define ROW_OUTBOX 1 #define ROW_DRAFTBOX 2 @@ -144,7 +154,7 @@ MessagesDialog::MessagesDialog(QWidget *parent) ui.setupUi(this); m_bProcessSettings = false; - m_bInChange = false; + inChange = false; m_nLockUpdate = 0; connect(ui.messagestreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(messageslistWidgetCostumPopupMenu(QPoint))); @@ -152,7 +162,7 @@ MessagesDialog::MessagesDialog(QWidget *parent) connect(ui.messagestreeView, SIGNAL(clicked(const QModelIndex&)) , this, SLOT(clicked(const QModelIndex&))); connect(ui.messagestreeView, SIGNAL(doubleClicked(const QModelIndex&)) , this, SLOT(doubleClicked(const QModelIndex&))); connect(ui.listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(changeBox(int))); - connect(ui.tagWidget, SIGNAL(currentRowChanged(int)), this, SLOT(changeTag(int))); + connect(ui.quickViewWidget, SIGNAL(currentRowChanged(int)), this, SLOT(changeQuickView(int))); connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); connect(ui.tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int))); connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage())); @@ -283,8 +293,8 @@ MessagesDialog::MessagesDialog(QWidget *parent) ui.tagButton->setMenu(menu); - // fill tags - fillTags(); + // fill quick view + fillQuickView(); // create timer for navigation timer = new QTimer(this); @@ -339,9 +349,9 @@ void MessagesDialog::processSettings(bool load) msgwheader->restoreState(Settings->value("MessageTree").toByteArray()); } - // state of tag list - bool value = Settings->value("tagList", true).toBool(); - ui.Tags_Button->setChecked(value); + // state of quick view list + bool value = Settings->value("QuickViewList", true).toBool(); + ui.quickViewsButton->setChecked(value); // state of splitter ui.msgSplitter->restoreState(Settings->value("Splitter").toByteArray()); @@ -358,8 +368,8 @@ void MessagesDialog::processSettings(bool load) Settings->setValue("MessageTree", msgwheader->saveState()); Settings->setValue("MessageTreeVersion", messageTreeVersion); - // state of tag list - Settings->setValue("tagList", ui.Tags_Button->isChecked()); + // state of quick view list + Settings->setValue("QuickViewList", ui.quickViewsButton->isChecked()); // state of splitter Settings->setValue("Splitter", ui.msgSplitter->saveState()); @@ -397,46 +407,60 @@ bool MessagesDialog::eventFilter(QObject *obj, QEvent *event) return MainPage::eventFilter(obj, event); } -void MessagesDialog::fillTags() +void MessagesDialog::fillQuickView() { MsgTagType tags; rsMsgs->getMessageTagTypes(tags); std::map >::iterator tag; // fill tags - m_bInChange = true; + inChange = true; // save current selection - QListWidgetItem *item = ui.tagWidget->currentItem(); - uint32_t nSelectecTagId = 0; + QListWidgetItem *item = ui.quickViewWidget->currentItem(); + int nSelectedType = 0; + uint32_t nSelectedId = 0; if (item) { - nSelectecTagId = item->data(Qt::UserRole).toInt(); + nSelectedType = item->data(ROLE_QUICKVIEW_TYPE).toInt(); + nSelectedId = item->data(ROLE_QUICKVIEW_ID).toInt(); } QListWidgetItem *itemToSelect = NULL; - QString text; - ui.tagWidget->clear(); + ui.quickViewWidget->clear(); + + // add static items + item = new QListWidgetItem(tr("Starred"), ui.quickViewWidget); + item->setIcon(QIcon(IMAGE_STAR_ON)); + item->setData(ROLE_QUICKVIEW_TYPE, QUICKVIEW_TYPE_STATIC); + item->setData(ROLE_QUICKVIEW_ID, QUICKVIEW_STATIC_ID_STARRED); + item->setData(ROLE_QUICKVIEW_TEXT, item->text()); // for updateMessageSummaryList + + if (nSelectedType == QUICKVIEW_TYPE_STATIC && nSelectedId == QUICKVIEW_STATIC_ID_STARRED) { + itemToSelect = item; + } + for (tag = tags.types.begin(); tag != tags.types.end(); tag++) { text = TagDefs::name(tag->first, tag->second.first); - item = new QListWidgetItem (text, ui.tagWidget); + item = new QListWidgetItem (text, ui.quickViewWidget); item->setForeground(QBrush(QColor(tag->second.second))); item->setIcon(QIcon(":/images/foldermail.png")); - item->setData(Qt::UserRole, tag->first); - item->setData(Qt::UserRole + 1, text); // for updateMessageSummaryList + item->setData(ROLE_QUICKVIEW_TYPE, QUICKVIEW_TYPE_TAG); + item->setData(ROLE_QUICKVIEW_ID, tag->first); + item->setData(ROLE_QUICKVIEW_TEXT, text); // for updateMessageSummaryList - if (tag->first == nSelectecTagId) { + if (nSelectedType == QUICKVIEW_TYPE_TAG && tag->first == nSelectedId) { itemToSelect = item; } } if (itemToSelect) { - ui.tagWidget->setCurrentItem(itemToSelect); + ui.quickViewWidget->setCurrentItem(itemToSelect); } - m_bInChange = false; + inChange = false; updateMessageSummaryList(); } @@ -691,42 +715,44 @@ void MessagesDialog::editmessage() void MessagesDialog::changeBox(int) { - if (m_bInChange) { + if (inChange) { // already in change method return; } - m_bInChange = true; + inChange = true; MessagesModel->removeRows (0, MessagesModel->rowCount()); - ui.tagWidget->setCurrentItem(NULL); + ui.quickViewWidget->setCurrentItem(NULL); m_eListMode = LIST_BOX; insertMessages(); insertMsgTxtAndFiles(); - m_bInChange = false; + inChange = false; } -void MessagesDialog::changeTag(int) +void MessagesDialog::changeQuickView(int newrow) { - if (m_bInChange) { + Q_UNUSED(newrow); + + if (inChange) { // already in change method return; } - m_bInChange = true; + inChange = true; MessagesModel->removeRows (0, MessagesModel->rowCount()); ui.listWidget->setCurrentItem(NULL); - m_eListMode = LIST_TAG; + m_eListMode = LIST_QUICKVIEW; insertMessages(); insertMsgTxtAndFiles(); - m_bInChange = false; + inChange = false; } void MessagesDialog::messagesTagsChanged() @@ -735,7 +761,7 @@ void MessagesDialog::messagesTagsChanged() return; } - fillTags(); + fillQuickView(); insertMessages(); } @@ -823,7 +849,8 @@ void MessagesDialog::insertMessages() unsigned int msgbox = 0; bool isTrash = false; bool doFill = true; - uint32_t tagId = 0; + int quickViewType = 0; + uint32_t quickViewId = 0; QString boxText; QIcon boxIcon; @@ -868,14 +895,19 @@ void MessagesDialog::insertMessages() } break; - case LIST_TAG: + case LIST_QUICKVIEW: { - QListWidgetItem *item = ui.tagWidget->currentItem(); + QListWidgetItem *item = ui.quickViewWidget->currentItem(); if (item) { - tagId = item->data (Qt::UserRole).toInt(); + quickViewType = item->data(ROLE_QUICKVIEW_TYPE).toInt(); + quickViewId = item->data(ROLE_QUICKVIEW_ID).toInt(); boxText = item->text(); boxIcon = item->icon(); + + if (quickViewType == QUICKVIEW_TYPE_NOTHING) { + doFill = false; + } } else { doFill = false; } @@ -917,10 +949,14 @@ void MessagesDialog::insertMessages() continue; } } - } else if (m_eListMode == LIST_TAG) { + } else if (m_eListMode == LIST_QUICKVIEW && quickViewType == QUICKVIEW_TYPE_TAG) { MsgTagInfo tagInfo; rsMsgs->getMessageTag(it->msgId, tagInfo); - if (std::find(tagInfo.tagIds.begin(), tagInfo.tagIds.end(), tagId) == tagInfo.tagIds.end()) { + if (std::find(tagInfo.tagIds.begin(), tagInfo.tagIds.end(), quickViewId) == tagInfo.tagIds.end()) { + continue; + } + } else if (m_eListMode == LIST_QUICKVIEW && quickViewType == QUICKVIEW_TYPE_STATIC) { + if ((it->msgflags & RS_MSG_STAR) == 0) { continue; } } else { @@ -1305,7 +1341,7 @@ void MessagesDialog::markWithStar(bool checked) getSelectedMsgCount (&Rows, NULL, NULL, NULL); setMsgStar(Rows, checked); - } +} void MessagesDialog::setMsgStar(const QList &Rows, bool star) { @@ -1333,6 +1369,8 @@ void MessagesDialog::setMsgStar(const QList &Rows, bool star) item[COLUMN_DATA]->setData(msgFlag, ROLE_MSGFLAGS); InitIconAndFont(item); + + Lock.setUpdate(true); } } @@ -1567,6 +1605,7 @@ void MessagesDialog::updateMessageSummaryList() unsigned int newSentboxCount = 0; unsigned int inboxCount = 0; unsigned int trashboxCount = 0; + unsigned int starredCount = 0; /* calculating the new messages */ // rsMsgs->getMessageCount (&inboxCount, &newInboxCount, &newOutboxCount, &newDraftCount, &newSentboxCount); @@ -1589,6 +1628,11 @@ void MessagesDialog::updateMessageSummaryList() tagCount [*tagId] = nCount; } + if (it->msgflags & RS_MSG_STAR) { + starredCount++; + continue; + } + /* calculate box */ if (it->msgflags & RS_MSG_TRASH) { trashboxCount++; @@ -1721,19 +1765,36 @@ void MessagesDialog::updateMessageSummaryList() item->setText(textItem); } - /* set tag counts */ - int nRowCount = ui.tagWidget->count(); - for (int nRow = 0; nRow < nRowCount; nRow++) { - QListWidgetItem *pItem = ui.tagWidget->item(nRow); - int nCount = tagCount[pItem->data(Qt::UserRole).toInt()]; + int rowCount = ui.quickViewWidget->count(); + for (int row = 0; row < rowCount; row++) { + QListWidgetItem *item = ui.quickViewWidget->item(row); + switch (item->data(ROLE_QUICKVIEW_TYPE).toInt()) { + case QUICKVIEW_TYPE_TAG: + { + int count = tagCount[item->data(ROLE_QUICKVIEW_ID).toInt()]; - QString sText = pItem->data(Qt::UserRole + 1).toString(); - if (nCount) { - sText += " (" + QString::number(nCount) + ")"; + QString text = item->data(ROLE_QUICKVIEW_TEXT).toString(); + if (count) { + text += " (" + QString::number(count) + ")"; + } + + item->setText(text); + } + break; + case QUICKVIEW_TYPE_STATIC: + { + QString text = item->data(ROLE_QUICKVIEW_TEXT).toString(); + switch (item->data(ROLE_QUICKVIEW_ID).toInt()) { + case QUICKVIEW_STATIC_ID_STARRED: + text += " (" + QString::number(starredCount) + ")"; + break; + } + + item->setText(text); + } + break; } - - pItem->setText(sText); } } diff --git a/retroshare-gui/src/gui/MessagesDialog.h b/retroshare-gui/src/gui/MessagesDialog.h index f3efb46b7..e9f552d41 100644 --- a/retroshare-gui/src/gui/MessagesDialog.h +++ b/retroshare-gui/src/gui/MessagesDialog.h @@ -54,8 +54,8 @@ private slots: void messageslistWidgetCostumPopupMenu( QPoint point ); void folderlistWidgetCostumPopupMenu(QPoint); - void changeBox( int newrow ); - void changeTag( int newrow ); + void changeBox(int newrow); + void changeQuickView(int newrow); void updateCurrentMessage(); void currentChanged(const QModelIndex&); void clicked(const QModelIndex&); @@ -123,15 +123,15 @@ private: void processSettings(bool load); void setToolbarButtonStyle(Qt::ToolButtonStyle style); - void fillTags(); + void fillQuickView(); void closeTab(const std::string &msgId); bool m_bProcessSettings; - bool m_bInChange; + bool inChange; int m_nLockUpdate; // use with LockUpdate - enum { LIST_NOTHING, LIST_BOX, LIST_TAG } m_eListMode; + enum { LIST_NOTHING, LIST_BOX, LIST_QUICKVIEW } m_eListMode; std::string mCurrMsgId; diff --git a/retroshare-gui/src/gui/MessagesDialog.ui b/retroshare-gui/src/gui/MessagesDialog.ui index 96b3e4f31..70a055951 100644 --- a/retroshare-gui/src/gui/MessagesDialog.ui +++ b/retroshare-gui/src/gui/MessagesDialog.ui @@ -1018,11 +1018,6 @@ border-image: url(:/images/closepressed.png) Qt::LeftToRight - - QTabBar::tab { -} - - true @@ -1177,7 +1172,7 @@ border-image: url(:/images/closepressed.png) - + 160 @@ -1193,7 +1188,7 @@ border-image: url(:/images/closepressed.png) - + 0 @@ -1207,14 +1202,14 @@ border-image: url(:/images/closepressed.png) - QToolButton#Tags_Button{ + QToolButton#quickViewsButton{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;} - Favorite Tags + Quick View @@ -1390,9 +1385,9 @@ padding: 4px; - Tags_Button + quickViewsButton toggled(bool) - tagWidget + quickViewWidget setVisible(bool) diff --git a/retroshare-gui/src/lang/retroshare_de.qm b/retroshare-gui/src/lang/retroshare_de.qm index ca3b5b2c1..a634ec05f 100644 Binary files a/retroshare-gui/src/lang/retroshare_de.qm and b/retroshare-gui/src/lang/retroshare_de.qm differ diff --git a/retroshare-gui/src/lang/retroshare_de.ts b/retroshare-gui/src/lang/retroshare_de.ts index ae6382ade..27aa9f90b 100644 --- a/retroshare-gui/src/lang/retroshare_de.ts +++ b/retroshare-gui/src/lang/retroshare_de.ts @@ -6956,12 +6956,12 @@ p, li { white-space: pre-wrap; } MessagesDialog - + New Message Neue Nachricht - + Reply to Message Antworten nur an Absender @@ -6976,20 +6976,20 @@ p, li { white-space: pre-wrap; } In neuem Tab öffnen - + Remove Message Nachricht entfernen - + Date Datum - + From Von @@ -7070,17 +7070,17 @@ p, li { white-space: pre-wrap; } Anhänge - - - + + + Inbox Posteingang - - + + Outbox Postausgang @@ -7092,10 +7092,15 @@ p, li { white-space: pre-wrap; } - + Sent Gesendet + + + Quick View + Schnellansicht + Download all Recommended Files Alle Dateien runterladen @@ -7113,7 +7118,7 @@ p, li { white-space: pre-wrap; } Schlagwörter: - + Print... Drucken... @@ -7159,8 +7164,8 @@ p, li { white-space: pre-wrap; } Dokument drucken - - + + Subject Betreff @@ -7195,7 +7200,12 @@ p, li { white-space: pre-wrap; } Gewählte Nachricht weiterleiten - + + Starred + Gekennzeichnet + + + Edit Bearbeiten @@ -7205,17 +7215,17 @@ p, li { white-space: pre-wrap; } Als neu bearbeiten - + Remove Messages Nachrichten entfernen - + Forward Message Weiterleiten - + Click to sort by attachments Klicken, um nach Anhang zu sortieren @@ -7231,12 +7241,12 @@ p, li { white-space: pre-wrap; } - + Click to sort by from Klicken, um nach Von zu sortieren - + Click to sort by date Klicken, um nach Datum zu sortieren @@ -7262,7 +7272,7 @@ p, li { white-space: pre-wrap; } Empfohlene Dateien einblenden - + Click to sort by to Klicken, um nach Empfänger zu sortieren @@ -7283,8 +7293,8 @@ p, li { white-space: pre-wrap; } HTML-Dateien (*.htm *.html);;Alle Dateien (*) - - + + Reply to All Allen antworten @@ -7296,13 +7306,13 @@ p, li { white-space: pre-wrap; } <html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Alle Dateien runterladen</p></body></html> - + Total Inbox: Posteingang gesamt: - - + + Content Inhalt @@ -7320,20 +7330,19 @@ p, li { white-space: pre-wrap; } Schlagwort - - - + + + Trash Papierkorb - Favorite Tags - Schlagwörter + Schlagwörter - + Folders Ordner @@ -7346,7 +7355,7 @@ p, li { white-space: pre-wrap; } Neues Schlagwort... - + Mark as read Als gelesen markieren @@ -7361,7 +7370,7 @@ p, li { white-space: pre-wrap; } Kennzeichnung - + Undelete Wiederherstellen @@ -7371,14 +7380,14 @@ p, li { white-space: pre-wrap; } Papierkorb leeren - - + + Drafts Entwürfe - + To An @@ -7387,12 +7396,12 @@ p, li { white-space: pre-wrap; } Editieren... - + Click to sort by star Klicken, um nach Kennzeichnung zu sortieren - + @@ -9845,7 +9854,7 @@ Lockdatei: Der Start mit einem RetroShare Link wird nur unter Windows unterstützt. - + (Age in seconds) @@ -9855,13 +9864,13 @@ Lockdatei: - - Evolution of search requests: + + Search requests repartition: - - Evolution of tunnel requests: + + Tunnel requests repartition: @@ -12322,7 +12331,7 @@ p, li { white-space: pre-wrap; } TransfersDialog - + Cancel Abbrechen @@ -12332,7 +12341,7 @@ p, li { white-space: pre-wrap; } Fertige ausblenden - + Status Status @@ -12361,7 +12370,7 @@ p, li { white-space: pre-wrap; } Zeige Cache Übertragungen - + Uploads @@ -12385,11 +12394,6 @@ p, li { white-space: pre-wrap; } Outstanding Ausstehend - - - Tunneling - - @@ -12445,7 +12449,7 @@ p, li { white-space: pre-wrap; } Übertragen - + Play Abspielen @@ -12570,7 +12574,7 @@ p, li { white-space: pre-wrap; } Soll dieser Download wirklich abgebrochen und gelöscht werden? - + Speed / Queue position Geschwindigkeits- / Warteschlangenposition @@ -12597,7 +12601,17 @@ p, li { white-space: pre-wrap; } Prüfsumme - + + Router Statistics + Router Statistiken + + + + Router Requests + + + + Copy RetroShare Link Kopiere RetroShare Link @@ -12832,14 +12846,14 @@ p, li { white-space: pre-wrap; } TurtleRouterDialog - - + + Search requests Suchanfragen - - + + Tunnel requests Tunnelanfragen @@ -12852,15 +12866,23 @@ p, li { white-space: pre-wrap; } Router Statistiken - + F2F router information F2F Routerinformationen + + TurtleRouterStatistics + + + Router Statistics + Router Statistiken + + TurtleRouterStatisticsWidget - + Turtle router traffic: