mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 14:12:43 -04:00
load/save prefered identity for voting in posted
This commit is contained in:
parent
a498d4e370
commit
01c4534a20
2 changed files with 41 additions and 15 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include "util/qtthreadsutils.h"
|
#include "util/qtthreadsutils.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "PostedCreatePostDialog.h"
|
#include "PostedCreatePostDialog.h"
|
||||||
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "PostedItem.h"
|
#include "PostedItem.h"
|
||||||
#include "PostedCardView.h"
|
#include "PostedCardView.h"
|
||||||
#include "gui/common/UIStateHelper.h"
|
#include "gui/common/UIStateHelper.h"
|
||||||
|
@ -113,6 +114,7 @@ PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent
|
||||||
/* Initialize GUI */
|
/* Initialize GUI */
|
||||||
setGroupId(postedId);
|
setGroupId(postedId);
|
||||||
}
|
}
|
||||||
|
|
||||||
PostedListWidget::~PostedListWidget()
|
PostedListWidget::~PostedListWidget()
|
||||||
{
|
{
|
||||||
// save settings
|
// save settings
|
||||||
|
@ -147,16 +149,37 @@ void PostedListWidget::processSettings(bool load)
|
||||||
{
|
{
|
||||||
Settings->beginGroup(QString("PostedListWidget"));
|
Settings->beginGroup(QString("PostedListWidget"));
|
||||||
|
|
||||||
if (load) {
|
if (load)
|
||||||
|
{
|
||||||
// load settings
|
// load settings
|
||||||
|
|
||||||
/* View mode */
|
|
||||||
setViewMode(Settings->value("viewMode", VIEW_MODE_CLASSIC).toInt());
|
setViewMode(Settings->value("viewMode", VIEW_MODE_CLASSIC).toInt());
|
||||||
} else {
|
|
||||||
|
RsGxsId voteId(Settings->value("defaultIdentity",QString()).toString().toStdString());
|
||||||
|
|
||||||
|
if(!voteId.isNull())
|
||||||
|
ui->idChooser->setChosenId(voteId);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// save settings
|
// save settings
|
||||||
|
|
||||||
/* View mode */
|
/* View mode */
|
||||||
Settings->setValue("viewMode", viewMode());
|
Settings->setValue("viewMode", viewMode());
|
||||||
|
|
||||||
|
RsGxsId voteId;
|
||||||
|
|
||||||
|
switch (ui->idChooser->getChosenId(voteId))
|
||||||
|
{
|
||||||
|
case GxsIdChooser::KnowId:
|
||||||
|
case GxsIdChooser::UnKnowId: Settings->setValue("defaultIdentity",QString::fromStdString(voteId.toStdString()));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case GxsIdChooser::NoId:
|
||||||
|
case GxsIdChooser::None:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings->endGroup();
|
Settings->endGroup();
|
||||||
|
@ -310,10 +333,10 @@ void PostedListWidget::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
|
||||||
std::cerr << "PostedListWidget::createPost() ERROR GETTING AuthorId!, Vote Failed";
|
std::cerr << "PostedListWidget::createPost() ERROR GETTING AuthorId!, Vote Failed";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a default identity to use for voting"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}//switch (ui.idChooser->getChosenId(authorId))
|
}
|
||||||
|
|
||||||
RsGxsVote vote;
|
RsGxsVote vote;
|
||||||
|
|
||||||
|
@ -322,11 +345,10 @@ void PostedListWidget::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
|
||||||
vote.mMeta.mParentId = msgId.second;
|
vote.mMeta.mParentId = msgId.second;
|
||||||
vote.mMeta.mAuthorId = authorId;
|
vote.mMeta.mAuthorId = authorId;
|
||||||
|
|
||||||
if (up) {
|
if (up)
|
||||||
vote.mVoteType = GXS_VOTE_UP;
|
vote.mVoteType = GXS_VOTE_UP;
|
||||||
} else { //if (up)
|
else
|
||||||
vote.mVoteType = GXS_VOTE_DOWN;
|
vote.mVoteType = GXS_VOTE_DOWN;
|
||||||
}//if (up)
|
|
||||||
|
|
||||||
#ifdef DEBUG_POSTED_LIST_WIDGET
|
#ifdef DEBUG_POSTED_LIST_WIDGET
|
||||||
std::cerr << "PostedListWidget::submitVote()";
|
std::cerr << "PostedListWidget::submitVote()";
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>616</width>
|
<width>950</width>
|
||||||
<height>595</height>
|
<height>771</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -250,7 +250,11 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="GxsIdChooser" name="idChooser"/>
|
<widget class="GxsIdChooser" name="idChooser">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Default identity used when voting</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -508,7 +512,7 @@
|
||||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Description</span></p></body></html></string>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Description</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="textInteractionFlags">
|
||||||
|
@ -557,7 +561,7 @@ p, li { white-space: pre-wrap; }
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>614</width>
|
<width>98</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -613,7 +617,7 @@ p, li { white-space: pre-wrap; }
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>614</width>
|
<width>948</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -667,9 +671,9 @@ p, li { white-space: pre-wrap; }
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
<include location="Posted_images.qrc"/>
|
<include location="Posted_images.qrc"/>
|
||||||
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue