Merge branch 'RetroShare:master' into editboardpost-v1

This commit is contained in:
defnax 2026-01-17 21:21:06 +01:00 committed by GitHub
commit c8d2ada514
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
123 changed files with 1047 additions and 722 deletions

View file

@ -66,5 +66,5 @@ jobs:
- name: CI-Build
run: |
qmake . -r -spec win32-g++ "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=no_rs_sam3" "CONFIG+=no_rs_sam3_libsam3"
qmake-qt5.exe . -r -spec win32-g++ "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=no_rs_sam3" "CONFIG+=no_rs_sam3_libsam3"
mingw32-make -j3

View file

@ -66,5 +66,5 @@ jobs:
- name: CI-Build
run: |
qmake . -r -spec win32-g++ "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=no_rs_sam3" "CONFIG+=no_rs_sam3_libsam3"
qmake-qt5.exe . -r -spec win32-g++ "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=no_rs_sam3" "CONFIG+=no_rs_sam3_libsam3"
mingw32-make -j3

4
.gitignore vendored
View file

@ -35,3 +35,7 @@ Thumbs.db
/retroshare-gui/src/temp/
/retroshare-service/src/retroshare-service
/*.tar.?z
# Build artifacts
build/
.vscode/

@ -1 +1 @@
Subproject commit 96e249a06d8f30c2aace38beecc8fb7271159a88
Subproject commit ad3cc8313df4a3c6f5b0af9e09375270e02eaee7

View file

@ -71,7 +71,7 @@ AboutWidget::AboutWidget(QWidget* parent)
void AboutWidget::installAWidget() {
assert(tWidget == NULL);
aWidget = new AWidget();
QVBoxLayout* l = (QVBoxLayout*)specialFrame->layout();
QHBoxLayout* l = (QHBoxLayout*)specialFrame->layout();
l->insertWidget(0, aWidget);
l->setStretchFactor(aWidget, 100);
aWidget->setFocus();
@ -87,7 +87,7 @@ void AboutWidget::installTWidget() {
tWidget->setNextPieceLabel(npLabel);
QWidget* pan = new QWidget();
QVBoxLayout* vl = new QVBoxLayout(pan);
QHBoxLayout* vl = new QHBoxLayout(pan);
QLabel* topRecLabel = new QLabel(tr("Max score: %1").arg(tWidget->getMaxScore()));
QLabel* scoreLabel = new QLabel(pan);
QLabel* levelLabel = new QLabel(pan);
@ -217,7 +217,6 @@ void AWidget::initImages()
image1 = QImage(width(),height(),QImage::Format_ARGB32);
image1.fill(palette().color(QPalette::Window));
//QImage image(":/images/logo/logo_info.png");
QPixmap image(":/images/logo/logo_splash.png");
QPainter p(&image1);
p.setPen(Qt::black);
@ -226,22 +225,23 @@ void AWidget::initImages()
font.setPointSizeF(font.pointSizeF() + 2);
p.setFont(font);
//p.drawPixmap(QRect(10, 10, width()-10, 60), image);
/* Draw RetroShare version */
/* [Fix] Removed space before colon to match English typography */
#ifdef RS_ONLYHIDDENNODE
p.drawText(QPointF(10, 50), QString("%1 : %2 (With embedded Tor)").arg(tr("Retroshare version"), Rshare::retroshareVersion(true)));
p.drawText(QPointF(10, 50), QString("%1: %2 (With embedded Tor)").arg(tr("RetroShare version"), RsApplication::retroshareVersion(true)));
#else
p.drawText(QPointF(10, 50), QString("%1 : %2").arg(tr("Retroshare version"), RsApplication::retroshareVersion(true)));
p.drawText(QPointF(10, 50), QString("%1: %2").arg(tr("RetroShare version"), RsApplication::retroshareVersion(true)));
#endif
/* [Added] Draw libretroshare version below the GUI version */
/* [Fix] Removed space before colon here too */
p.drawText(QPointF(10, 70), QString("%1: %2").arg(tr("libretroshare version"), QString::fromUtf8(RsInit::libRetroShareVersion())));
/* Draw Qt's version number */
p.drawText(QPointF(10, 90), QString("Qt %1 : %2").arg(tr("version"), QT_VERSION_STR));
p.drawText(QPointF(10, 90), QString("Qt %1: %2").arg(tr("version"), QT_VERSION_STR));
p.end();
// setFixedSize(image1.size());
image2 = image1 ;
mImagesReady = true ;
@ -940,13 +940,17 @@ static QString addLibraries(const std::string &name, const std::list<RsLibraryIn
return mTextEdit;
}
void AboutWidget::on_copy_button_clicked()
{
QString verInfo;
QString rsVerString = "RetroShare Version: ";
rsVerString+=RsApplication::retroshareVersion(true);
verInfo+=rsVerString;
/* [Added] Append libretroshare version to clipboard info */
verInfo+= "\nlibretroshare: ";
verInfo+= QString::fromUtf8(RsInit::libRetroShareVersion());
#ifdef RS_ONLYHIDDENNODE
verInfo+=" " + tr("Only Hidden Node");
#endif
@ -1003,3 +1007,4 @@ void AboutWidget::on_copy_button_clicked()
QApplication::clipboard()->setText(verInfo);
}

View file

@ -37,7 +37,7 @@
#include "util/qtthreadsutils.h"
#include "util/RsQtVersion.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rschats.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsidentity.h"
@ -199,7 +199,14 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
publicLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC);
ui.lobbyTreeWidget->insertTopLevelItem(3, publicLobbyItem);
ui.lobbyTreeWidget->expandAll();
// expand subscribed lobbvies
ui.lobbyTreeWidget->expandItem(privateSubLobbyItem);
ui.lobbyTreeWidget->expandItem(publicSubLobbyItem);
// collapse aunsubscribed lobbies
ui.lobbyTreeWidget->collapseItem(privateLobbyItem);
ui.lobbyTreeWidget->collapseItem(publicLobbyItem);
ui.lobbyTreeWidget->setColumnHidden(COLUMN_NAME,false) ;
ui.lobbyTreeWidget->setColumnHidden(COLUMN_USER_COUNT,true) ;
ui.lobbyTreeWidget->setColumnHidden(COLUMN_TOPIC,true) ;
@ -477,7 +484,7 @@ void ChatLobbyWidget::addChatPage(ChatLobbyDialog *d)
_lobby_infos[id].last_typing_event = time(nullptr) ;
ChatLobbyInfo linfo ;
if(rsMsgs->getChatLobbyInfo(id,linfo))
if(rsChats->getChatLobbyInfo(id,linfo))
_lobby_infos[id].default_icon = (linfo.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC) ? FilesDefs::getIconFromQtResourcePath(IMAGE_PUBLIC):FilesDefs::getIconFromQtResourcePath(IMAGE_PRIVATE) ;
else
std::cerr << "(EE) cannot find info for room " << std::hex << id << std::dec << std::endl;
@ -521,10 +528,10 @@ void ChatLobbyWidget::updateDisplay()
std::cerr << "updating chat room display!" << std::endl;
#endif
std::vector<VisibleChatLobbyRecord> visibleLobbies;
rsMsgs->getListOfNearbyChatLobbies(visibleLobbies);
rsChats->getListOfNearbyChatLobbies(visibleLobbies);
std::list<ChatLobbyId> lobbies;
rsMsgs->getChatLobbyList(lobbies);
rsChats->getChatLobbyList(lobbies);
#ifdef CHAT_LOBBY_GUI_DEBUG
std::cerr << "got " << visibleLobbies.size() << " visible lobbies" << std::endl;
@ -676,7 +683,7 @@ void ChatLobbyWidget::updateDisplay()
// In the new model (after lobby save to disk) the auto-subscribe flag is used to automatically join lobbies that where
// previously being used when the t software quits.
bool autoSubscribe = rsMsgs->getLobbyAutoSubscribe(lobby.lobby_id);
bool autoSubscribe = rsChats->getLobbyAutoSubscribe(lobby.lobby_id);
if (autoSubscribe && subscribed && _lobby_infos.find(lobby.lobby_id) == _lobby_infos.end())
{
@ -695,7 +702,7 @@ void ChatLobbyWidget::updateDisplay()
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt)
{
ChatLobbyInfo lobby ;
rsMsgs->getChatLobbyInfo(*lobbyIt,lobby) ;
rsChats->getChatLobbyInfo(*lobbyIt,lobby) ;
#ifdef CHAT_LOBBY_GUI_DEBUG
std::cerr << "adding " << lobby.lobby_name << "topic " << lobby.lobby_topic << " #" << std::hex << lobby.lobby_id << std::dec << " private " << lobby.nick_names.size() << " peers." << std::endl;
@ -738,7 +745,7 @@ void ChatLobbyWidget::updateDisplay()
item->setIcon(COLUMN_NAME, icon);
}
bool autoSubscribe = rsMsgs->getLobbyAutoSubscribe(lobby.lobby_id);
bool autoSubscribe = rsChats->getLobbyAutoSubscribe(lobby.lobby_id);
updateItem(ui.lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.gxs_ids.size(), true, autoSubscribe,lobby_flags);
@ -746,7 +753,7 @@ void ChatLobbyWidget::updateDisplay()
// look for chat rooms that are subscribed but not displayed as such
if(it == _lobby_infos.end() && rsMsgs->joinVisibleChatLobby(lobby.lobby_id,lobby.gxs_id))
if(it == _lobby_infos.end() && rsChats->joinVisibleChatLobby(lobby.lobby_id,lobby.gxs_id))
{
std::cerr << "Adding back ChatLobbyDialog for subscribed lobby " << std::hex << lobby.lobby_id << std::dec << std::endl;
ChatDialog::chatFriend(ChatId(lobby.lobby_id),true) ;
@ -812,7 +819,7 @@ void ChatLobbyWidget::createIdentityAndSubscribe()
if(!rsIdentity->getOwnIds(own_ids) || own_ids.empty())
return;
if(rsMsgs->joinVisibleChatLobby(id,own_ids.front()))
if(rsChats->joinVisibleChatLobby(id,own_ids.front()))
ChatDialog::chatFriend(ChatId(id),true) ;
}
@ -832,7 +839,7 @@ void ChatLobbyWidget::subscribeChatLobbyAs()
RsGxsId gxs_id(action->data().toString().toStdString());
//uint32_t error_code ;
if(rsMsgs->joinVisibleChatLobby(id,gxs_id))
if(rsChats->joinVisibleChatLobby(id,gxs_id))
ChatDialog::chatFriend(ChatId(id),true) ;
}
@ -872,7 +879,7 @@ void ChatLobbyWidget::subscribeChatLobbyAtItem(QTreeWidgetItem *item)
RsGxsId gxs_id ;
std::list<RsGxsId> own_ids;
// not using rsMsgs->getDefaultIdentityForChatLobby(), to check if we have an identity
// not using rsChats->getDefaultIdentityForChatLobby(), to check if we have an identity
// to work around the case when the identity was deleted and is invalid
// (the chatservice does not know if a default identity was deleted)
// only rsIdentity knows the truth at the moment!
@ -895,7 +902,7 @@ void ChatLobbyWidget::subscribeChatLobbyAtItem(QTreeWidgetItem *item)
}
else
{
rsMsgs->getDefaultIdentityForChatLobby(gxs_id);
rsChats->getDefaultIdentityForChatLobby(gxs_id);
RsIdentityDetails idd ;
if(!rsIdentity->getIdDetails(gxs_id,idd))
@ -908,7 +915,7 @@ void ChatLobbyWidget::subscribeChatLobbyAtItem(QTreeWidgetItem *item)
}
}
if(rsMsgs->joinVisibleChatLobby(id,gxs_id))
if(rsChats->joinVisibleChatLobby(id,gxs_id))
ChatDialog::chatFriend(ChatId(id),true) ;
}
@ -919,8 +926,8 @@ void ChatLobbyWidget::autoSubscribeLobby(QTreeWidgetItem *item)
}
ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
bool isAutoSubscribe = rsMsgs->getLobbyAutoSubscribe(id);
rsMsgs->setLobbyAutoSubscribe(id, !isAutoSubscribe);
bool isAutoSubscribe = rsChats->getLobbyAutoSubscribe(id);
rsChats->setLobbyAutoSubscribe(id, !isAutoSubscribe);
if (!isAutoSubscribe && !item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool())
subscribeChatLobbyAtItem(item);
}
@ -932,7 +939,7 @@ void ChatLobbyWidget::showBlankPage(ChatLobbyId id, bool subscribed /*= false*/)
// Update information
std::vector<VisibleChatLobbyRecord> lobbies;
rsMsgs->getListOfNearbyChatLobbies(lobbies);
rsChats->getListOfNearbyChatLobbies(lobbies);
std::list<RsGxsId> my_ids ;
rsIdentity->getOwnIds(my_ids) ;
@ -1115,9 +1122,9 @@ void ChatLobbyWidget::unsubscribeChatLobby(ChatLobbyId id)
// Unsubscribe the chat lobby
ChatDialog::closeChat(ChatId(id));
rsMsgs->unsubscribeChatLobby(id);
bool isAutoSubscribe = rsMsgs->getLobbyAutoSubscribe(id);
if (isAutoSubscribe) rsMsgs->setLobbyAutoSubscribe(id, !isAutoSubscribe);
rsChats->unsubscribeChatLobby(id);
bool isAutoSubscribe = rsChats->getLobbyAutoSubscribe(id);
if (isAutoSubscribe) rsChats->setLobbyAutoSubscribe(id, !isAutoSubscribe);
ChatLobbyDialog *cldCW=NULL ;
if (NULL != (cldCW = dynamic_cast<ChatLobbyDialog *>(ui.stackedWidget->currentWidget())))
@ -1198,13 +1205,13 @@ void ChatLobbyWidget::handleChatLobbyEvent(uint64_t lobby_id, RsChatLobbyEventCo
void ChatLobbyWidget::readChatLobbyInvites()
{
std::list<ChatLobbyInvite> invites;
rsMsgs->getPendingChatLobbyInvites(invites);
rsChats->getPendingChatLobbyInvites(invites);
RsGxsId default_id ;
rsMsgs->getDefaultIdentityForChatLobby(default_id) ;
rsChats->getDefaultIdentityForChatLobby(default_id) ;
std::list<ChatLobbyId> subscribed_lobbies ;
rsMsgs->getChatLobbyList(subscribed_lobbies) ;
rsChats->getChatLobbyList(subscribed_lobbies) ;
for(std::list<ChatLobbyInvite>::const_iterator it(invites.begin());it!=invites.end();++it)
{
@ -1258,7 +1265,7 @@ void ChatLobbyWidget::readChatLobbyInvites()
if (res == QMessageBox::No)
{
rsMsgs->denyLobbyInvite((*it).lobby_id);
rsChats->denyLobbyInvite((*it).lobby_id);
continue ;
}
@ -1267,11 +1274,11 @@ void ChatLobbyWidget::readChatLobbyInvites()
if(chosen_id.isNull())
{
rsMsgs->denyLobbyInvite((*it).lobby_id);
rsChats->denyLobbyInvite((*it).lobby_id);
continue ;
}
if(rsMsgs->acceptLobbyInvite((*it).lobby_id,chosen_id))
if(rsChats->acceptLobbyInvite((*it).lobby_id,chosen_id))
ChatDialog::chatFriend(ChatId((*it).lobby_id),true);
else
std::cerr << "Can't join chat room with id 0x" << std::hex << (*it).lobby_id << std::dec << std::endl;

View file

@ -28,7 +28,7 @@
#include "util/FontSizeHandler.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <QAbstractButton>
#include <QTreeWidget>

View file

@ -28,6 +28,7 @@
#include <retroshare/rspeers.h>
#include <retroshare/rshistory.h>
#include <retroshare/rsinit.h>
#include <retroshare/rschats.h>
#include "chat/ChatUserNotify.h"
#include "connect/ConnectFriendWizard.h"
@ -283,14 +284,14 @@ void FriendsDialog::getAvatar()
std::cerr << "Avatar image size = " << ba.size() << std::endl ;
#endif
rsMsgs->setOwnAvatarData((unsigned char *)(ba.data()), ba.size()) ; // last char 0 included.
rsChats->setOwnNodeAvatarData((unsigned char *)(ba.data()), ba.size()) ; // last char 0 included.
}
}
/** Loads own personal status */
void FriendsDialog::loadmypersonalstatus()
{
QString statustring = QString::fromUtf8(rsMsgs->getCustomStateString().c_str());
QString statustring = QString::fromUtf8(rsChats->getOwnCustomStateString().c_str());
if (statustring.isEmpty())
ui.mypersonalstatusLabel->setText(tr("Set your status message here."));

View file

@ -80,11 +80,20 @@ HelpDialog::HelpDialog(QWidget *parent) :
ui->thanks->setHtml(in.readAll());
}
ui->version->setText(RsApplication::retroshareVersion(true));
/* [Modified] Display both RetroShare and libretroshare versions clearly */
QString versionText = QString("RetroShare: %1\nlibretroshare: %2")
.arg(RsApplication::retroshareVersion(true))
.arg(QString::fromUtf8(RsInit::libRetroShareVersion()));
ui->version->setText(versionText);
/* Add version numbers of libretroshare */
std::list<RsLibraryInfo> libraries;
RsControl::instance()->getLibraries(libraries);
/* [Added] Insert libretroshare version at the top of the libraries list */
libraries.push_front(RsLibraryInfo("libretroshare", RsInit::libRetroShareVersion()));
addLibraries(ui->libraryLayout, "libretroshare", libraries);
// #ifdef RS_WEBUI

View file

@ -149,7 +149,7 @@ void IdDetailsDialog::loadIdentity(RsGxsIdGroup data)
ui->autoBanIdentities_CB->setVisible(!data.mPgpId.isNull()) ;
ui->banoption_label->setVisible(!data.mPgpId.isNull()) ;
ui->lineEdit_Created->setText(QLocale::system().toString(DateTime::DateTimeFromTime_t(data.mMeta.mPublishTs), QLocale::ShortFormat));
ui->lineEdit_Created->setText(DateTime::formatDateTime(data.mMeta.mPublishTs));
time_t now = time(NULL) ;
ui->lineEdit_LastUsed->setText(getHumanReadableDuration(now - data.mLastUsageTS)) ;

View file

@ -53,7 +53,7 @@
#include "util/DateTime.h"
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rschats.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsservicecontrol.h"
@ -453,10 +453,14 @@ IdDialog::IdDialog(QWidget *parent)
mFontSizeHandler.registerFontSize(ui->idTreeWidget, 0, [this] (QAbstractItemView*, int fontSize) {
// Set new font size on all items
mIdListModel->setFontSize(fontSize);
});
QFontMetricsF fontMetrics(ui->treeWidget_membership->font());
int iconHeight = fontMetrics.height() * 1.4;
ui->treeWidget_membership->setIconSize(QSize(iconHeight, iconHeight));
ui->idTreeWidget->setIconSize(QSize(iconHeight, iconHeight));
mFontSizeHandler.registerFontSize(ui->treeWidget_membership, 0, [this] (QAbstractItemView*, int fontSize) {
// Set new font size on all items
QTreeWidgetItemIterator it(ui->treeWidget_membership);
@ -1654,10 +1658,12 @@ void IdDialog::loadIdentity(RsGxsIdGroup data)
/* get GPG Details from rsPeers */
RsPgpId ownPgpId = rsPeers->getGPGOwnId();
ui->lineEdit_PublishTS->setText(QLocale::system().toString(DateTime::DateTimeFromTime_t(data.mMeta.mPublishTs), QLocale::ShortFormat));
ui->lineEdit_PublishTS->setText(DateTime::formatDateTime(data.mMeta.mPublishTs));
//ui->lineEdit_Nickname->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
ui->lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId.toStdString()));
//ui->lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash.toStdString()));
ui->lineEdit_KeyId->setText(QString::fromStdString(data.mMeta.mGroupId.toStdString()));
//ui->lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash.toStdString()));
if(data.mPgpKnown)
ui->lineEdit_GpgId->setText(QString::fromStdString(data.mPgpId.toStdString()));
else
@ -1917,7 +1923,7 @@ QString IdDialog::createUsageString(const RsIdentityUsage& u) const
{
ChatId id = ChatId(ChatLobbyId(u.mAdditionalId));
ChatLobbyInfo linfo ;
rsMsgs->getChatLobbyInfo(ChatLobbyId(u.mAdditionalId),linfo);
rsChats->getChatLobbyInfo(ChatLobbyId(u.mAdditionalId),linfo);
RetroShareLink l = RetroShareLink::createChatRoom(id, QString::fromUtf8(linfo.lobby_name.c_str()));
return tr("Message in chat room %1").arg(l.toHtml()) ;
}
@ -2456,7 +2462,7 @@ void IdDialog::chatIdentity(const RsGxsId& toGxsId)
uint32_t error_code;
DistantChatPeerId did;
if(!rsMsgs->initiateDistantChatConnexion(toGxsId, fromGxsId, did, error_code))
if(!rsChats->initiateDistantChatConnexion(toGxsId, fromGxsId, did, error_code))
QMessageBox::information(
nullptr, tr("Distant chat cannot work")
, QString("%1 %2: %3")

View file

@ -24,7 +24,8 @@
#include <QColor>
#include "retroshare/rsstatus.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rschats.h"
#include "retroshare/rsmail.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsidentity.h"

View file

@ -27,7 +27,7 @@
#include "common/StatusDefs.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <retroshare/rsstatus.h>
#include "rshare.h"
@ -223,13 +223,13 @@ void MessengerWindow::openShareManager()
/** Loads own personal status message */
void MessengerWindow::loadmystatusmessage()
{
ui.messagelineEdit->setEditText( QString::fromUtf8(rsMsgs->getCustomStateString().c_str()));
ui.messagelineEdit->setEditText( QString::fromUtf8(rsChats->getOwnCustomStateString().c_str()));
}
/** Save own status message */
void MessengerWindow::savestatusmessage()
{
rsMsgs->setCustomStateString(ui.messagelineEdit->currentText().toUtf8().constData());
rsChats->setCustomStateString(ui.messagelineEdit->currentText().toUtf8().constData());
}
void MessengerWindow::updateOwnStatus(const QString &peer_id, RsStatusValue status)

View file

@ -28,7 +28,6 @@
#include <retroshare/rsiface.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsmsgs.h>
#include "common/vmessagebox.h"
#include "common/RSTreeWidgetItem.h"

View file

@ -24,7 +24,6 @@
#include <retroshare/rsiface.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsmsgs.h>
bool pgpid_item_proxy::lessThan(const QModelIndex &left, const QModelIndex &right) const
{

View file

@ -26,7 +26,8 @@
#include <retroshare/rsbanlist.h>
#include <retroshare/rsgxschannels.h>
#include <retroshare/rsgxsforums.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <retroshare/rsmail.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsplugin.h>
#include <retroshare/rsposted.h>
@ -69,6 +70,8 @@
* #define NEWS_DEBUG 1
****/
using namespace Rs::Mail;
static NewsFeed* instance = nullptr;
/** Constructor */

View file

@ -1,6 +1,7 @@
#include <math.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rschats.h>
#include <QPainter>
#include <QMessageBox>

View file

@ -35,8 +35,9 @@
#include "retroshare/rsidentity.h"
#include "retroshare/rsgxscircles.h"
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rsids.h"
#include "retroshare/rsmail.h"
#include "retroshare/rschats.h"
#include "retroshare/rsids.h"
#include <iostream>
#include <QMenu>
@ -604,7 +605,7 @@ void PeopleDialog::chatIdentity()
DistantChatPeerId dpid ;
if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(gxs_id), from_gxs_id, dpid,error_code))
if(!rsChats->initiateDistantChatConnexion(RsGxsId(gxs_id), from_gxs_id, dpid,error_code))
QMessageBox::information(NULL, tr("Distant chat cannot work"), QString("%1 %2: %3").arg(tr("Distant chat refused with this person.")).arg(tr("Error code")).arg(error_code)) ;
}

View file

@ -196,15 +196,15 @@ void BoardPostDisplayWidgetBase::baseSetup()
fromLabel()->setId(mPost.mMeta.mAuthorId);
titleLabel()->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp = DateTime::formatDateTime(qtime);
dateLabel()->setText(timestamp);
pictureLabel()->setDisabled(true);
}
else
{
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs) + " " + tr("ago");
QString timestamp = DateTime::formatDateTime(qtime);
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs) + " " + tr("ago");
dateLabel()->setText(timestamp);
dateLabel()->setToolTip(timestamp2);

View file

@ -188,7 +188,7 @@ void PostedCardView::fill()
ui->fromLabel->setId(mPost.mMeta.mAuthorId);
ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp = DateTime::formatDateTime(qtime);
ui->dateLabel->setText(timestamp);
} else {
@ -199,7 +199,7 @@ void PostedCardView::fill()
//int desired_width = sqpixmap2.width()*desired_height/(float)sqpixmap2.height();
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp = DateTime::formatDateTime(qtime);
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
ui->dateLabel->setText(timestamp2);
ui->dateLabel->setToolTip(timestamp);

View file

@ -500,7 +500,7 @@ void PostedItem::fill()
ui->fromLabel->setId(mPost.mMeta.mAuthorId);
ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp = DateTime::formatDateTime(qtime);
ui->dateLabel->setText(timestamp);
} else {
RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_POSTED, mGroupMeta.mGroupId, groupName());
@ -515,7 +515,7 @@ void PostedItem::fill()
ui->thumbnailLabel->setFixedSize(desired_width,desired_height);
QDateTime qtime = DateTime::DateTimeFromTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("hh:mm dd-MMM-yyyy");
QString timestamp = DateTime::formatDateTime(qtime);
QString timestamp2 = misc::timeRelativeToNow(mPost.mMeta.mPublishTs);
ui->dateLabel->setText(timestamp2);
ui->dateLabel->setToolTip(timestamp);

View file

@ -427,7 +427,7 @@ void PostedListWidget::insertPostedDetails(const RsPostedGroup &group)
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost));
ui->infoLastPost->setText(DateTime::formatDateTime(group.mMeta.mLastPost));
QString formatDescription = QString::fromUtf8(group.mDescription.c_str());
@ -442,7 +442,7 @@ void PostedListWidget::insertPostedDetails(const RsPostedGroup &group)
link = RetroShareLink::createMessage(group.mMeta.mAuthorId, "");
ui->infoAdministrator->setText(link.toHtml());
ui->createdinfolabel->setText(DateTime::formatLongDateTime(group.mMeta.mPublishTs));
ui->createdinfolabel->setText(DateTime::formatDateTime(group.mMeta.mPublishTs));
QString distrib_string ( "[unknown]" );

View file

@ -875,7 +875,7 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group)
if(group.mMeta.mLastPost==0)
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost));
ui->infoLastPost->setText(DateTime::formatDateTime(group.mMeta.mLastPost));
uint32_t current_sync_time = GxsGroupFrameDialog::checkDelay(rsPosted->getSyncPeriod(group.mMeta.mGroupId))/86400 ;
@ -918,7 +918,7 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group)
link = RetroShareLink::createMessage(group.mMeta.mAuthorId, "");
ui->infoAdministrator->setText(link.toHtml());
ui->createdinfolabel->setText(DateTime::formatLongDateTime(group.mMeta.mPublishTs));
ui->createdinfolabel->setText(DateTime::formatDateTime(group.mMeta.mPublishTs));
QString distrib_string ( "[unknown]" );

View file

@ -40,7 +40,6 @@
#include <retroshare/rsfiles.h>
#include <retroshare/rsgxsforums.h>
#include <retroshare/rsidentity.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rspeers.h>
#include <QApplication>
@ -1563,8 +1562,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
case TYPE_FILE:
{
FileInfo fi1;
if(links.size()==1 && rsFiles->alreadyHaveFile(RsFileHash(link.hash().toStdString()), fi1)
&& !link.name().endsWith(RsCollection::ExtensionString))
if(links.size()==1 && rsFiles->alreadyHaveFile(RsFileHash(link.hash().toStdString()), fi1))
{
/* fallthrough */
}
@ -1635,22 +1633,31 @@ static void processList(const QStringList &list, const QString &textSingular, co
QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists() && qinfo.isFile() && !dontOpenNextFile) {
QString question = "<html><body>";
question += QObject::tr("Warning: Retroshare is about to ask your system to open this file. ");
question += QObject::tr("Before you do so, please make sure that this file does not contain malicious executable code.");
question += "<br><br>" + cleanname + "</body></html>";
QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No, links.size()>1 ? QMessageBox::NoToAll : 0, nullptr);
int ret = mb.exec();
if(ret == QMessageBox::Yes) {
if(qinfo.suffix() == RsCollection::ExtensionString) {
++countFileOpened;
bFileOpened = true;
/* open file with a suitable application */
if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) {
std::cerr << "RetroShareLink::process(): can't open file " << path << std::endl;
if(!RsCollectionDialog::openExistingCollection(qinfo.absoluteFilePath())) {
std::cerr << "RetroShareLink::process(): can't open RS file collection " << path << std::endl;
}
}
else {
QString question = "<html><body>";
question += QObject::tr("Warning: Retroshare is about to ask your system to open this file. ");
question += QObject::tr("Before you do so, please make sure that this file does not contain malicious executable code.");
question += "<br><br>" + cleanname + "</body></html>";
QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No, links.size()>1 ? QMessageBox::NoToAll : 0, nullptr);
int ret = mb.exec();
if(ret == QMessageBox::Yes) {
++countFileOpened;
bFileOpened = true;
/* open file with a suitable application */
if (!RsUrlHandler::openUrl(QUrl::fromLocalFile(qinfo.absoluteFilePath()))) {
std::cerr << "RetroShareLink::process(): can't open file " << path << std::endl;
}
} else if (ret == QMessageBox::NoToAll) {
dontOpenNextFile = true;
}
} else if (ret == QMessageBox::NoToAll) {
dontOpenNextFile = true;
}
needNotifySuccess = false;
}

View file

@ -35,8 +35,9 @@
//
#include <retroshare/rsgxsifacetypes.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rstypes.h>
#include <retroshare/rsmail.h>
#include <retroshare/rschats.h>
#include <QString>
#include <QUrl>

View file

@ -23,7 +23,8 @@
#include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rschats.h>
#include <retroshare/rsinit.h>
#include <util/rsdir.h>
#include <util/qtthreadsutils.h>
@ -259,8 +260,8 @@ void RsGUIEventManager::async_handleIncomingEvent(std::shared_ptr<const RsEvent>
{
for(auto msgid:ev1->mChangedMsgIds)
{
Rs::Msgs::MessageInfo msgInfo;
if(rsMsgs->getMessage(msgid, msgInfo))
Rs::Mail::MessageInfo msgInfo;
if(rsMail->getMessage(msgid, msgInfo))
insertToaster(new ToasterItem(new MessageToaster(msgInfo.from.toStdString(), QString::fromUtf8(msgInfo.title.c_str()), QString::fromUtf8(msgInfo.msg.c_str()))));
}
}

View file

@ -23,7 +23,8 @@
#include <retroshare/rsiface.h>
#include <retroshare/rsturtle.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rschats.h>
#include <QObject>
#include <QMutex>
#include <QPoint>

View file

@ -33,6 +33,8 @@
#include "util/DateTime.h"
#include <retroshare/rswiki.h>
#include "util/qtthreadsutils.h"
// These should be in retroshare/ folder.
#include "retroshare/rsgxsflags.h"
@ -79,60 +81,68 @@
/** Constructor */
WikiDialog::WikiDialog(QWidget *parent) : RsGxsUpdateBroadcastPage(rsWiki, parent)
WikiDialog::WikiDialog(QWidget *parent) :
RsGxsUpdateBroadcastPage(rsWiki, parent),
mEventHandlerId(0) // Initialize handler ID
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
mAddPageDialog = NULL;
mAddGroupDialog = NULL;
mEditDialog = NULL;
mAddPageDialog = NULL;
mAddGroupDialog = NULL;
mEditDialog = NULL;
connect( ui.toolButton_NewPage, SIGNAL(clicked()), this, SLOT(OpenOrShowAddPageDialog()));
connect( ui.toolButton_Edit, SIGNAL(clicked()), this, SLOT(OpenOrShowEditDialog()));
connect( ui.toolButton_Republish, SIGNAL(clicked()), this, SLOT(OpenOrShowRepublishDialog()));
connect( ui.toolButton_NewPage, SIGNAL(clicked()), this, SLOT(OpenOrShowAddPageDialog()));
connect( ui.toolButton_Edit, SIGNAL(clicked()), this, SLOT(OpenOrShowEditDialog()));
connect( ui.toolButton_Republish, SIGNAL(clicked()), this, SLOT(OpenOrShowRepublishDialog()));
// Usurped until Refresh works normally
connect( ui.toolButton_Delete, SIGNAL(clicked()), this, SLOT(insertWikiGroups()));
connect( ui.pushButton, SIGNAL(clicked()), this, SLOT(todo()));
connect( ui.treeWidget_Pages, SIGNAL(itemSelectionChanged()), this, SLOT(groupTreeChanged()));
connect( ui.treeWidget_Pages, SIGNAL(itemSelectionChanged()), this, SLOT(groupTreeChanged()));
// GroupTreeWidget.
connect(ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint)));
connect(ui.groupTreeWidget, SIGNAL(treeItemActivated(QString)), this, SLOT(wikiGroupChanged(QString)));
// GroupTreeWidget.
connect(ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint)));
connect(ui.groupTreeWidget, SIGNAL(treeItemActivated(QString)), this, SLOT(wikiGroupChanged(QString)));
/* setup TokenQueue */
mWikiQueue = new TokenQueue(rsWiki->getTokenService(), this);
/* setup TokenQueue */
mWikiQueue = new TokenQueue(rsWiki->getTokenService(), this);
// Set initial size of the splitter
ui.listSplitter->setStretchFactor(0, 0);
ui.listSplitter->setStretchFactor(1, 1);
// Set initial size of the splitter
ui.listSplitter->setStretchFactor(0, 0);
ui.listSplitter->setStretchFactor(1, 1);
/* Setup Group Tree */
mYourGroups = ui.groupTreeWidget->addCategoryItem(tr("My Groups"), QIcon(), true);
mSubscribedGroups = ui.groupTreeWidget->addCategoryItem(tr("Subscribed Groups"), QIcon(), true);
mPopularGroups = ui.groupTreeWidget->addCategoryItem(tr("Popular Groups"), QIcon(), false);
mOtherGroups = ui.groupTreeWidget->addCategoryItem(tr("Other Groups"), QIcon(), false);
/* Add the New Group button */
QToolButton *newGroupButton = new QToolButton(this);
newGroupButton->setIcon(QIcon(":/icons/png/add.png"));
newGroupButton->setToolTip(tr("Create Group"));
connect(newGroupButton, SIGNAL(clicked()), this, SLOT(OpenOrShowAddGroupDialog()));
ui.groupTreeWidget->addToolButton(newGroupButton);
/* Setup Group Tree */
mYourGroups = ui.groupTreeWidget->addCategoryItem(tr("My Groups"), QIcon(), true);
mSubscribedGroups = ui.groupTreeWidget->addCategoryItem(tr("Subscribed Groups"), QIcon(), true);
mPopularGroups = ui.groupTreeWidget->addCategoryItem(tr("Popular Groups"), QIcon(), false);
mOtherGroups = ui.groupTreeWidget->addCategoryItem(tr("Other Groups"), QIcon(), false);
/* Add the New Group button */
QToolButton *newGroupButton = new QToolButton(this);
newGroupButton->setIcon(QIcon(":/icons/png/add.png"));
newGroupButton->setToolTip(tr("Create Group"));
connect(newGroupButton, SIGNAL(clicked()), this, SLOT(OpenOrShowAddGroupDialog()));
ui.groupTreeWidget->addToolButton(newGroupButton);
// load settings
processSettings(true);
updateDisplay(true);
//QTimer *timer = new QTimer(this);
//timer->connect(timer, SIGNAL(timeout()), this, SLOT(insertWikiGroups()));
//timer->start(5000);
/* Get dynamic event type ID for Wiki. This avoids hardcoding IDs in rsevents.h */
RsEventType wikiEventType = (RsEventType)rsEvents->getDynamicEventType("GXS_WIKI");
// load settings
processSettings(true);
updateDisplay(true);
/* Register events handler using the dynamic type */
rsEvents->registerEventsHandler(
[this](std::shared_ptr<const RsEvent> event) {
RsQThreadUtils::postToObject([=]() {
handleEvent_main_thread(event);
}, this );
},
mEventHandlerId, wikiEventType);
}
WikiDialog::~WikiDialog()
{
rsEvents->unregisterEventsHandler(mEventHandlerId);
// save settings
processSettings(false);
@ -158,6 +168,7 @@ void WikiDialog::processSettings(bool load)
Settings->endGroup();
}
void WikiDialog::OpenOrShowAddPageDialog()
{
RsGxsGroupId groupId = getSelectedGroup();
@ -722,13 +733,6 @@ void WikiDialog::GroupMetaDataToGroupItemInfo(const RsGroupMetaData &groupInfo,
groupItemInfo.icon = QIcon(IMAGE_WIKI);
}
void WikiDialog::todo()
{
QMessageBox::information(this, "Todo",
"<b>Open points:</b><ul>"
"<li>Auto update Group trees"
"</ul>");
}
void WikiDialog::updateDisplay(bool complete)
{
@ -751,3 +755,26 @@ void WikiDialog::insertWikiGroups()
{
updateDisplay(true);
}
void WikiDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
{
// Cast to the specific Wiki event
const RsGxsWikiEvent *e = dynamic_cast<const RsGxsWikiEvent*>(event.get());
if(e) {
std::cerr << "WikiDialog: Received event for group " << e->mWikiGroupId.toStdString() << std::endl;
switch(e->mWikiEventCode) {
case RsWikiEventCode::UPDATED_COLLECTION:
updateDisplay(true); // Refresh global list
break;
case RsWikiEventCode::UPDATED_SNAPSHOT:
// Only refresh if we are currently looking at the changed group
if (e->mWikiGroupId == mGroupId) {
wikiGroupChanged(QString::fromStdString(mGroupId.toStdString()));
}
break;
}
}
}

View file

@ -36,6 +36,7 @@
class WikiAddDialog;
class WikiEditDialog;
class UserNotify;
class WikiDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
{
@ -54,6 +55,8 @@ public:
public:
virtual void updateDisplay(bool complete);
private slots:
void OpenOrShowAddPageDialog();
@ -73,7 +76,6 @@ private slots:
void unsubscribeToGroup();
void wikiGroupChanged(const QString &groupId);
void todo();
void insertWikiGroups();
private:
@ -87,6 +89,9 @@ private:
std::string getSelectedPage();
const RsGxsGroupId &getSelectedGroup();
uint32_t mEventHandlerId;
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
// Using GroupTreeWidget.
void wikiSubscribe(bool subscribe);
void GroupMetaDataToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);

View file

@ -46,7 +46,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>241</width>
<width>240</width>
<height>510</height>
</rect>
</property>
@ -286,39 +286,6 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_Delete">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Refresh</string>
</property>
<property name="icon">
<iconset resource="Wiki_images.qrc">
<normaloff>:/images/reload.png</normaloff>:/images/reload.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Todo</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -348,7 +315,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>510</width>
<width>511</width>
<height>480</height>
</rect>
</property>

View file

@ -196,14 +196,14 @@ void ChatDialog::init(const ChatId &id, const QString &title)
uint32_t distant_peer_status ;
if(rsMsgs->getDistantChatStatus(RsGxsId(peerId),distant_peer_status))
if(rsChats->getDistantChatStatus(RsGxsId(peerId),distant_peer_status))
{
getChat(peerId, forceFocus ? RS_CHAT_OPEN | RS_CHAT_FOCUS : RS_CHAT_OPEN ); // use own flags
return ;
}
ChatLobbyId lid;
if (rsMsgs->isLobbyId(peerId, lid)) {
if (rsChats->isLobbyId(peerId, lid)) {
getChat(peerId, (forceFocus ? (RS_CHAT_OPEN | RS_CHAT_FOCUS) : RS_CHAT_OPEN));
}

View file

@ -26,7 +26,7 @@
#include "retroshare/rsstatus.h"
#include <QWidget>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include "gui/chat/ChatWidget.h"

View file

@ -165,11 +165,11 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
getChatWidget()->addTitleBarWidget(inviteFriendsButton) ;
RsGxsId current_id;
rsMsgs->getIdentityForChatLobby(lobbyId, current_id);
rsChats->getIdentityForChatLobby(lobbyId, current_id);
uint32_t idChooserFlag = IDCHOOSER_ID_REQUIRED;
ChatLobbyInfo lobbyInfo ;
if(rsMsgs->getChatLobbyInfo(lobbyId,lobbyInfo)) {
if(rsChats->getChatLobbyInfo(lobbyId,lobbyInfo)) {
if (lobbyInfo.lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED) {
idChooserFlag |= IDCHOOSER_NON_ANONYMOUS;
}
@ -236,7 +236,7 @@ void ChatLobbyDialog::inviteFriends()
{
std::cerr << " " << *it << std::endl;
rsMsgs->invitePeerToLobby(mChatId.toLobbyId(),*it) ;
rsChats->invitePeerToLobby(mChatId.toLobbyId(),*it) ;
}
}
@ -388,7 +388,7 @@ void ChatLobbyDialog::init(const ChatId &/*id*/, const QString &/*title*/)
QString title;
if(rsMsgs->getChatLobbyInfo(lobbyId,linfo))
if(rsChats->getChatLobbyInfo(lobbyId,linfo))
{
title = QString::fromUtf8(linfo.lobby_name.c_str());
@ -403,7 +403,7 @@ void ChatLobbyDialog::init(const ChatId &/*id*/, const QString &/*title*/)
ChatDialog::init(ChatId(lobbyId), title);
RsGxsId gxs_id;
rsMsgs->getIdentityForChatLobby(lobbyId, gxs_id);
rsChats->getIdentityForChatLobby(lobbyId, gxs_id);
RsIdentityDetails details ;
@ -443,7 +443,7 @@ ChatLobbyDialog::~ChatLobbyDialog()
// check that the lobby still exists.
// announce leaving of lobby
if (mChatId.isLobbyId())
rsMsgs->sendLobbyStatusPeerLeaving(mChatId.toLobbyId());
rsChats->sendLobbyStatusPeerLeaving(mChatId.toLobbyId());
// save settings
processSettings(false);
@ -494,12 +494,12 @@ void ChatLobbyDialog::processSettings(bool load)
*/
void ChatLobbyDialog::setIdentity(const RsGxsId& gxs_id)
{
rsMsgs->setIdentityForChatLobby(lobbyId, gxs_id) ;
rsChats->setIdentityForChatLobby(lobbyId, gxs_id) ;
// get new nick name
RsGxsId newid;
if (rsMsgs->getIdentityForChatLobby(lobbyId, newid))
if (rsChats->getIdentityForChatLobby(lobbyId, newid))
{
RsIdentityDetails details ;
rsIdentity->getIdDetails(gxs_id,details) ;
@ -514,7 +514,7 @@ void ChatLobbyDialog::setIdentity(const RsGxsId& gxs_id)
void ChatLobbyDialog::changeNickname()
{
RsGxsId current_id;
rsMsgs->getIdentityForChatLobby(lobbyId, current_id);
rsChats->getIdentityForChatLobby(lobbyId, current_id);
RsGxsId new_id ;
ownIdChooser->getChosenId(new_id) ;
@ -583,7 +583,7 @@ void ChatLobbyDialog::updateParticipantsList()
{
ChatLobbyInfo linfo;
if(rsMsgs->getChatLobbyInfo(lobbyId,linfo))
if(rsChats->getChatLobbyInfo(lobbyId,linfo))
{
ChatLobbyInfo cliInfo=linfo;
QList<QTreeWidgetItem*> qlOldParticipants=ui.participantsList->findItems("*",Qt::MatchWildcard,COLUMN_ID);
@ -643,7 +643,7 @@ void ChatLobbyDialog::updateParticipantsList()
widgetitem->setIcon(COLUMN_ICON, bullet_green_128);
RsGxsId gxs_id;
rsMsgs->getIdentityForChatLobby(lobbyId, gxs_id);
rsChats->getIdentityForChatLobby(lobbyId, gxs_id);
if (RsGxsId(participant.toStdString()) == gxs_id) widgetitem->setIcon(COLUMN_ICON, bullet_blue_128);
@ -739,12 +739,12 @@ void ChatLobbyDialog::distantChatParticipant()
return;
RsGxsId own_id;
rsMsgs->getIdentityForChatLobby(lobbyId, own_id);
rsChats->getIdentityForChatLobby(lobbyId, own_id);
DistantChatPeerId tunnel_id;
uint32_t error_code ;
if(! rsMsgs->initiateDistantChatConnexion(gxs_id,own_id,tunnel_id,error_code))
if(! rsChats->initiateDistantChatConnexion(gxs_id,own_id,tunnel_id,error_code))
{
QString error_str ;
switch(error_code)
@ -791,7 +791,7 @@ void ChatLobbyDialog::muteParticipant(const RsGxsId& nickname)
std::cerr << " Mute " << std::endl;
RsGxsId gxs_id;
rsMsgs->getIdentityForChatLobby(lobbyId, gxs_id);
rsChats->getIdentityForChatLobby(lobbyId, gxs_id);
if (gxs_id!=nickname)
mutedParticipants.insert(nickname);
@ -810,7 +810,7 @@ bool ChatLobbyDialog::isNicknameInLobby(const RsGxsId& nickname)
{
ChatLobbyInfo clinfo;
if(! rsMsgs->getChatLobbyInfo(lobbyId,clinfo))
if(! rsChats->getChatLobbyInfo(lobbyId,clinfo))
return false ;
return clinfo.gxs_ids.find(nickname) != clinfo.gxs_ids.end() ;
@ -917,7 +917,7 @@ bool ChatLobbyDialog::canClose()
// check that the lobby still exists.
/* TODO
ChatLobbyId lid;
if (!rsMsgs->isLobbyId(getPeerId(), lid)) {
if (!rsChats->isLobbyId(getPeerId(), lid)) {
return true;
}
*/

View file

@ -147,7 +147,7 @@ void ChatLobbyUserNotify::iconClicked()
{
#if defined(Q_OS_DARWIN)
std::list<ChatLobbyId> lobbies;
rsMsgs->getChatLobbyList(lobbies);
rsChats->getChatLobbyList(lobbies);
bool doUpdate=false;
for (lobby_map::iterator itCL=_listMsg.begin(); itCL!=_listMsg.end();)
@ -160,7 +160,7 @@ void ChatLobbyUserNotify::iconClicked()
ChatLobbyId clId = *lobbyIt;
if (clId==itCL->first) {
ChatLobbyInfo clInfo;
if (rsMsgs->getChatLobbyInfo(clId,clInfo))
if (rsChats->getChatLobbyInfo(clId,clInfo))
strLobbyName=QString::fromUtf8(clInfo.lobby_name.c_str()) ;
bFound=true;
break;
@ -188,7 +188,7 @@ void ChatLobbyUserNotify::iconClicked()
/// Tray icon Menu ///
QMenu* trayMenu = createMenu();
std::list<ChatLobbyId> lobbies;
rsMsgs->getChatLobbyList(lobbies);
rsChats->getChatLobbyList(lobbies);
bool doUpdate=false;
for (lobby_map::iterator itCL=_listMsg.begin(); itCL!=_listMsg.end();)
@ -202,7 +202,7 @@ void ChatLobbyUserNotify::iconClicked()
ChatLobbyId clId = *lobbyIt;
if (clId==itCL->first) {
ChatLobbyInfo clInfo;
if (rsMsgs->getChatLobbyInfo(clId,clInfo))
if (rsChats->getChatLobbyInfo(clId,clInfo))
strLobbyName=QString::fromUtf8(clInfo.lobby_name.c_str()) ;
icoLobby=(clInfo.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC) ? FilesDefs::getIconFromQtResourcePath(":/images/chat_red24.png") : FilesDefs::getIconFromQtResourcePath(":/images/chat_x24.png");
bFound=true;
@ -289,7 +289,7 @@ void ChatLobbyUserNotify::chatLobbyNewMessage(ChatLobbyId lobby_id, QDateTime ti
bool bGetNickName = false;
if (_bCheckForNickName) {
RsGxsId gxs_id;
rsMsgs->getIdentityForChatLobby(lobby_id,gxs_id);
rsChats->getIdentityForChatLobby(lobby_id,gxs_id);
RsIdentityDetails details ;
rsIdentity->getIdDetails(gxs_id,details) ;
bGetNickName = checkWord(msg, QString::fromUtf8(details.mNickname.c_str()));
@ -303,7 +303,7 @@ void ChatLobbyUserNotify::chatLobbyNewMessage(ChatLobbyId lobby_id, QDateTime ti
}
if ((bGetNickName || bFoundTextToNotify || _bCountUnRead)){
QString strAnchor = time.toString(Qt::ISODate);
QString strAnchor = DateTime::formatDateTime(time);
MsgData msgData;
msgData.text=RsHtml::plainText(senderName) + ": " + msg;
msgData.unread=!(bGetNickName || bFoundTextToNotify);

View file

@ -24,7 +24,7 @@
#define CHATLOBBYUSERNOTIFY_H
#include "gui/common/UserNotify.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <QDateTime>
#include <QMetaType>

View file

@ -28,7 +28,7 @@
#include "util/qtthreadsutils.h"
#include <algorithm>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
static std::map<ChatId, int> waitingChats;
static ChatUserNotify* instance = 0;

View file

@ -23,7 +23,7 @@
#ifndef CHATUSERNOTIFY_H
#define CHATUSERNOTIFY_H
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include "gui/common/UserNotify.h"
// this class uses lots of global state

View file

@ -46,7 +46,7 @@
#include <retroshare/rsidentity.h>
#include <retroshare/rspeers.h>
#include <retroshare/rshistory.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <retroshare/rsplugin.h>
#include <QApplication>
@ -398,7 +398,7 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
updateStatus(chatId, peerStatusInfo.status);
// initialize first custom state string
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(chatId.toPeerId()).c_str());
QString customStateString = QString::fromUtf8(rsChats->getCustomStateString(chatId.toPeerId()).c_str());
updatePeersCustomStateString(chatId, customStateString);
} else if (chatType() == CHATTYPE_DISTANT){
hist_chat_type = RS_HISTORY_TYPE_DISTANT ;
@ -517,13 +517,13 @@ uint32_t ChatWidget::maxMessageSize()
case CHATTYPE_UNKNOWN:
break;
case CHATTYPE_PRIVATE:
maxMessageSize = rsMsgs->getMaxMessageSecuritySize(RS_CHAT_TYPE_PRIVATE);
maxMessageSize = rsChats->getMaxMessageSecuritySize(RS_CHAT_TYPE_PRIVATE);
break;
case CHATTYPE_LOBBY:
maxMessageSize = rsMsgs->getMaxMessageSecuritySize(RS_CHAT_TYPE_LOBBY);
maxMessageSize = rsChats->getMaxMessageSecuritySize(RS_CHAT_TYPE_LOBBY);
break;
case CHATTYPE_DISTANT:
maxMessageSize = rsMsgs->getMaxMessageSecuritySize(RS_CHAT_TYPE_DISTANT);
maxMessageSize = rsChats->getMaxMessageSecuritySize(RS_CHAT_TYPE_DISTANT);
break;
}
return maxMessageSize;
@ -810,7 +810,7 @@ void ChatWidget::completeNickname(bool reverse)
// Find lobby we belong to
ChatLobbyInfo lobby;
if (! rsMsgs->getChatLobbyInfo(chatId.toLobbyId(),lobby))
if (! rsChats->getChatLobbyInfo(chatId.toLobbyId(),lobby))
return;
QTextCursor cursor = ui->chatTextEdit->textCursor();
@ -905,7 +905,7 @@ QAbstractItemModel *ChatWidget::modelFromPeers()
// Find lobby we belong to
ChatLobbyInfo lobby ;
if(! rsMsgs->getChatLobbyInfo(chatId.toLobbyId(),lobby))
if(! rsChats->getChatLobbyInfo(chatId.toLobbyId(),lobby))
return new QStringListModel(completer);
#ifndef QT_NO_CURSOR
@ -1102,7 +1102,7 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx
QString formattedMessage = RsHtml().formatText(ui->textBrowser->document(), message, formatTextFlag, backgroundColor, desiredContrast, desiredMinimumFontSize);
QDateTime dtTimestamp=incoming ? sendTime : recvTime;
QString formatMsg = chatStyle.formatMessage(type, name, dtTimestamp, formattedMessage, formatFlag, backgroundColor);
QString timeStamp = dtTimestamp.toString(Qt::ISODate);
QString timeStamp = DateTime::formatDateTime(dtTimestamp);
//replace Date and Time anchors
formatMsg.replace(QString("<a name=\"date\">"),QString("<a name=\"%1\">").arg(timeStamp));
@ -1256,7 +1256,7 @@ void ChatWidget::updateStatusTyping()
#ifdef ONLY_FOR_LINGUIST
tr("is typing...");
#endif
rsMsgs->sendStatusString(chatId, "is typing...");
rsChats->sendStatusString(chatId, "is typing...");
lastStatusSendTime = time(NULL) ;
}
}
@ -1322,7 +1322,7 @@ void ChatWidget::sendChat()
#ifdef CHAT_DEBUG
std::cout << "ChatWidget:sendChat " << std::endl;
#endif
rsMsgs->sendChat(chatId, msg);
rsChats->sendChat(chatId, msg);
chatWidget->clear();
// workaround for Qt bug - http://bugreports.qt.nokia.com/browse/QTBUG-2533
@ -1673,7 +1673,7 @@ void ChatWidget::sendSticker()
if (RsHtml::makeEmbeddedImage(sticker, encodedImage, 640*480, maxMessageSize() - 200)) { //-200 for the html stuff
RsHtml::optimizeHtml(encodedImage, 0);
std::string msg = encodedImage.toUtf8().constData();
rsMsgs->sendChat(chatId, msg);
rsChats->sendChat(chatId, msg);
}
}
@ -1685,7 +1685,7 @@ void ChatWidget::clearChatHistory()
if (chatType() == CHATTYPE_LOBBY) {
if (notify) notify->chatLobbyCleared(chatId.toLobbyId(),"");
}
rsMsgs->clearChatLobby(chatId);
rsChats->clearChatLobby(chatId);
}
void ChatWidget::deleteChatHistory()
@ -1847,7 +1847,7 @@ void ChatWidget::updateStatus(const ChatId& cid, RsStatusValue status)
DistantChatPeerInfo dcpinfo ;
RsIdentityDetails details ;
if(rsMsgs->getDistantChatStatus(chatId.toDistantChatId(),dcpinfo))
if(rsChats->getDistantChatStatus(chatId.toDistantChatId(),dcpinfo))
{
if(rsIdentity->getIdDetails(dcpinfo.to_id,details))
peerName = QString::fromUtf8( details.mNickname.c_str() ) ;

View file

@ -29,7 +29,7 @@
#include "gui/common/RsButtonOnText.h"
#include "gui/style/RSStyle.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rsstatus.h>

View file

@ -26,7 +26,7 @@
#include <QPushButton>
#include <algorithm>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <retroshare/rspeers.h>
#include <retroshare/rstypes.h>
@ -45,7 +45,7 @@ CreateLobbyDialog::CreateLobbyDialog(const std::set<RsPeerId>& peer_list, int pr
ui->headerFrame->setHeaderText(tr("Create Chat Room"));
RsGxsId default_identity ;
rsMsgs->getDefaultIdentityForChatLobby(default_identity) ;
rsChats->getDefaultIdentityForChatLobby(default_identity) ;
ui->idChooser_CB->loadIds(IDCHOOSER_ID_REQUIRED, default_identity);
@ -149,7 +149,7 @@ void CreateLobbyDialog::createLobby()
if(ui->pgp_signed_CB->isChecked())
lobby_flags |= RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ;
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name,gxs_id, lobby_topic, shareList, lobby_flags);
ChatLobbyId id = rsChats->createChatLobby(lobby_name,gxs_id, lobby_topic, shareList, lobby_flags);
std::cerr << "gui: Created chat room " << std::hex << id << std::dec << std::endl ;

View file

@ -183,7 +183,7 @@ void PopupChatDialog::clearOfflineMessages()
manualDelete = true;
// TODO
#ifdef REMOVE
rsMsgs->clearPrivateChatQueue(false, peerId);
rsChats->clearPrivateChatQueue(false, peerId);
#endif
manualDelete = false;
}

View file

@ -26,7 +26,7 @@
#include "ui_PopupChatDialog.h"
#include "ChatDialog.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
class PopupChatDialog : public ChatDialog
{

View file

@ -38,7 +38,7 @@
#include "rshare.h"
#include <retroshare/rsidentity.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#define IMAGE_TYPING ":/images/white-bubble-64.png"
@ -134,7 +134,7 @@ void PopupChatWindow::showContextMenu(QPoint)
if (ch_id.isDistantChatId()) {
DistantChatPeerId dc_id = ch_id.toDistantChatId();
DistantChatPeerInfo dc_info;
if(rsMsgs->getDistantChatStatus(dc_id, dc_info)) {
if(rsChats->getDistantChatStatus(dc_id, dc_info)) {
RsGxsId gxs_id = dc_info.to_id;
if(!gxs_id.isNull() && !rsIdentity->isOwnId(gxs_id)) {
contextMnu.addAction(votePositive);
@ -384,7 +384,7 @@ void PopupChatWindow::getAvatar()
if (misc::getOpenAvatarPicture(this, ba)) {
std::cerr << "Avatar image size = " << ba.size() << std::endl ;
rsMsgs->setOwnAvatarData((unsigned char *)(ba.data()), ba.size()); // last char 0 included.
rsChats->setOwnNodeAvatarData((unsigned char *)(ba.data()), ba.size()); // last char 0 included.
}
}

View file

@ -26,7 +26,7 @@
#include <QTimer>
#include "ui_PopupChatWindow.h"
#include <retroshare/rstypes.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include "gui/chat/ChatWidget.h"

View file

@ -72,7 +72,7 @@ void PopupDistantChatDialog::init(const ChatId &chat_id, const QString &/*title*
_tunnel_id = chat_id.toDistantChatId();
DistantChatPeerInfo tinfo;
if(!rsMsgs->getDistantChatStatus(_tunnel_id,tinfo))
if(!rsChats->getDistantChatStatus(_tunnel_id,tinfo))
return ;
RsIdentityDetails iddetails ;
@ -160,7 +160,7 @@ void PopupDistantChatDialog::handleEvent_main_thread(std::shared_ptr<const RsEve
{
DistantChatPeerInfo tinfo;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
rsChats->getDistantChatStatus(_tunnel_id,tinfo) ;
if(tinfo.pending_items > 0)
msg += QObject::tr("(some undelivered messages)") ; // we cannot use the pending_items count because it accounts for ACKS and keep alive packets as well.
@ -190,14 +190,14 @@ void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
{
DistantChatPeerInfo tinfo ;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
rsChats->getDistantChatStatus(_tunnel_id,tinfo) ;
if(tinfo.status != RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED)
{
QString msg = tr("Closing this window will end the conversation. Unsent messages will be dropped.") ;
if(QMessageBox::Ok == QMessageBox::critical(NULL,tr("Close conversation?"),msg, QMessageBox::Ok | QMessageBox::Cancel))
rsMsgs->closeDistantChatConnexion(_tunnel_id) ;
rsChats->closeDistantChatConnexion(_tunnel_id) ;
else
{
e->ignore() ;
@ -214,7 +214,7 @@ QString PopupDistantChatDialog::getPeerName(const ChatId& /*id*/, QString& addit
{
DistantChatPeerInfo tinfo;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
rsChats->getDistantChatStatus(_tunnel_id,tinfo) ;
additional_info = QString("Identity ID: ") + QString::fromStdString(tinfo.to_id.toStdString());
@ -229,7 +229,7 @@ QString PopupDistantChatDialog::getOwnName() const
{
DistantChatPeerInfo tinfo;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
rsChats->getDistantChatStatus(_tunnel_id,tinfo) ;
RsIdentityDetails details ;
if(rsIdentity->getIdDetails(tinfo.own_id,details))

View file

@ -20,7 +20,7 @@
#include <QPixmap>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h>
#include <gui/gxs/GxsIdDetails.h>
@ -34,7 +34,7 @@ void AvatarDefs::getOwnAvatar(QPixmap &avatar, const QString& defaultImage)
int size = 0;
/* get avatar */
rsMsgs->getOwnAvatarData(data, size);
rsChats->getOwnNodeAvatarData(data, size);
if (size == 0) {
avatar = FilesDefs::getPixmapFromQtResourcePath(defaultImage);
@ -52,7 +52,7 @@ bool AvatarDefs::getAvatarFromSslId(const RsPeerId& sslId, QPixmap &avatar, cons
int size = 0;
/* get avatar */
rsMsgs->getAvatarData(RsPeerId(sslId), data, size);
rsChats->getAvatarData(RsPeerId(sslId), data, size);
if (size == 0) {
if (!defaultImage.isEmpty()) {
avatar = FilesDefs::getPixmapFromQtResourcePath(defaultImage);
@ -94,14 +94,14 @@ bool AvatarDefs::getAvatarFromGpgId(const RsPgpId& gpgId, QPixmap &avatar, const
if (gpgId == rsPeers->getGPGOwnId()) {
/* Its me */
rsMsgs->getOwnAvatarData(data,size);
rsChats->getOwnNodeAvatarData(data,size);
} else {
/* get the first available avatar of one of the ssl ids */
std::list<RsPeerId> sslIds;
if (rsPeers->getAssociatedSSLIds(gpgId, sslIds)) {
std::list<RsPeerId>::iterator sslId;
for (sslId = sslIds.begin(); sslId != sslIds.end(); ++sslId) {
rsMsgs->getAvatarData(*sslId, data, size);
rsChats->getAvatarData(*sslId, data, size);
if (size) {
break;
}

View file

@ -23,7 +23,7 @@
#include <rshare.h>
#include <retroshare/rsstatus.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include "util/misc.h"
#include "util/qtthreadsutils.h"
@ -124,7 +124,7 @@ void AvatarWidget::mouseReleaseEvent(QMouseEvent */*event*/)
QByteArray newAvatar;
dialog.getAvatar(newAvatar);
rsMsgs->setOwnAvatarData((unsigned char *)(newAvatar.data()), newAvatar.size()) ; // last char 0 included.
rsChats->setOwnNodeAvatarData((unsigned char *)(newAvatar.data()), newAvatar.size()) ; // last char 0 included.
}
}
@ -226,7 +226,7 @@ void AvatarWidget::refreshStatus()
{
DistantChatPeerInfo dcpinfo ;
if(rsMsgs->getDistantChatStatus(mId.toDistantChatId(),dcpinfo))
if(rsChats->getDistantChatStatus(mId.toDistantChatId(),dcpinfo))
{
switch (dcpinfo.status)
{
@ -321,7 +321,7 @@ void AvatarWidget::refreshAvatarImage()
DistantChatPeerInfo dcpinfo ;
if(rsMsgs->getDistantChatStatus(mId.toDistantChatId(),dcpinfo))
if(rsChats->getDistantChatStatus(mId.toDistantChatId(),dcpinfo))
{
if(mFlag.isOwnId)
AvatarDefs::getAvatarFromGxsId(dcpinfo.own_id, avatar, defaultAvatar);

View file

@ -25,7 +25,7 @@
#include <stdint.h>
#include <retroshare/rstypes.h>
#include <retroshare/rsevents.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <retroshare/rsstatus.h>
namespace Ui {

View file

@ -937,7 +937,7 @@ void FriendList::insertPeers()
/* last contact */
QDateTime sslLastContact = DateTime::DateTimeFromTime_t(sslDetail.lastConnect);
sslItem->setData(COLUMN_LAST_CONTACT, Qt::DisplayRole, QVariant(sslLastContact));
sslItem->setData(COLUMN_LAST_CONTACT, Qt::DisplayRole, DateTime::formatDateTime(sslDetail.lastConnect));
sslItem->setData(COLUMN_LAST_CONTACT, ROLE_SORT_NAME, QVariant(sslLastContact));
if (sslLastContact > bestLastContact) {
bestLastContact = sslLastContact;
@ -1215,7 +1215,7 @@ void FriendList::insertPeers()
// Filter
gpgItem->setData(COLUMN_NAME, ROLE_FILTER, gpgName);
gpgItem->setData(COLUMN_LAST_CONTACT, Qt::DisplayRole, showInfoAtGpgItem ? QVariant(bestLastContact) : "");
gpgItem->setData(COLUMN_LAST_CONTACT, Qt::DisplayRole, showInfoAtGpgItem ? DateTime::formatDateTime(bestLastContact) : "");
gpgItem->setData(COLUMN_LAST_CONTACT, ROLE_SORT_NAME, QVariant(bestLastContact));
gpgItem->setText(COLUMN_IP, showInfoAtGpgItem ? bestIP : "");
gpgItem->setData(COLUMN_IP, ROLE_SORT_NAME, bestIP);

View file

@ -35,7 +35,7 @@
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/GxsIdTreeWidgetItem.h"
#include "retroshare/rsexpr.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rschats.h"
//#define DEBUG_MODEL
//#define DEBUG_MODEL_INDEX
@ -726,30 +726,33 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
case COLUMN_THREAD_IP:
case COLUMN_THREAD_LAST_CONTACT:
{
if(!isProfileExpanded(e))
// BUG FIX: Removed 'if(!isProfileExpanded(e))' to keep the last contact and IP
// visible even when the profile is expanded (e.g. during search filtering).
const HierarchicalProfileInformation *hn = getProfileInfo(e);
if(!hn) return QVariant();
QDateTime most_recent_time = DateTime::DateTimeFromTime_t(0);
QString most_recent_ip("---");
// We aggregate the most recent contact info from all child nodes/locations
for(uint32_t i=0;i<hn->child_node_indices.size();++i)
{
const HierarchicalProfileInformation *hn = getProfileInfo(e);
const HierarchicalNodeInformation& node = mLocations[hn->child_node_indices[i]];
auto node_time = DateTime::DateTimeFromTime_t(node.node_info.lastConnect);
QDateTime most_recent_time = DateTime::DateTimeFromTime_t(0);
QString most_recent_ip("---");
for(uint32_t i=0;i<hn->child_node_indices.size();++i)
if(most_recent_time < node_time)
{
const HierarchicalNodeInformation& node = mLocations[hn->child_node_indices[i]];
auto node_time = DateTime::DateTimeFromTime_t(node.node_info.lastConnect);
if(most_recent_time < node_time)
{
most_recent_time = node_time;
most_recent_ip = (node.node_info.state & RS_PEER_STATE_CONNECTED) ? StatusDefs::connectStateIpString(node.node_info) : QString("---");
}
most_recent_time = node_time;
most_recent_ip = (node.node_info.state & RS_PEER_STATE_CONNECTED) ? StatusDefs::connectStateIpString(node.node_info) : QString("---");
}
if(col == COLUMN_THREAD_LAST_CONTACT) return QVariant(most_recent_time);
if(col == COLUMN_THREAD_IP) return QVariant(most_recent_ip);
}
}// Fall-through
if(col == COLUMN_THREAD_LAST_CONTACT) return QVariant((qulonglong)most_recent_time.toTime_t());
if(col == COLUMN_THREAD_IP) return QVariant(most_recent_ip);
return QVariant();
}
default:
return QVariant();
}
@ -772,7 +775,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
return QVariant(QString::fromStdString(node->node_info.id.toStdString()));
{
std::string css = rsMsgs->getCustomStateString(node->node_info.id);
std::string css = rsChats->getCustomStateString(node->node_info.id);
if (mDisplayStatusString)
if(!css.empty())
@ -787,7 +790,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
return QVariant(QString::fromUtf8(node->node_info.location.c_str()));
}
case COLUMN_THREAD_LAST_CONTACT: return QVariant(DateTime::DateTimeFromTime_t(node->node_info.lastConnect).toString());
case COLUMN_THREAD_LAST_CONTACT: return QVariant((qulonglong)node->node_info.lastConnect);
case COLUMN_THREAD_IP: return QVariant( (node->node_info.state & RS_PEER_STATE_CONNECTED) ? StatusDefs::connectStateIpString(node->node_info) : QString("---"));
case COLUMN_THREAD_ID: return QVariant( QString::fromStdString(node->node_info.id.toStdString()) );
@ -994,49 +997,47 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
}
case ENTRY_TYPE_PROFILE:
{
if(!isProfileExpanded(entry))
{
QPixmap sslAvatar;
bool foundAvatar = false;
const HierarchicalProfileInformation *hn = getProfileInfo(entry);
RsStatusValue status = RsStatusValue::RS_STATUS_OFFLINE;
const HierarchicalNodeInformation *bestNodeInformation = NULL;
// BUG FIX: Removed 'if(!isProfileExpanded(entry))' to keep the icon visible
// even when the profile is expanded (e.g. during search filtering).
QPixmap sslAvatar;
bool foundAvatar = false;
const HierarchicalProfileInformation *hn = getProfileInfo(entry);
RsStatusValue status = RsStatusValue::RS_STATUS_OFFLINE;
const HierarchicalNodeInformation *bestNodeInformation = NULL;
if (mDisplayStatusIcon) {
bestNodeInformation = getBestNodeInformation(hn, &status);
if (bestNodeInformation) {
if (AvatarDefs::getAvatarFromSslId(RsPeerId(bestNodeInformation->node_info.id.toStdString()), sslAvatar, "")) {
/* Use avatar from best node */
foundAvatar = true;
}
}
}
if (mDisplayStatusIcon) {
bestNodeInformation = getBestNodeInformation(hn, &status);
if (bestNodeInformation) {
if (AvatarDefs::getAvatarFromSslId(RsPeerId(bestNodeInformation->node_info.id.toStdString()), sslAvatar, "")) {
/* Use avatar from best node */
foundAvatar = true;
}
}
}
if (!foundAvatar) {
/* Use first available avatar */
for(uint32_t i=0;i<hn->child_node_indices.size();++i) {
if(AvatarDefs::getAvatarFromSslId(RsPeerId(mLocations[hn->child_node_indices[i]].node_info.id.toStdString()), sslAvatar, "")) {
foundAvatar = true;
break;
}
}
}
if (!foundAvatar) {
/* Use first available avatar */
for(uint32_t i=0;i<hn->child_node_indices.size();++i) {
if(AvatarDefs::getAvatarFromSslId(RsPeerId(mLocations[hn->child_node_indices[i]].node_info.id.toStdString()), sslAvatar, "")) {
foundAvatar = true;
break;
}
}
}
if (!foundAvatar || sslAvatar.isNull()) {
sslAvatar = FilesDefs::getPixmapFromQtResourcePath(AVATAR_DEFAULT_IMAGE);
}
if (!foundAvatar || sslAvatar.isNull()) {
sslAvatar = FilesDefs::getPixmapFromQtResourcePath(AVATAR_DEFAULT_IMAGE);
}
if (mDisplayStatusIcon) {
if (bestNodeInformation) {
QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(status));
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
}
}
if (mDisplayStatusIcon) {
if (bestNodeInformation) {
QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(status));
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
}
}
return QVariant(QIcon(sslAvatar));
}
return QVariant();
return QVariant(QIcon(sslAvatar));
}
case ENTRY_TYPE_NODE:

View file

@ -24,7 +24,8 @@
#include <QColor>
#include "retroshare/rsstatus.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rschats.h"
#include "retroshare/rsmail.h"
#include "retroshare/rspeers.h"
typedef uint32_t ForumModelIndex;

View file

@ -434,7 +434,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
}
else
{
item->setText(GTW_COLUMN_LAST_POST, itemInfo.lastpost.toString(Qt::ISODate).replace("T"," "));
item->setText(GTW_COLUMN_LAST_POST, DateTime::formatDateTime(itemInfo.lastpost));
item->setData(GTW_COLUMN_LAST_POST, ROLE_SORT, (qint64) DateTime::DateTimeToTime_t(itemInfo.lastpost));
}
@ -464,7 +464,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
if(itemInfo.lastpost == DateTime::DateTimeFromTime_t(0))
tooltip += "\n" + tr("Last Post") + ": " + tr("Never") ;
else
tooltip += "\n" + tr("Last Post") + ": " + DateTime::formatLongDateTime(itemInfo.lastpost) ;
tooltip += "\n" + tr("Last Post") + ": " + DateTime::formatDateTime(itemInfo.lastpost) ;
if(!IS_GROUP_SUBSCRIBED(itemInfo.subscribeFlags))
tooltip += "\n" + tr("Subscribe to download and read messages") ;

View file

@ -28,6 +28,7 @@
#include "rsserver/rsaccounts.h"
#include "retroshare/rspeers.h"
#include "util/DateTime.h"
#include "GroupDefs.h"
#include "gui/chat/ChatDialog.h"
@ -111,6 +112,33 @@ static std::ostream& operator<<(std::ostream& o,const QModelIndex& i)
}
#endif
/**
* Custom delegate for the Friend List to handle date formatting
* while maintaining elided text capabilities (truncating long text).
*/
class FriendListDelegate : public RSElidedItemDelegate
{
public:
using RSElidedItemDelegate::RSElidedItemDelegate;
/**
* Replaces the raw timestamp with a formatted date string for display.
* This ensures the Model can still sort numerically while the UI shows
* the date according to user preferences.
*/
QString displayText(const QVariant &value, const QLocale &locale) const override
{
// Check if the value is a numerical timestamp (seconds since epoch)
if (value.type() == QVariant::ULongLong || value.type() == QVariant::LongLong) {
// Format the timestamp using our utility class
return DateTime::formatDateTime(value.toULongLong());
}
// Return default elided text for other columns (Name, IP, etc.)
return RSElidedItemDelegate::displayText(value, locale);
}
};
class FriendListSortFilterProxyModel: public QSortFilterProxyModel
{
public:
@ -212,7 +240,8 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
QSortFilterProxyModel_setFilterRegularExpression(mProxyModel, RsFriendListModel::FilterString);
ui->peerTreeWidget->setModel(mProxyModel);
RSElidedItemDelegate *itemDelegate = new RSElidedItemDelegate(this);
FriendListDelegate *itemDelegate = new FriendListDelegate(this);
ui->peerTreeWidget->setItemDelegate(itemDelegate);
itemDelegate->setSpacing(QSize(W/2, H/4));
ui->peerTreeWidget->setItemDelegate(itemDelegate);
ui->peerTreeWidget->setWordWrap(false);
@ -1153,63 +1182,57 @@ void NewFriendList::removeGroup()
void NewFriendList::applyWhileKeepingTree(std::function<void()> predicate)
{
// 1. Store the current vertical scroll position to prevent the list from jumping
int scrollValue = ui->peerTreeWidget->verticalScrollBar()->value();
std::set<QString> expanded_indexes;
QString selected;
// 2. Save the current state of the tree (which groups are open and what is selected)
saveExpandedPathsAndSelection(expanded_indexes, selected);
#ifdef DEBUG_NEW_FRIEND_LIST
std::cerr << "After collecting selection, selected paths is: \"" << selected.toStdString() << "\", " ;
std::cerr << "expanded paths are: " << std::endl;
for(auto path:expanded_indexes)
std::cerr << " \"" << path.toStdString() << "\"" << std::endl;
std::cerr << "Current sort column is: " << mLastSortColumn << " and order is " << mLastSortOrder << std::endl;
#endif
// 3. Clear selection and block signals to avoid UI flicker during updates
whileBlocking(ui->peerTreeWidget)->clearSelection();
// This is a hack to avoid crashes on windows while calling endInsertRows(). I'm not sure wether these crashes are
// due to a Qt bug, or a misuse of the proxy model on my side. Anyway, this solves them for good.
// As a side effect we need to save/restore hidden columns because setSourceModel() resets this setting.
// save hidden columns and sizes
// 4. Save current column visibility and widths
// Detaching the model resets these settings, so we must back them up
std::vector<bool> col_visible(RsFriendListModel::COLUMN_THREAD_NB_COLUMNS);
std::vector<int> col_sizes(RsFriendListModel::COLUMN_THREAD_NB_COLUMNS);
for(int i=0;i<RsFriendListModel::COLUMN_THREAD_NB_COLUMNS;++i)
for(int i=0; i < RsFriendListModel::COLUMN_THREAD_NB_COLUMNS; ++i)
{
col_visible[i] = !ui->peerTreeWidget->isColumnHidden(i);
col_sizes[i] = ui->peerTreeWidget->columnWidth(i);
}
#ifdef DEBUG_NEW_FRIEND_LIST
std::cerr << "Applying predicate..." << std::endl;
#endif
// 5. Detach the model from the view
// This "hack" prevents crashes on some platforms (like Windows) during deep data updates
mProxyModel->setSourceModel(nullptr);
// 6. Execute the actual data update (the predicate)
predicate();
// 7. Reattach the model and restore expanded items/selection
QModelIndex selected_index;
mProxyModel->setSourceModel(mModel);
restoreExpandedPathsAndSelection(expanded_indexes,selected,selected_index);
restoreExpandedPathsAndSelection(expanded_indexes, selected, selected_index);
// restore hidden columns
for(uint32_t i=0;i<RsFriendListModel::COLUMN_THREAD_NB_COLUMNS;++i)
// 8. Restore the previously saved column visibility and widths
for(uint32_t i=0; i < RsFriendListModel::COLUMN_THREAD_NB_COLUMNS; ++i)
{
ui->peerTreeWidget->setColumnHidden(i,!col_visible[i]);
ui->peerTreeWidget->setColumnWidth(i,col_sizes[i]);
ui->peerTreeWidget->setColumnHidden(i, !col_visible[i]);
ui->peerTreeWidget->setColumnWidth(i, col_sizes[i]);
}
// restore sorting
// sortColumn(mLastSortColumn,mLastSortOrder);
#ifdef DEBUG_NEW_FRIEND_LIST
std::cerr << "Sorting again with sort column: " << mLastSortColumn << " and order " << mLastSortOrder << std::endl;
#endif
// 9. Re-apply the current sorting to the list
mProxyModel->setSortingEnabled(true);
mProxyModel->sort(mLastSortColumn,mLastSortOrder);
mProxyModel->sort(mLastSortColumn, mLastSortOrder);
mProxyModel->setSortingEnabled(false);
if(selected_index.isValid())
ui->peerTreeWidget->scrollTo(selected_index);
// 10. CRITICAL FIX: Restore the exact scroll position
// We use setValue() instead of scrollTo() to ensure the view stays exactly where it was,
// even if a friend connects/disconnects outside of the visible area.
ui->peerTreeWidget->verticalScrollBar()->setValue(scrollValue);
}
void NewFriendList::sortColumn(int col,Qt::SortOrder so)

View file

@ -30,6 +30,7 @@
#include "FriendListModel.h"
#include "retroshare/rsstatus.h"
#include "util/FontSizeHandler.h"
#include <QScrollBar>
namespace Ui {
class NewFriendList;

View file

@ -20,7 +20,7 @@
#include <QCoreApplication>
#include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <retroshare/rsidentity.h>
#include "PeerDefs.h"

View file

@ -36,6 +36,7 @@
#include <QMenu>
#include <QTextEdit>
#include <QTreeView>
#include <QFileDialog>
#define COLUMN_FILE 0
#define COLUMN_FILEPATH 1
@ -54,12 +55,12 @@
#define ROLE_FILEC Qt::UserRole + 6
#define ROLE_SELFILEC Qt::UserRole + 7
#define MAX_FILE_ADDED_BEFORE_ASK 500 //Number of file added in Recursive mode before asking to continue
#define MAX_FILE_ADDED_BEFORE_ASK 500 //Number of files added in Recursive mode before asking to continue
#define IMAGE_SEARCH ":/icons/svg/magnifying-glass.svg"
/**
* @brief The FSMSortFilterProxyModel class sort directory before file.
* @brief The FSMSortFilterProxyModel class sorts directories before files.
*/
class FSMSortFilterProxyModel : public QSortFilterProxyModel
{
@ -97,21 +98,20 @@ protected:
return asc;
/*If sorting by Size (Take real size, not Display one 10<2)*/
/*If sorting by Size (Take real size, not Display string)*/
if ((sortColumn()==1) && (!leftFileInfo.isDir() && !rightFileInfo.isDir())) {
if (leftFileInfo.size() < rightFileInfo.size())
return true;
if (leftFileInfo.size() > rightFileInfo.size())
return false;
}
/*If sorting by Date Modified (Take real date, not Display one 01-10-2014<02-01-1980)*/
/*If sorting by Date Modified (Take real date, not Display string)*/
if (sortColumn()==3) {
if (leftFileInfo.lastModified() < rightFileInfo.lastModified())
return true;
if (leftFileInfo.lastModified() > rightFileInfo.lastModified())
return false;
}
//Columns found here:https://qt.gitorious.org/qt/qt/source/9e8abb63ba4609887d988ee15ba6daee0b01380e:src/gui/dialogs/qfilesystemmodel.cpp
return QSortFilterProxyModel::lessThan(left, right);
}
@ -121,11 +121,10 @@ protected:
/**
* @brief RsCollectionDialog::RsCollectionDialog
* @param collectionFileName: Filename of RSCollection saved
* @param creation: Open dialog as RsColl Creation or RsColl DownLoad
* @param readOnly: Open dialog for RsColl as ReadOnly
* @param mode: Open dialog as RsColl Creation or RsColl DownLoad
*/
RsCollectionDialog::RsCollectionDialog(const QString& collectionFileName, RsCollectionDialogMode mode)
: _mode(mode)
: _mode(mode), _dirModel(nullptr), _tree_proxyModel(nullptr), _selectionProxy(nullptr)
{
RsCollection::RsCollectionErrorCode err_code;
mCollection = new RsCollection(collectionFileName,err_code);
@ -140,11 +139,12 @@ RsCollectionDialog::RsCollectionDialog(const QString& collectionFileName, RsColl
}
RsCollectionDialog::RsCollectionDialog(const RsCollection& coll, RsCollectionDialogMode mode)
: _mode(mode)
: _mode(mode), _dirModel(nullptr), _tree_proxyModel(nullptr), _selectionProxy(nullptr)
{
mCollection = new RsCollection(coll);
init(QString());
}
void RsCollectionDialog::init(const QString& collectionFileName)
{
ui.setupUi(this) ;
@ -209,21 +209,32 @@ void RsCollectionDialog::init(const QString& collectionFileName)
connect(ui._download_PB, SIGNAL(clicked()), this, SLOT(download()));
connect(ui._hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
// 3 Initialize List
_dirModel = new QFileSystemModel(this);
_dirModel->setRootPath("/");
_dirModel->setFilter(QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot);
_dirLoaded = false;
connect(_dirModel, SIGNAL(directoryLoaded(QString)), this, SLOT(directoryLoaded(QString)));
// 3 Initialize Local System List ONLY in EDIT mode
if (_mode == EDIT)
{
_dirModel = new QFileSystemModel(this);
_dirModel->setRootPath(QDir::homePath());
_dirModel->setFilter(QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot);
_dirLoaded = false;
connect(_dirModel, SIGNAL(directoryLoaded(QString)), this, SLOT(directoryLoaded(QString)));
_tree_proxyModel = new FSMSortFilterProxyModel(this);
_tree_proxyModel->setSourceModel(_dirModel);
_tree_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
_tree_proxyModel->setSortRole(Qt::DisplayRole);
_tree_proxyModel = new FSMSortFilterProxyModel(this);
_tree_proxyModel->setSourceModel(_dirModel);
_tree_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
_tree_proxyModel->setSortRole(Qt::DisplayRole);
ui._systemFileTW->setModel(_tree_proxyModel);
//Selection Setup
_selectionProxy = ui._systemFileTW->selectionModel();
ui._systemFileTW->setModel(_tree_proxyModel);
_selectionProxy = ui._systemFileTW->selectionModel();
ui._systemFileTW->installEventFilter(this);
}
else
{
_dirModel = nullptr;
_tree_proxyModel = nullptr;
_selectionProxy = nullptr;
_dirLoaded = true;
}
// 4 Restore Configuration
// load settings
@ -236,8 +247,6 @@ void RsCollectionDialog::init(const QString& collectionFileName)
ui._treeViewFrame->setVisible(_mode == EDIT);
ui._download_PB->setVisible(_mode == DOWNLOAD);
ui._systemFileTW->installEventFilter(this);
// 6 Add HashBox
setAcceptDrops(true);
ui._hashBox->setDropWidget(this);
@ -306,7 +315,7 @@ void RsCollectionDialog::processSettings(bool bLoad)
// load settings
if(_mode == EDIT){
// Load windows geometrie
// Load windows geometry
restoreGeometry(Settings->value("WindowGeometrie_CM").toByteArray());
// Load splitters state
ui._mainSplitter->restoreState(Settings->value("MainSplitterState_CM").toByteArray());
@ -316,7 +325,7 @@ void RsCollectionDialog::processSettings(bool bLoad)
// Load file entries header configuration
ui._fileEntriesTW->header()->restoreState(Settings->value("FileEntriesHeader_CM").toByteArray());
} else {
// Load windows geometrie
// Load windows geometry
restoreGeometry(Settings->value("WindowGeometrie").toByteArray());
// Load splitters state
ui._mainSplitter->restoreState(Settings->value("MainSplitterState").toByteArray());
@ -328,7 +337,7 @@ void RsCollectionDialog::processSettings(bool bLoad)
}
} else {
if(_mode == EDIT){
// Save windows geometrie
// Save windows geometry
Settings->setValue("WindowGeometrie_CM",saveGeometry());
// Save splitters state
Settings->setValue("MainSplitterState_CM", ui._mainSplitter->saveState());
@ -338,7 +347,7 @@ void RsCollectionDialog::processSettings(bool bLoad)
// Save file entries header configuration
Settings->setValue("FileEntriesHeader_CM", ui._fileEntriesTW->header()->saveState());
} else {
// Save windows geometrie
// Save windows geometry
Settings->setValue("WindowGeometrie",saveGeometry());
// Save splitter state
Settings->setValue("MainSplitterState", ui._mainSplitter->saveState());
@ -359,6 +368,8 @@ void RsCollectionDialog::processSettings(bool bLoad)
*/
void RsCollectionDialog::directoryLoaded(QString dirLoaded)
{
if(!_dirModel) return;
if(!_dirLoaded)
{
@ -545,13 +556,15 @@ static void recursBuildFileTree(const QString& path,RsFileTree& tree,RsFileTree:
}
/**
* @brief RsCollectionDialog::addRecursive: Add Selected item to RSCollection
* -Add File seperatly if parent folder not selected
* -Add File in folder if selected
* -Get root folder the selected one
* -Add File seperatly if parent folder not selected
* -Add File in folder if selected
* -Get root folder the selected one
* @param recursive: If true, add all selected directory childrens
*/
void RsCollectionDialog::addSelection(bool recursive)
{
if(!_dirModel) return;
QMap<QString, QString > dirToAdd;
QModelIndexList milSelectionList = ui._systemFileTW->selectionModel()->selectedIndexes();
@ -599,7 +612,6 @@ void RsCollectionDialog::addSelection(bool recursive)
void RsCollectionDialog::remove()
{
QMap<QString, QString > dirToRemove;
int count=0;//to not scan all items on list .count()
QModelIndexList milSelectionList = ui._fileEntriesTW->selectionModel()->selectedIndexes();
@ -654,7 +666,7 @@ void RsCollectionDialog::makeDir()
/**
* @brief RsCollectionDialog::fileHashingFinished: Connected to ui._hashBox.fileHashingFinished
* Add finished File to collection in respective directory
* Add finished File to collection in respective directory
* @param hashedFiles: List of the file finished
*/
void RsCollectionDialog::fileHashingFinished(QList<HashedFile> hashedFiles)
@ -772,10 +784,15 @@ void RsCollectionDialog::download()
continue;
if(mb.clickedButton() == btnCorrectAll)
{
auto_correct = true;
}
}
std::cerr << "Requesting file " << corrected_name << " to directory " << path << std::endl;
if(mb.clickedButton() == btnCorrect)
{
auto_correct = false; // logic placeholder
}
}
rsFiles->FileRequest(corrected_name,f.hash,f.size,path,RS_FILE_REQ_ANONYMOUS_ROUTING,std::list<RsPeerId>());
}
@ -801,12 +818,12 @@ void RsCollectionDialog::save()
close();
}
bool RsCollectionDialog::editExistingCollection(const QString& fileName, bool showError /* = true*/)
bool RsCollectionDialog::editExistingCollection(const QString& fileName, bool /*showError*/)
{
return RsCollectionDialog(fileName,EDIT).exec();
}
bool RsCollectionDialog::openExistingCollection(const QString& fileName, bool showError /* = true*/)
bool RsCollectionDialog::openExistingCollection(const QString& fileName, bool /*showError*/)
{
return RsCollectionDialog(fileName,DOWNLOAD).exec();
}
@ -845,6 +862,11 @@ bool RsCollectionDialog::openNewCollection(const RsFileTree& tree)
if (mb.clickedButton()==btnCancel)
return false;
if (mb.clickedButton()==btnOwerWrite)
{
// Proceed to overwrite
}
}
if(!collection.save(fileName))
@ -852,4 +874,3 @@ bool RsCollectionDialog::openNewCollection(const RsFileTree& tree)
return RsCollectionDialog(fileName,EDIT).exec();
}

View file

@ -21,7 +21,7 @@
#include <QCoreApplication>
#include <QColor>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include "TagDefs.h"

View file

@ -30,7 +30,7 @@
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rsiface.h>
#include <retroshare-gui/mainpage.h>
@ -155,7 +155,7 @@ void ConfCertDialog::load()
ui.loc->setText(QString::fromUtf8(detail.location.c_str()));
// Dont Show a timestamp in RS calculate the day
ui.lastcontact->setText(DateTime::formatLongDateTime(detail.lastConnect));
ui.lastcontact->setText(DateTime::formatDateTime(detail.lastConnect));
/* set retroshare version */
std::string version;
@ -163,7 +163,7 @@ void ConfCertDialog::load()
ui.version->setText(QString::fromStdString(version));
/* Custom state string */
QString statustring = QString::fromUtf8(rsMsgs->getCustomStateString(detail.id).c_str());
QString statustring = QString::fromUtf8(rsChats->getCustomStateString(detail.id).c_str());
ui.statusmessage->setText(statustring);

View file

@ -31,7 +31,7 @@
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rsinit.h>
#include <retroshare-gui/mainpage.h>

View file

@ -436,7 +436,7 @@ void BoardsCommentsItem::setComment(const RsGxsComment& cmt)
ui->commLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(cmt.mComment.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_LINKS));;
ui->nameLabel->setId(cmt.mMeta.mAuthorId);
ui->datetimeLabel->setText(DateTime::formatLongDateTime(cmt.mMeta.mPublishTs));
ui->datetimeLabel->setText(DateTime::formatDateTime(cmt.mMeta.mPublishTs));
RsIdentityDetails idDetails ;
rsIdentity->getIdDetails(cmt.mMeta.mAuthorId,idDetails);

View file

@ -404,7 +404,7 @@ void BoardsPostItem::fill()
ui->msgFrame->setVisible(doc.toPlainText().length() > 0);
}
ui->datetimelabel->setText(DateTime::formatLongDateTime(mPost.mMeta.mPublishTs));
ui->datetimelabel->setText(DateTime::formatDateTime(mPost.mMeta.mPublishTs));
}
QString BoardsPostItem::messageName()

View file

@ -366,7 +366,7 @@ void ChannelsCommentsItem::fill(bool missing_post)
ui->commLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mComment.mComment.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_LINKS));
ui->nameLabel->setId(mComment.mMeta.mAuthorId);
ui->datetimeLabel->setText(DateTime::formatLongDateTime(mComment.mMeta.mPublishTs));
ui->datetimeLabel->setText(DateTime::formatDateTime(mComment.mMeta.mPublishTs));
RsIdentityDetails idDetails ;
rsIdentity->getIdDetails(mComment.mMeta.mAuthorId,idDetails);

View file

@ -31,7 +31,7 @@
#include "gui/settings/rsharesettings.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include <retroshare/rspeers.h>
#include "gui/msgs/MessageInterface.h"
@ -43,6 +43,8 @@
* #define DEBUG_ITEM 1
****/
using namespace Rs::Mail;
/** Constructor */
ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, const RsPeerId &peerId, const std::string &message) :
FeedItem(parent,feedId,NULL), mPeerId(peerId)
@ -155,7 +157,7 @@ void ChatMsgItem::insertChat(const std::string &message)
std::cerr << "ChatMsgItem::insertChat(): " << msg << std::endl;
#endif
timestampLabel->setText(DateTime::formatLongDateTime(QDateTime::currentDateTime()));
timestampLabel->setText(DateTime::formatDateTime(QDateTime::currentDateTime()));
QString formatMsg = QString::fromUtf8(message.c_str());

View file

@ -227,7 +227,7 @@ void GxsChannelGroupItem::fill()
if(mGroup.mMeta.mLastPost==0)
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(mGroup.mMeta.mLastPost));
ui->infoLastPost->setText(DateTime::formatDateTime(mGroup.mMeta.mLastPost));
if (mIsHome)
{

View file

@ -436,7 +436,7 @@ void GxsChannelPostItem::fill()
fillExpandFrame();
}
ui->datetimelabel->setText(DateTime::formatLongDateTime(mPost.mMeta.mPublishTs));
ui->datetimelabel->setText(DateTime::formatDateTime(mPost.mMeta.mPublishTs));
if ( (mPost.mAttachmentCount != 0) || (mPost.mSize != 0) ) {
ui->filelabel->setVisible(true);

View file

@ -309,7 +309,7 @@ void GxsForumMsgItem::fillMessage()
if (wasExpanded() || ui->expandFrame->isVisible())
fillExpandFrame();
ui->timestamplabel->setText(DateTime::formatLongDateTime(mMessage.mMeta.mPublishTs));
ui->timestamplabel->setText(DateTime::formatDateTime(mMessage.mMeta.mPublishTs));
/* header stuff */
ui->subjectLabel->setText(msgLink.toHtml());

View file

@ -32,7 +32,8 @@
#include "gui/common/FilesDefs.h"
#include "util/qtthreadsutils.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rschats.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h>
@ -42,6 +43,8 @@
* #define DEBUG_ITEM 1
****/
using namespace Rs::Mail;
/** Constructor */
MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId, bool isHome) :
FeedItem(parent,feedId,NULL), mMsgId(msgId), mIsHome(isHome)
@ -122,6 +125,7 @@ void MsgItem::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
case RsMailStatusEventCode::TAG_CHANGED:
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
case RsMailStatusEventCode::SIGNATURE_FAILED:
default:
break;
}
}
@ -222,7 +226,7 @@ void MsgItem::updateItemStatic()
titleLabel->setText(title);
subjectLabel->setText(QString::fromUtf8(mi.title.c_str()));
mMsg = QString::fromUtf8(mi.msg.c_str());
timestampLabel->setText(DateTime::formatLongDateTime(mi.ts));
timestampLabel->setText(DateTime::formatDateTime(mi.ts));
if (wasExpanded() || expandFrame->isVisible()) {
fillExpandFrame();

View file

@ -31,7 +31,7 @@
#include "util/qtthreadsutils.h"
#include "util/DateTime.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsrtt.h>
@ -132,7 +132,7 @@ void PeerItem::updateItemStatic()
{
/* set peer name */
peerNameLabel->setText(QString::fromUtf8(details.name.c_str()));
lastLabel-> setText(DateTime::formatLongDateTime(details.lastConnect));
lastLabel-> setText(DateTime::formatDateTime(details.lastConnect));
/* expanded Info */
nameLabel->setText(QString::fromUtf8(details.name.c_str()));

View file

@ -190,7 +190,7 @@ void PostedGroupItem::fill()
if(mGroup.mMeta.mLastPost==0)
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(mGroup.mMeta.mLastPost));
ui->infoLastPost->setText(DateTime::formatDateTime(mGroup.mMeta.mLastPost));
//TODO - nice icon for subscribed group
// if (IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags)) {

View file

@ -131,7 +131,7 @@ void SecurityIpItem::updateItemStatic()
}
QDateTime currentTime = QDateTime::currentDateTime();
ui->timeLabel->setText(DateTime::formatLongDateTime(currentTime));
ui->timeLabel->setText(DateTime::formatDateTime(currentTime));
}
void SecurityIpItem::updateItem()

View file

@ -35,7 +35,7 @@
#include "util/DateTime.h"
#include "util/qtthreadsutils.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rspeers.h>
/*****
@ -171,7 +171,7 @@ void SecurityItem::updateItemStatic()
titleLabel->setText(title);
QDateTime currentTime = QDateTime::currentDateTime();
timeLabel->setText(DateTime::formatLongDateTime(currentTime));
timeLabel->setText(DateTime::formatDateTime(currentTime));
if (mIsHome)
{

View file

@ -180,7 +180,7 @@ void GxsCommentDialog::setCommentHeader(QWidget *header)
QDateTime qtime;
qtime.setTime_t(mCurrentPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
QString timestamp = DateTime::formatDateTime(qtime);
ui->dateLabel->setText(timestamp);
ui->fromLabel->setText(QString::fromUtf8(mCurrentPost.mMeta.mAuthorId.c_str()));
ui->titleLabel->setText("<a href=" + QString::fromStdString(mCurrentPost.mLink) +

View file

@ -801,7 +801,7 @@ void GxsCommentTreeWidget::insertComments(const std::vector<RsGxsComment>& comme
{
QDateTime qtime = DateTime::DateTimeFromTime_t(comment.mMeta.mPublishTs) ;
text = qtime.toString("yyyy-MM-dd hh:mm:ss") ;
text = DateTime::formatDateTime(qtime);
item->setText(PCITEM_COLUMN_DATE, text) ;
item->setToolTip(PCITEM_COLUMN_DATE, text) ;
item->setData(PCITEM_COLUMN_DATE, ROLE_SORT, QVariant(qlonglong(comment.mMeta.mPublishTs)));

View file

@ -461,10 +461,10 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description)
if(mGrpMeta.mLastPost==0)
ui.lastpostline->setText(tr("Never"));
else
ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost));
ui.lastpostline->setText(DateTime::formatDateTime(mGrpMeta.mLastPost));
ui.authorValueLabel->setId(mGrpMeta.mAuthorId);
ui.createdline->setText(DateTime::formatLongDateTime(mGrpMeta.mPublishTs));
ui.createdline->setText(DateTime::formatDateTime(mGrpMeta.mPublishTs));
link = RetroShareLink::createMessage(mGrpMeta.mAuthorId, "");

View file

@ -408,7 +408,7 @@ QVariant RsGxsChannelPostFilesModel::displayRole(const ChannelPostFileInfo& fmpe
{
case COLUMN_FILES_NAME: return QString::fromUtf8(fmpe.mName.c_str());
case COLUMN_FILES_SIZE: return QString::number(fmpe.mSize);
case COLUMN_FILES_DATE: return QString::number(fmpe.mPublishTime);
case COLUMN_FILES_DATE: return QVariant(qulonglong(fmpe.mPublishTime));
case COLUMN_FILES_FILE: {
FileInfo finfo;
if(rsFiles->FileDetails(fmpe.mHash,RS_FILE_HINTS_DOWNLOAD,finfo))

View file

@ -227,7 +227,7 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
y += font_height;
y += font_height/2.0;
QString info_text = QLocale::system().toString(DateTime::DateTimeFromTime_t(post.mMeta.mPublishTs), QLocale::ShortFormat);
QString info_text = DateTime::formatDateTime(post.mMeta.mPublishTs);
if(post.mAttachmentCount > 0)
info_text += ", " + QString::number(post.mAttachmentCount)+ " " +((post.mAttachmentCount>1)?tr("files"):tr("file")) + " (" + misc::friendlyUnit(qulonglong(post.mSize)) + ")" ;
@ -318,8 +318,9 @@ void ChannelPostFilesDelegate::paint(QPainter * painter, const QStyleOptionViewI
break;
case RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE: painter->drawText(option.rect,Qt::AlignRight | Qt::AlignVCenter,misc::friendlyUnit(qulonglong(file.mSize)));
break;
case RsGxsChannelPostFilesModel::COLUMN_FILES_DATE: painter->drawText(option.rect,Qt::AlignLeft | Qt::AlignVCenter,QDateTime::fromMSecsSinceEpoch(file.mPublishTime*1000).toString("MM/dd/yyyy, hh:mm"));
break;
case RsGxsChannelPostFilesModel::COLUMN_FILES_DATE:
painter->drawText(option.rect, Qt::AlignLeft | Qt::AlignVCenter, " " + DateTime::formatDateTime(file.mPublishTime));
break;
case RsGxsChannelPostFilesModel::COLUMN_FILES_FILE: {
GxsChannelFilesStatusWidget w(file);
@ -357,7 +358,7 @@ QSize ChannelPostFilesDelegate::sizeHint(const QStyleOptionViewItem& option, con
{
case RsGxsChannelPostFilesModel::COLUMN_FILES_NAME: return QSize(1.1*QFontMetrics_horizontalAdvance(fm, QString::fromUtf8(file.mName.c_str())),fm.height());
case RsGxsChannelPostFilesModel::COLUMN_FILES_SIZE: return QSize(1.1*QFontMetrics_horizontalAdvance(fm, misc::friendlyUnit(qulonglong(file.mSize))),fm.height());
case RsGxsChannelPostFilesModel::COLUMN_FILES_DATE: return QSize(1.1*QFontMetrics_horizontalAdvance(fm, QDateTime::fromMSecsSinceEpoch(file.mPublishTime*1000).toString("MM/dd/yyyy, hh:mm")),fm.height());
case RsGxsChannelPostFilesModel::COLUMN_FILES_DATE: return QSize(1.1 * QFontMetrics_horizontalAdvance(fm, DateTime::formatDateTime(file.mPublishTime)), fm.height());
default:
case RsGxsChannelPostFilesModel::COLUMN_FILES_FILE: return QSize(option.rect.width(),GxsChannelFilesStatusWidget(file).height());
}
@ -955,7 +956,7 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
ui->postName_LB->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str()));
ui->postTime_LB->setText(QDateTime::fromMSecsSinceEpoch(post.mMeta.mPublishTs*1000).toString("MM/dd/yyyy, hh:mm"));
ui->postTime_LB->setText(DateTime::formatDateTime(post.mMeta.mPublishTs));
ui->postTime_LB->setFixedWidth(W);
//ui->channelPostFiles_TV->resizeColumnToContents(RsGxsChannelPostFilesModel::COLUMN_FILES_FILE);
@ -1284,7 +1285,7 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
if(group.mMeta.mLastPost==0)
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost));
ui->infoLastPost->setText(DateTime::formatDateTime(group.mMeta.mLastPost));
uint32_t current_sync_time = GxsGroupFrameDialog::checkDelay(rsGxsChannels->getSyncPeriod(group.mMeta.mGroupId))/86400 ;
@ -1335,7 +1336,7 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
else
ui->infoAdministrator->setText("[No contact author]");
ui->infoCreated->setText(DateTime::formatLongDateTime(group.mMeta.mPublishTs));
ui->infoCreated->setText(DateTime::formatDateTime(group.mMeta.mPublishTs));
QString distrib_string ( "[unknown]" );

View file

@ -52,9 +52,9 @@
//#define ENABLE_GENERATE
/** Constructor */
CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId, const RsGxsMessageId& mOId, const RsGxsId& posterId, bool isModerating)
CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId, const RsGxsMessageId& mOId, const RsGxsId& posterId, const std::set<RsGxsId>& moderatorSet)
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
mForumId(fId), mParentId(pId), mOrigMsgId(mOId),mPosterId(posterId),mIsModerating(isModerating),
mForumId(fId), mParentId(pId), mOrigMsgId(mOId), mPosterId(posterId), mModeratorSet(moderatorSet),
ui(new Ui::CreateGxsForumMsg)
{
/* Invoke the Qt Designer generated object setup routine */
@ -85,7 +85,7 @@ CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessage
QString text = mOId.isNull()?(pId.isNull() ? tr("Start New Thread") : tr("Post Forum Message")):tr("Edit Message");
setWindowTitle(text);
if (!mOId.isNull())
ui->postButton->setText(tr ("Update"));
@ -118,7 +118,7 @@ CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessage
mForumCircleLoaded = false;
newMsg();
ui->hashGroupBox->hide();
#ifndef ENABLE_GENERATE
@ -167,21 +167,24 @@ void CreateGxsForumMsg::newMsg()
mForumMetaLoaded = false;
/* fill in the available OwnIds for signing */
//std::cerr << "Initing ID chooser. Sign flags = " << std::hex << mForumMeta.mSignFlags << std::dec << std::endl;
if(!mPosterId.isNull())
{
std::set<RsGxsId> id_set ;
id_set.insert(mPosterId) ;
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED | IDCHOOSER_NO_CREATE, mPosterId);
//std::cerr << "Initing ID chooser. Sign flags = " << std::hex << mForumMeta.mSignFlags << std::dec << std::endl;
uint32_t idChooserFlags = IDCHOOSER_ID_REQUIRED;
if(!mOrigMsgId.isNull()) {
// we are editing an existing message
std::set<RsGxsId> id_set = mModeratorSet;
if(!mPosterId.isNull())
id_set.insert(mPosterId);
// TODO: Report error if idChooser has no IDs to choose from.
// NOTE: mPosterId may not be our own; then GxsIdChooser will not include it.
idChooserFlags |= IDCHOOSER_NO_CREATE;
ui->idChooser->setIdConstraintSet(id_set);
}
else
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, mPosterId);
}
ui->idChooser->loadIds(idChooserFlags, mPosterId);
if (mForumId.isNull()) {
if (mForumId.isNull()) {
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, false);
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, false);
mStateHelper->setActive(CREATEGXSFORUMMSG_ORIGMSG, false);
@ -403,7 +406,7 @@ void CreateGxsForumMsg::createMsg()
msg.mMeta.mGroupId = mForumId;
msg.mMeta.mParentId = mParentId;
msg.mMeta.mOrigMsgId = mOrigMsgId;
msg.mMeta.mMsgFlags = mIsModerating?RS_GXS_FORUM_MSG_FLAGS_MODERATED : 0;
msg.mMeta.mMsgFlags = 0;
msg.mMeta.mMsgId.clear() ;
if (mParentMsgLoaded) {
@ -425,6 +428,8 @@ void CreateGxsForumMsg::createMsg()
case GxsIdChooser::KnowId:
case GxsIdChooser::UnKnowId:
msg.mMeta.mAuthorId = authorId;
if(!mOrigMsgId.isNull() && authorId != mPosterId)
msg.mMeta.mMsgFlags |= RS_GXS_FORUM_MSG_FLAGS_MODERATED;
//std::cerr << "CreateGxsForumMsg::createMsg() AuthorId: " << authorId;
//std::cerr << std::endl;
@ -577,7 +582,7 @@ void CreateGxsForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
void CreateGxsForumMsg::loadCircleInfo(const RsGxsGroupId& circle_id)
{
//std::cerr << "Loading forum circle info" << std::endl;
RsThread::async( [circle_id,this]()
{
std::vector<RsGxsCircleGroup> circle_grp_v ;

View file

@ -38,7 +38,7 @@ class CreateGxsForumMsg : public QDialog
Q_OBJECT
public:
CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId, const RsGxsMessageId &moId, const RsGxsId &posterId = RsGxsId(),bool isModerating=false);
CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId, const RsGxsMessageId &moId, const RsGxsId &posterId = RsGxsId(), const std::set<RsGxsId>& moderatorSet = std::set<RsGxsId>());
~CreateGxsForumMsg();
void newMsg(); /* cleanup */
@ -59,7 +59,7 @@ private slots:
protected:
void closeEvent (QCloseEvent * event);
void loadCircleInfo(const RsGxsGroupId& circle_id);
private:
void processSettings(bool load);
@ -75,7 +75,7 @@ private:
bool mOrigMsgLoaded;
bool mForumMetaLoaded;
bool mForumCircleLoaded ;
bool mIsModerating; // means that the msg has a orig author Id that is not the Id of the author
std::set<RsGxsId> mModeratorSet; // these IDs are allowed to edit the post in addition to mPosterId
RsGxsForumMsg mParentMsg;
RsGxsForumMsg mOrigMsg;

View file

@ -1062,7 +1062,7 @@ void GxsForumThreadWidget::updateForumDescription(bool success)
if(group.mMeta.mLastPost==0)
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post"),tr("Never"));
else
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post"),DateTime::formatLongDateTime(group.mMeta.mLastPost));
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post"),DateTime::formatDateTime(group.mMeta.mLastPost));
if(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
{
@ -1222,7 +1222,7 @@ void GxsForumThreadWidget::insertMessage()
for(int i=0;i<static_cast<int>(post_versions.size());++i)
{
ui->versions_CB->insertItem(i, ((i==0)?tr("(Latest) "):tr("(Old) "))+" "+DateTime::formatLongDateTime( post_versions[i].first));
ui->versions_CB->insertItem(i, ((i==0)?tr("(Latest) "):tr("(Old) "))+" "+DateTime::formatDateTime( post_versions[i].first));
ui->versions_CB->setItemData(i,QString::fromStdString(post_versions[i].second.toStdString()));
#ifdef DEBUG_FORUMS
@ -1298,7 +1298,7 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
// TODO enabled even when there are no new message
ui->nextUnreadButton->setEnabled(true);
ui->lineLeft->show();
ui->time_label->setText(DateTime::formatLongDateTime(msg.mMeta.mPublishTs));
ui->time_label->setText(DateTime::formatDateTime(msg.mMeta.mPublishTs));
ui->lineRight->show();
ui->by_text_label->show();
ui->by_label->setId(msg.mMeta.mAuthorId);
@ -1627,7 +1627,7 @@ static QString buildReplyHeader(const RsMsgMetaData &meta)
QString header = QString("<span>-----%1-----").arg(QApplication::translate("GxsForumThreadWidget", "Original Message"));
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("GxsForumThreadWidget", "From"), from);
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("GxsForumThreadWidget", "Sent"), DateTime::formatLongDateTime(meta.mPublishTs));
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("GxsForumThreadWidget", "Sent"), DateTime::formatDateTime(meta.mPublishTs));
header += QString("<font size='3'><strong>%1: </strong>%2</font></span><br>").arg(QApplication::translate("GxsForumThreadWidget", "Subject"), QString::fromUtf8(meta.mMsgName.c_str()));
header += "<br>";
@ -1753,33 +1753,17 @@ void GxsForumThreadWidget::editForumMessageData(const RsGxsForumMsg& msg)
std::list<RsGxsId> own_ids ;
rsIdentity->getOwnIds(own_ids) ;
std::set<RsGxsId> modIds;
for(auto it(own_ids.begin());it!=own_ids.end();++it)
if(mForumGroup.mAdminList.ids.find(*it) != mForumGroup.mAdminList.ids.end())
{
moderator_id = *it;
break;
}
modIds.insert(*it);
// Check that author is in own ids, if not use the moderator id that was collected among own ids.
bool is_own = false ;
for(auto it(own_ids.begin());it!=own_ids.end() && !is_own;++it)
if(*it == msg.mMeta.mAuthorId)
is_own = true ;
CreateGxsForumMsg *cfm = new CreateGxsForumMsg(groupId(), msg.mMeta.mParentId, msg.mMeta.mMsgId, msg.mMeta.mAuthorId, modIds);
if (!msg.mMeta.mAuthorId.isNull())
{
CreateGxsForumMsg *cfm = new CreateGxsForumMsg(groupId(), msg.mMeta.mParentId, msg.mMeta.mMsgId, is_own?(msg.mMeta.mAuthorId):moderator_id,!is_own);
cfm->insertPastedText(QString::fromUtf8(msg.mMsg.c_str())) ;
cfm->show();
cfm->insertPastedText(QString::fromUtf8(msg.mMsg.c_str())) ;
cfm->show();
/* window will destroy itself! */
}
else
{
QMessageBox::information(this, tr("RetroShare"),tr("You cant reply to an Anonymous Author"));
}
/* cfm window will destroy itself! */
}
void GxsForumThreadWidget::replyForumMessageData(const RsGxsForumMsg &msg)
{

View file

@ -301,6 +301,7 @@
<file>icons/png/options2.png</file>
<file>icons/png/exit2.png</file>
<file>icons/png/wiki.png</file>
<file>icons/png/wiki-notify.png</file>
<file>icons/svg/addstickers.svg</file>
<file>icons/png/addstickers.png</file>
<file>icons/textedit/bold.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 5 KiB

Before After
Before After

View file

@ -24,7 +24,7 @@
#include <QDialog>
#include <QThread>
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
#include "gui/chat/ChatStyle.h"
#include "ui_ImHistoryBrowser.h"

View file

@ -44,7 +44,7 @@
#include <retroshare/rsiface.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rsstatus.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rsidentity.h>
@ -99,6 +99,8 @@
static const uint32_t MAX_ALLOWED_GXS_MESSAGE_SIZE = 199000;
using namespace Rs::Mail;
class MessageItemDelegate : public QItemDelegate
{
public:
@ -678,7 +680,7 @@ void MessageComposer::addConnectAttemptMsg(const RsPgpId &gpgId, const RsPeerId
std::list<MsgInfoSummary> msgList;
std::list<MsgInfoSummary>::const_iterator it;
rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_INBOX,msgList);
rsMail->getMessageSummaries(Rs::Mail::BoxName::BOX_INBOX,msgList);
// do not re-add an existing request.
// note: the test with name() is very unsecure. We should use the ID instead.
@ -1167,7 +1169,7 @@ QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
header += QString("<font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("Cc"), cc);
}
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("Sent"), DateTime::formatLongDateTime(msgInfo.ts));
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("Sent"), DateTime::formatDateTime(msgInfo.ts));
header += QString("<font size='3'><strong>%1: </strong>%2</font></span><br>").arg(tr("Subject"), QString::fromUtf8(msgInfo.title.c_str()));
header += "<br>";
@ -1502,7 +1504,7 @@ bool MessageComposer::buildMessage(MessageInfo& mi)
}
if(!at_least_one_gxsid)
mi.from = Rs::Msgs::MsgAddress(rsPeers->getOwnId(),MsgAddress::MSG_ADDRESS_MODE_TO);
mi.from = Rs::Mail::MsgAddress(rsPeers->getOwnId(),MsgAddress::MSG_ADDRESS_MODE_TO);
else
{
auto gxs_id_from = RsGxsId(ui.respond_to_CB->itemData(ui.respond_to_CB->currentIndex()).toString().toStdString());

View file

@ -23,7 +23,7 @@
#include <QMainWindow>
#include <retroshare/rstypes.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <retroshare/rspeers.h>
#include "ui_MessageComposer.h"
@ -172,8 +172,8 @@ private slots:
void checkLength();
private:
static QString buildReplyHeader(const MessageInfo &msgInfo);
bool buildMessage(MessageInfo& mi);
static QString buildReplyHeader(const Rs::Mail::MessageInfo &msgInfo);
bool buildMessage(Rs::Mail::MessageInfo& mi);
void processSettings(bool bLoad);

View file

@ -29,23 +29,6 @@
*
*/
#define USE_OLD_MAIL 1
#ifdef USE_OLD_MAIL
#include <retroshare/rsmsgs.h>
using namespace Rs::Msgs;
#define rsMail rsMsgs
#else
#include <retroshare/rsmail.h>
using namespace Rs::Mail;
#endif
#include <retroshare/rsmail.h>
#endif // MRK_MESSAGE_INTERFACE

View file

@ -34,10 +34,12 @@
#include "gui/gxs/GxsIdTreeWidgetItem.h"
#include "MessageModel.h"
#include "retroshare/rsexpr.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rsmail.h"
//#define DEBUG_MESSAGE_MODEL
using namespace Rs::Mail;
#define IS_MESSAGE_UNREAD(flags) (flags & (RS_MSG_NEW | RS_MSG_UNREAD_BY_USER))
#define IMAGE_STAR_ON ":/images/star-on-16.png"
@ -53,7 +55,7 @@ const QString RsMessageModel::FilterString("filtered");
RsMessageModel::RsMessageModel(QObject *parent)
: QAbstractItemModel(parent)
{
mCurrentBox = Rs::Msgs::BoxName::BOX_NONE;
mCurrentBox = Rs::Mail::BoxName::BOX_NONE;
mQuickViewFilter = QUICK_VIEW_ALL;
mFilterType = FILTER_TYPE_NONE;
mFilterStrings.clear();
@ -92,7 +94,7 @@ int RsMessageModel::columnCount(const QModelIndex &/*parent*/) const
return COLUMN_THREAD_NB_COLUMNS;
}
bool RsMessageModel::getMessageData(const QModelIndex& i,Rs::Msgs::MessageInfo& fmpe) const
bool RsMessageModel::getMessageData(const QModelIndex& i,Rs::Mail::MessageInfo& fmpe) const
{
if(!i.isValid())
return true;
@ -103,7 +105,7 @@ bool RsMessageModel::getMessageData(const QModelIndex& i,Rs::Msgs::MessageInfo&
if(!convertInternalIdToMsgIndex(ref,index) || index >= mMessages.size())
return false ;
return rsMsgs->getMessage(mMessages[index].msgId,fmpe);
return rsMail->getMessage(mMessages[index].msgId,fmpe);
}
bool RsMessageModel::hasChildren(const QModelIndex &parent) const
@ -245,7 +247,7 @@ QVariant RsMessageModel::data(const QModelIndex &index, int role) const
return QVariant() ;
}
const Rs::Msgs::MsgInfoSummary& fmpe(mMessages[entry]);
const Rs::Mail::MsgInfoSummary& fmpe(mMessages[entry]);
if(role == Qt::FontRole)
{
@ -288,10 +290,10 @@ QVariant RsMessageModel::data(const QModelIndex &index, int role) const
}
}
QVariant RsMessageModel::textColorRole(const Rs::Msgs::MsgInfoSummary& fmpe,int /*column*/) const
QVariant RsMessageModel::textColorRole(const Rs::Mail::MsgInfoSummary& fmpe,int /*column*/) const
{
Rs::Msgs::MsgTagType tags;
rsMsgs->getMessageTagTypes(tags);
Rs::Mail::MsgTagType tags;
rsMail->getMessageTagTypes(tags);
for(auto it(fmpe.msgtags.begin());it!=fmpe.msgtags.end();++it)
for(auto it2(tags.types.begin());it2!=tags.types.end();++it2)
@ -301,7 +303,7 @@ QVariant RsMessageModel::textColorRole(const Rs::Msgs::MsgInfoSummary& fmpe,int
return QVariant();
}
QVariant RsMessageModel::statusRole(const Rs::Msgs::MsgInfoSummary& /*fmpe*/,int /*column*/) const
QVariant RsMessageModel::statusRole(const Rs::Mail::MsgInfoSummary& /*fmpe*/,int /*column*/) const
{
// if(column != COLUMN_THREAD_DATA)
// return QVariant();
@ -309,7 +311,7 @@ QVariant RsMessageModel::statusRole(const Rs::Msgs::MsgInfoSummary& /*fmpe*/,int
return QVariant();//fmpe.mMsgStatus);
}
bool RsMessageModel::passesFilter(const Rs::Msgs::MsgInfoSummary& fmpe,int /*column*/) const
bool RsMessageModel::passesFilter(const Rs::Mail::MsgInfoSummary& fmpe,int /*column*/) const
{
QString s ;
bool passes_strings = true ;
@ -333,8 +335,8 @@ bool RsMessageModel::passesFilter(const Rs::Msgs::MsgInfoSummary& fmpe,int /*col
case FILTER_TYPE_DATE: s = displayRole(fmpe,COLUMN_THREAD_DATE).toString();
break;
case FILTER_TYPE_CONTENT: {
Rs::Msgs::MessageInfo minfo;
rsMsgs->getMessage(fmpe.msgId,minfo);
Rs::Mail::MessageInfo minfo;
rsMail->getMessage(fmpe.msgId,minfo);
s = QTextDocument(QString::fromUtf8(minfo.msg.c_str())).toPlainText();
}
break;
@ -343,8 +345,8 @@ bool RsMessageModel::passesFilter(const Rs::Msgs::MsgInfoSummary& fmpe,int /*col
case FILTER_TYPE_ATTACHMENTS:
{
Rs::Msgs::MessageInfo minfo;
rsMsgs->getMessage(fmpe.msgId,minfo);
Rs::Mail::MessageInfo minfo;
rsMail->getMessage(fmpe.msgId,minfo);
for(auto it(minfo.files.begin());it!=minfo.files.end();++it)
s += QString::fromUtf8((*it).fname.c_str())+" ";
@ -375,7 +377,7 @@ bool RsMessageModel::passesFilter(const Rs::Msgs::MsgInfoSummary& fmpe,int /*col
return passes_quick_view && passes_strings;
}
QVariant RsMessageModel::filterRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
QVariant RsMessageModel::filterRole(const Rs::Mail::MsgInfoSummary& fmpe,int column) const
{
if(passesFilter(fmpe,column))
return QVariant(FilterString);
@ -414,7 +416,7 @@ void RsMessageModel::setFont(const QFont &font)
}
}
QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
QVariant RsMessageModel::toolTipRole(const Rs::Mail::MsgInfoSummary& fmpe,int column) const
{
if(column == COLUMN_THREAD_AUTHOR || column == COLUMN_THREAD_TO)
{
@ -443,7 +445,7 @@ QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
return QVariant();
}
QVariant RsMessageModel::backgroundRole(const Rs::Msgs::MsgInfoSummary &/*fmpe*/, int /*column*/) const
QVariant RsMessageModel::backgroundRole(const Rs::Mail::MsgInfoSummary &/*fmpe*/, int /*column*/) const
{
return QVariant();
}
@ -462,12 +464,12 @@ QVariant RsMessageModel::sizeHintRole(int col) const
}
}
QVariant RsMessageModel::authorRole(const Rs::Msgs::MsgInfoSummary& /*fmpe*/,int /*column*/) const
QVariant RsMessageModel::authorRole(const Rs::Mail::MsgInfoSummary& /*fmpe*/,int /*column*/) const
{
return QVariant();
}
QVariant RsMessageModel::sortRole(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const
QVariant RsMessageModel::sortRole(const Rs::Mail::MsgInfoSummary& fmpe,int column) const
{
switch(column)
{
@ -493,7 +495,7 @@ QVariant RsMessageModel::sortRole(const Rs::Msgs::MsgInfoSummary& fmpe,int colum
}
}
QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int col) const
QVariant RsMessageModel::displayRole(const Rs::Mail::MsgInfoSummary& fmpe,int col) const
{
switch(col)
{
@ -511,11 +513,11 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
case COLUMN_THREAD_TAGS:{
// Tags
Rs::Msgs::MsgTagInfo tagInfo;
rsMsgs->getMessageTag(fmpe.msgId, tagInfo);
Rs::Mail::MsgTagInfo tagInfo;
rsMail->getMessageTag(fmpe.msgId, tagInfo);
Rs::Msgs::MsgTagType Tags;
rsMsgs->getMessageTagTypes(Tags);
Rs::Mail::MsgTagType Tags;
rsMail->getMessageTagTypes(Tags);
QString text;
@ -539,9 +541,9 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
switch(mCurrentBox)
{
case Rs::Msgs::BoxName::BOX_DRAFTS: // in this case, we display the full list of destinations
case Rs::Msgs::BoxName::BOX_TRASH: // in this case, we display the full list of destinations
case Rs::Msgs::BoxName::BOX_SENT: // in this case, we display the full list of destinations
case Rs::Mail::BoxName::BOX_DRAFTS: // in this case, we display the full list of destinations
case Rs::Mail::BoxName::BOX_TRASH: // in this case, we display the full list of destinations
case Rs::Mail::BoxName::BOX_SENT: // in this case, we display the full list of destinations
{
for(auto d:fmpe.destinations)
{
@ -556,9 +558,9 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
return name;
}
break;
case Rs::Msgs::BoxName::BOX_NONE: // in these cases, we display the actual destination
case Rs::Msgs::BoxName::BOX_INBOX: // in these cases, we display the actual destination
case Rs::Msgs::BoxName::BOX_OUTBOX:
case Rs::Mail::BoxName::BOX_NONE: // in these cases, we display the actual destination
case Rs::Mail::BoxName::BOX_INBOX: // in these cases, we display the actual destination
case Rs::Mail::BoxName::BOX_OUTBOX:
{
RsGxsId id = RsGxsId(fmpe.to.toStdString()); // use "to" field, which is populated in Outbox, .
if(id.isNull())
@ -592,7 +594,7 @@ QVariant RsMessageModel::displayRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co
return QVariant("[ERROR]");
}
QVariant RsMessageModel::userRole(const Rs::Msgs::MsgInfoSummary& fmpe,int col) const
QVariant RsMessageModel::userRole(const Rs::Mail::MsgInfoSummary& fmpe,int col) const
{
switch(col)
{
@ -615,7 +617,7 @@ QVariant RsMessageModel::userRole(const Rs::Msgs::MsgInfoSummary& fmpe,int col)
}
}
QVariant RsMessageModel::decorationRole(const Rs::Msgs::MsgInfoSummary& fmpe,int col) const
QVariant RsMessageModel::decorationRole(const Rs::Mail::MsgInfoSummary& fmpe,int col) const
{
bool exist=false;
switch(col)
@ -674,7 +676,7 @@ void RsMessageModel::clear()
emit messagesLoaded();
}
void RsMessageModel::setMessages(const std::list<Rs::Msgs::MsgInfoSummary>& msgs)
void RsMessageModel::setMessages(const std::list<Rs::Mail::MsgInfoSummary>& msgs)
{
clear();
@ -700,7 +702,7 @@ void RsMessageModel::setMessages(const std::list<Rs::Msgs::MsgInfoSummary>& msgs
emit messagesLoaded();
}
void RsMessageModel::setCurrentBox(Rs::Msgs::BoxName bn)
void RsMessageModel::setCurrentBox(Rs::Mail::BoxName bn)
{
if(mCurrentBox != bn)
{
@ -709,7 +711,7 @@ void RsMessageModel::setCurrentBox(Rs::Msgs::BoxName bn)
}
}
Rs::Msgs::BoxName RsMessageModel::currentBox() const
Rs::Mail::BoxName RsMessageModel::currentBox() const
{
return mCurrentBox;
}
@ -732,9 +734,9 @@ void RsMessageModel::updateMessages()
{
emit messagesAboutToLoad();
std::list<Rs::Msgs::MsgInfoSummary> msgs;
std::list<Rs::Mail::MsgInfoSummary> msgs;
rsMsgs->getMessageSummaries(mCurrentBox,msgs);
rsMail->getMessageSummaries(mCurrentBox,msgs);
setMessages(msgs);
emit messagesLoaded();
@ -746,7 +748,7 @@ void RsMessageModel::setMsgReadStatus(const QModelIndex& i,bool read_status)
return ;
preMods();
rsMsgs->MessageRead(i.data(MsgIdRole).toString().toStdString(),!read_status);
rsMail->MessageRead(i.data(MsgIdRole).toString().toStdString(),!read_status);
emit dataChanged(i,i);
}
@ -766,7 +768,7 @@ void RsMessageModel::setMsgsReadStatus(const QModelIndexList& mil,bool read_stat
preMods();
for(auto& it : list)
rsMsgs->MessageRead(it,!read_status);
rsMail->MessageRead(it,!read_status);
emit dataChanged(createIndex(start,0),createIndex(stop,RsMessageModel::columnCount()-1));
}
@ -777,7 +779,7 @@ void RsMessageModel::setMsgStar(const QModelIndex& i,bool star)
return ;
preMods();
rsMsgs->MessageStar(i.data(MsgIdRole).toString().toStdString(),star);
rsMail->MessageStar(i.data(MsgIdRole).toString().toStdString(),star);
emit dataChanged(i,i);
}
@ -797,7 +799,7 @@ void RsMessageModel::setMsgsStar(const QModelIndexList& mil,bool star)
preMods();
for(auto& it : list)
rsMsgs->MessageStar(it,star);
rsMail->MessageStar(it,star);
emit dataChanged(createIndex(start,0),createIndex(stop,RsMessageModel::columnCount()-1));
}
@ -808,7 +810,7 @@ void RsMessageModel::setMsgJunk(const QModelIndex& i,bool junk)
return ;
preMods();
rsMsgs->MessageJunk(i.data(MsgIdRole).toString().toStdString(),junk);
rsMail->MessageJunk(i.data(MsgIdRole).toString().toStdString(),junk);
emit dataChanged(i,i);
}
@ -828,7 +830,7 @@ void RsMessageModel::setMsgsJunk(const QModelIndexList& mil,bool junk)
preMods();
for(auto& it : list)
rsMsgs->MessageJunk(it,junk);
rsMail->MessageJunk(it,junk);
emit dataChanged(createIndex(start,0),createIndex(stop,RsMessageModel::columnCount()-1));
}

View file

@ -24,7 +24,7 @@
#include <QColor>
#include <QFont>
#include "retroshare/rsmsgs.h"
#include "retroshare/rsmail.h"
// This class holds the actual hierarchy of posts, represented by identifiers
// It is responsible for auto-updating when necessary and holds a mutex to allow the Model to
@ -61,7 +61,7 @@ public:
enum QuickViewFilter {
QUICK_VIEW_ALL = 0x00,
QUICK_VIEW_IMPORTANT = 0x01, // These numbers have been carefuly chosen to match the ones in rsmsgs.h
QUICK_VIEW_IMPORTANT = 0x01, // These numbers have been carefuly chosen to match the ones in rsmail.h
QUICK_VIEW_WORK = 0x02,
QUICK_VIEW_PERSONAL = 0x03,
QUICK_VIEW_TODO = 0x04,
@ -75,7 +75,7 @@ public:
enum FilterType {
FILTER_TYPE_NONE = 0x00,
FILTER_TYPE_SUBJECT = 0x01, // These numbers have been carefuly chosen to match the ones in rsmsgs.h
FILTER_TYPE_SUBJECT = 0x01, // These numbers have been carefuly chosen to match the ones in rsmail.h
FILTER_TYPE_FROM = 0x02,
FILTER_TYPE_TO = 0x03,
FILTER_TYPE_DATE = 0x04,
@ -100,8 +100,8 @@ public:
// This method will asynchroneously update the data
void setCurrentBox(Rs::Msgs::BoxName bn) ;
Rs::Msgs::BoxName currentBox() const ;
void setCurrentBox(Rs::Mail::BoxName bn) ;
Rs::Mail::BoxName currentBox() const ;
void setQuickViewFilter(QuickViewFilter fn) ;
void setFilter(FilterType filter_type, const QStringList& strings) ;
@ -118,22 +118,22 @@ public:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool getMessageData(const QModelIndex& i,Rs::Msgs::MessageInfo& fmpe) const;
bool getMessageData(const QModelIndex& i,Rs::Mail::MessageInfo& fmpe) const;
void clear() ;
QVariant sizeHintRole (int col) const;
QVariant displayRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant decorationRole(const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant toolTipRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant userRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant statusRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant authorRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant sortRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant fontRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant filterRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant textColorRole (const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant backgroundRole(const Rs::Msgs::MsgInfoSummary& fmpe, int col) const;
QVariant displayRole (const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant decorationRole(const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant toolTipRole (const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant userRole (const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant statusRole (const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant authorRole (const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant sortRole (const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant fontRole (const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant filterRole (const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant textColorRole (const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
QVariant backgroundRole(const Rs::Mail::MsgInfoSummary& fmpe, int col) const;
#ifdef DEBUG_MESSAGE_MODEL
/*!
@ -159,7 +159,7 @@ signals:
void messagesAboutToLoad();
private:
bool passesFilter(const Rs::Msgs::MsgInfoSummary& fmpe,int column) const;
bool passesFilter(const Rs::Mail::MsgInfoSummary& fmpe,int column) const;
void preMods() ;
void postMods() ;
@ -174,7 +174,7 @@ private:
uint32_t updateFilterStatus(ForumModelIndex i,int column,const QStringList& strings);
void setMessages(const std::list<Rs::Msgs::MsgInfoSummary>& msgs);
void setMessages(const std::list<Rs::Mail::MsgInfoSummary>& msgs);
QColor mTextColorRead ;
QColor mTextColorUnread ;
@ -182,12 +182,12 @@ private:
QColor mTextColorNotSubscribed ;
QColor mTextColorMissing ;
Rs::Msgs::BoxName mCurrentBox ;
Rs::Mail::BoxName mCurrentBox ;
QuickViewFilter mQuickViewFilter ;
QStringList mFilterStrings;
FilterType mFilterType;
QFont mFont;
std::vector<Rs::Msgs::MsgInfoSummary> mMessages;
std::vector<Rs::Mail::MsgInfoSummary> mMessages;
std::map<std::string,uint32_t> mMessagesMap;
};

View file

@ -49,7 +49,7 @@
#include <retroshare/rspeers.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
/* Images for context menu icons */
#define IMAGE_DOWNLOAD ":/icons/png/download.png"
@ -62,6 +62,8 @@
#include "gui/msgs/MessageInterface.h"
using namespace Rs::Mail;
class RsHtmlMsg : public RsHtml
{
public:
@ -687,7 +689,7 @@ void MessageWidget::fill(const std::string &msgId)
// link.createMessage(ownId, "");
// }
if(msgInfo.from.type()==Rs::Msgs::MsgAddress::MSG_ADDRESS_TYPE_RSGXSID) // distant message
if(msgInfo.from.type()==Rs::Mail::MsgAddress::MSG_ADDRESS_TYPE_RSGXSID) // distant message
{
tooltip_string = PeerDefs::rsidFromId(msgInfo.from.toGxsId()) ;
link = RetroShareLink::createMessage(msgInfo.from.toGxsId(), "");

View file

@ -25,10 +25,12 @@
#include "TagsMenu.h"
#include "gui/settings/rsharesettings.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include "gui/msgs/MessageInterface.h"
using namespace Rs::Mail;
/** Constructor */
MessageWindow::MessageWindow(QWidget *parent, Qt::WindowFlags flags)
: RWindow("MessageWindow", parent, flags)

View file

@ -49,7 +49,7 @@
#include "util/RsProtectedTimer.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include <algorithm>
@ -96,6 +96,8 @@
// #define DEBUG_MESSAGES_DIALOG 1
using namespace Rs::Mail;
class MessageSortFilterProxyModel: public QSortFilterProxyModel
{
public:
@ -929,18 +931,18 @@ void MessagesDialog::changeBox(int box_row)
QString placeholderText = tr("No message available in your %1.").arg(item->text());
switch(box_row)
{
case ROW_INBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_INBOX );
case ROW_INBOX: mMessageModel->setCurrentBox(Rs::Mail::BoxName::BOX_INBOX );
break;
case ROW_OUTBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_OUTBOX);
case ROW_OUTBOX: mMessageModel->setCurrentBox(Rs::Mail::BoxName::BOX_OUTBOX);
break;
case ROW_DRAFTBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_DRAFTS);
case ROW_DRAFTBOX: mMessageModel->setCurrentBox(Rs::Mail::BoxName::BOX_DRAFTS);
break;
case ROW_SENTBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_SENT );
case ROW_SENTBOX: mMessageModel->setCurrentBox(Rs::Mail::BoxName::BOX_SENT );
break;
case ROW_TRASHBOX: mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_TRASH );
case ROW_TRASHBOX: mMessageModel->setCurrentBox(Rs::Mail::BoxName::BOX_TRASH );
break;
default:
mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_NONE);
mMessageModel->setCurrentBox(Rs::Mail::BoxName::BOX_NONE);
}
insertMsgTxtAndFiles(ui.messageTreeWidget->currentIndex());
@ -955,7 +957,7 @@ void MessagesDialog::changeBox(int box_row)
}
else
{
mMessageModel->setCurrentBox(Rs::Msgs::BoxName::BOX_NONE);
mMessageModel->setCurrentBox(Rs::Mail::BoxName::BOX_NONE);
}
inChange = false;
@ -1320,7 +1322,7 @@ void MessagesDialog::updateMessageSummaryList()
/* calculating the new messages */
std::list<MsgInfoSummary> msgList;
rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_ALL,msgList);
rsMail->getMessageSummaries(Rs::Mail::BoxName::BOX_ALL,msgList);
QMap<int, int> tagCount;
@ -1566,8 +1568,8 @@ void MessagesDialog::tagSet(int tagId, bool set)
void MessagesDialog::emptyTrash()
{
std::list<Rs::Msgs::MsgInfoSummary> msgs ;
rsMsgs->getMessageSummaries(Rs::Msgs::BoxName::BOX_TRASH,msgs);
std::list<Rs::Mail::MsgInfoSummary> msgs ;
rsMail->getMessageSummaries(Rs::Mail::BoxName::BOX_TRASH,msgs);
for(auto it(msgs.begin());it!=msgs.end();++it)
rsMail->MessageDelete(it->msgId);

View file

@ -24,7 +24,7 @@
#include <algorithm>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsmail.h>
#include "TagsMenu.h"
#include "gui/common/TagDefs.h"
@ -42,6 +42,8 @@
#define ACTION_TAGS_TAG 1
#define ACTION_TAGS_NEWTAG 2
using namespace Rs::Mail;
TagsMenu::TagsMenu(const QString &title, QWidget *parent)
: QMenu (title, parent)
{

View file

@ -45,7 +45,7 @@ ProfileWidget::ProfileWidget(QWidget *parent, Qt::WindowFlags flags)
connect(ui.CopyCertButton,SIGNAL(clicked()), this, SLOT(copyCert()));
connect(ui.profile_Button,SIGNAL(clicked()), this, SLOT(profilemanager()));
ui.onLineSince->setText(DateTime::formatLongDateTime(RsApplication::startupTime()));
ui.onLineSince->setText(DateTime::formatDateTime(RsApplication::startupTime()));
}
void ProfileWidget::showEvent ( QShowEvent * /*event*/ )

View file

@ -20,7 +20,7 @@
#include "StatusMessage.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rschats.h>
/** Default constructor */
StatusMessage::StatusMessage(QWidget *parent)
@ -32,13 +32,13 @@ StatusMessage::StatusMessage(QWidget *parent)
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(save()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
ui.txt_StatusMessage->setText(QString::fromUtf8(rsMsgs->getCustomStateString().c_str()));
ui.txt_StatusMessage->setText(QString::fromUtf8(rsChats->getOwnCustomStateString().c_str()));
}
/** Saves the changes on this page */
void StatusMessage::save()
{
rsMsgs->setCustomStateString(ui.txt_StatusMessage->text().toUtf8().constData());
rsChats->setCustomStateString(ui.txt_StatusMessage->text().toUtf8().constData());
accept();
}

View file

@ -37,6 +37,7 @@
#include "gui/statusbar/SysTrayStatus.h"
#include "lang/languagesupport.h"
#include "util/misc.h"
#include "util/DateTime.h"
#include <QAbstractItemView>
#include <QComboBox>
@ -47,6 +48,8 @@
#include <QStatusBar>
#include <QStyledItemDelegate>
#include <QStyleFactory>
#include <QDateTime>
#include <QLocale>
/** Constructor */
AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
@ -90,6 +93,29 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
ui.cmboStyleSheet->addItem(name, styleSheets[name]);
}
/* Populate Date Format combo box */
QDateTime now = QDateTime::currentDateTime();
// 1. Format Système (ShortFormat)
ui.cmboDateFormat->addItem(tr("System Default") + " (" +
QLocale::system().toString(now.date(), QLocale::ShortFormat) + " " +
QLocale::system().toString(now.time(), QLocale::ShortFormat) + ")",
RshareSettings::DateFormat_System);
// 2. Format ISO (YYYY-MM-DD + HH:mm)
ui.cmboDateFormat->addItem(tr("ISO 8601") + " (" +
now.date().toString(Qt::ISODate) + " " +
now.time().toString("HH:mm") + ")",
RshareSettings::DateFormat_ISO);
// 3. Format Texte (LongFormat de Qt + Heure)
ui.cmboDateFormat->addItem(tr("Text") + " (" +
QLocale::system().toString(now.date(), QLocale::LongFormat) + " " +
QLocale::system().toString(now.time(), QLocale::ShortFormat) + ")",
RshareSettings::DateFormat_Text);
connect(ui.cmboDateFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDateFormat()));
connect(ui.cmboTollButtonsSize, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCmboToolButtonSize() ));
// connect(ui.cmboListItemSize, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCmboListItemSize() ));
connect(ui.cmboTollButtonsStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCmboToolButtonStyle()));
@ -262,6 +288,15 @@ void AppearancePage::load()
int index = ui.cmboLanguage->findData(Settings->getLanguageCode());
whileBlocking(ui.cmboLanguage)->setCurrentIndex(index);
// Load Date Format
int dateFormat = Settings->getDateFormat();
int comboIndex = ui.cmboDateFormat->findData(dateFormat);
if (comboIndex != -1) {
whileBlocking(ui.cmboDateFormat)->setCurrentIndex(comboIndex);
} else {
whileBlocking(ui.cmboDateFormat)->setCurrentIndex(0);
}
index = ui.cmboStyle->findData(RsApplication::style().toLower());
whileBlocking(ui.cmboStyle)->setCurrentIndex(index);
@ -371,3 +406,12 @@ void AppearancePage::updateFontSize()
RsGUIEventManager::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateDateFormat()
{
int format = ui.cmboDateFormat->currentData().toInt();
Settings->setDateFormat(format);
DateTime::updateDateFormatCache();
RsGUIEventManager::getInstance()->notifySettingsChanged();
}

View file

@ -60,6 +60,7 @@ private slots:
void switch_status_ShowSystray(bool) ;
void updateLanguageCode() ;
void updateDateFormat();
void updateInterfaceStyle() ;
void updateSheetName() ;
void updateRbtPageOnToolBar();

View file

@ -14,7 +14,8 @@
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" name="AppearancePageGLayout">
<item row="0" column="0" colspan="2">
<item row="0" column="0">
<widget class="QGroupBox" name="grpLanguage">
<property name="minimumSize">
<size>
@ -48,19 +49,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="grpLanguageHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>300</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelLanguage">
<property name="text">
@ -68,9 +56,59 @@
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="grpLanguageHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="grpDateFormat">
<property name="title">
<string>Date Format</string>
</property>
<layout class="QGridLayout" name="grpDateGLayout">
<item row="0" column="0">
<widget class="RSComboBox" name="cmboDateFormat">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Choose the date display format</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="grpDateHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="grpToolBar">
<property name="minimumSize">

View file

@ -30,7 +30,7 @@
#include "retroshare/rsconfig.h"
#include "retroshare/rshistory.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rschats.h"
#include "retroshare/rspeers.h"
#include <QColorDialog>
@ -153,7 +153,7 @@ void ChatPage::updateDefaultLobbyIdentity()
{
case GxsIdChooser::KnowId:
case GxsIdChooser::UnKnowId:
rsMsgs->setDefaultIdentityForChatLobby(chosen_id) ;
rsChats->setDefaultIdentityForChatLobby(chosen_id) ;
break ;
default:;
@ -395,7 +395,7 @@ ChatPage::load()
// state of distant Chat combobox
switch(rsMsgs->getDistantChatPermissionFlags())
switch(rsChats->getDistantChatPermissionFlags())
{
default:
case RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NONE:
@ -466,7 +466,7 @@ ChatPage::load()
historyStylePath = loadStyleInfo(ChatStyle::TYPE_HISTORY, ui.historyStyle, ui.historyComboBoxVariant, historyStyleVariant);
RsGxsId gxs_id ;
rsMsgs->getDefaultIdentityForChatLobby(gxs_id) ;
rsChats->getDefaultIdentityForChatLobby(gxs_id) ;
ui.chatLobbyIdentity_IC->setFlags(IDCHOOSER_ID_REQUIRED) ;
@ -700,13 +700,13 @@ void ChatPage::distantChatComboBoxChanged(int i)
switch(i)
{
default:
case 0: rsMsgs->setDistantChatPermissionFlags(RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NONE) ;
case 0: rsChats->setDistantChatPermissionFlags(RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NONE) ;
break ;
case 1: rsMsgs->setDistantChatPermissionFlags(RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NON_CONTACTS) ;
case 1: rsChats->setDistantChatPermissionFlags(RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NON_CONTACTS) ;
break ;
case 2: rsMsgs->setDistantChatPermissionFlags(RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_EVERYBODY) ;
case 2: rsChats->setDistantChatPermissionFlags(RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_EVERYBODY) ;
break ;
}

View file

@ -68,7 +68,7 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WindowFlags flags)
ui.retroshareId_content_LB->hide();
ui.stackPageCertificate->hide();
ui.onlinesince->setText(DateTime::formatLongDateTime(RsApplication::startupTime()));
ui.onlinesince->setText(DateTime::formatDateTime(RsApplication::startupTime()));
}
#ifdef UNUSED_CODE
@ -95,7 +95,6 @@ void CryptoPage::exportProfile()
QMessageBox::information(this, tr("Identity not saved"), tr("Your identity was not saved. An error occurred."));
}
void CryptoPage::showEvent ( QShowEvent * /*event*/ )
{
RsPeerDetails detail;
@ -112,8 +111,15 @@ void CryptoPage::showEvent ( QShowEvent * /*event*/ )
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),RetroshareInviteFlags::RADIX_FORMAT | RsPeers::defaultCertificateFlags);
ui.retroshareId_content_LB->setText(QString::fromUtf8(invite.c_str()));
/* set retroshare version */
ui.version->setText(RsApplication::retroshareVersion(true));
/* [Modified] Show both RetroShare and libretroshare versions */
/* We rename the label "Software Version:" to "RetroShare version:" and add the lbretroshare line */
/* Using newlines (\n) allows us to display both without modifying the .ui grid layout */
ui.label_3->setText(tr("RetroShare version:") + "\n" + tr("libretroshare version:"));
QString versionText = RsApplication::retroshareVersion(true);
versionText += "\n";
versionText += QString::fromUtf8(RsInit::libRetroShareVersion());
ui.version->setText(versionText);
std::list<RsPgpId> ids;
ids.clear();
@ -122,7 +128,6 @@ void CryptoPage::showEvent ( QShowEvent * /*event*/ )
ui.friendsEdit->setText(QString::number(friends));
QString string ;
string = rsFiles->getPartialsDirectory().c_str();
QString datadir = string;
@ -135,7 +140,6 @@ void CryptoPage::showEvent ( QShowEvent * /*event*/ )
load() ;
}
CryptoPage::~CryptoPage()
{
}

View file

@ -271,7 +271,7 @@
</size>
</property>
<property name="text">
<string>PGP Id :</string>
<string>PGP Id:</string>
</property>
</widget>
</item>

Some files were not shown because too many files have changed in this diff Show more