add location to account detail at startup, and improve the peersdialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2075 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-18 22:44:09 +00:00
parent 5f27d75dc4
commit ac580a6c07
10 changed files with 548 additions and 808 deletions

View File

@ -2239,7 +2239,7 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
// Not dependent on sslroot. load, and detroys the X509 memory. // Not dependent on sslroot. load, and detroys the X509 memory.
int LoadCheckX509andGetName(const char *cert_file, std::string &userName, std::string &userId) int LoadCheckX509andGetLocation(const char *cert_file, std::string &location, std::string &userId)
{ {
/* This function loads the X509 certificate from the file, /* This function loads the X509 certificate from the file,
* and checks the certificate * and checks the certificate
@ -2270,7 +2270,7 @@ int LoadCheckX509andGetName(const char *cert_file, std::string &userName, std::s
if (valid) if (valid)
{ {
// extract the name. // extract the name.
userName = getX509CNString(x509->cert_info->subject); location = getX509LocString(x509->cert_info->subject);
} }
std::cout << getX509Info(x509) << std::endl ; std::cout << getX509Info(x509) << std::endl ;

View File

@ -236,7 +236,7 @@ bool getX509id(X509 *x509, std::string &xid);
int LoadCheckX509andGetIssuerName(const char *cert_file, int LoadCheckX509andGetIssuerName(const char *cert_file,
std::string &issuerName, std::string &userId); std::string &issuerName, std::string &userId);
int LoadCheckX509andGetName(const char *cert_file, int LoadCheckX509andGetLocation(const char *cert_file,
std::string &userName, std::string &userId); std::string &location, std::string &userId);
#endif // MRK_AUTH_SSL_HEADER #endif // MRK_AUTH_SSL_HEADER

View File

@ -57,7 +57,7 @@ class accountId
std::string pgpEmail; std::string pgpEmail;
std::string sslId; std::string sslId;
std::string sslName; std::string location;
}; };
@ -489,7 +489,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
{ {
std::cerr << " * Preferred * " << std::endl; std::cerr << " * Preferred * " << std::endl;
userId = it->sslId; userId = it->sslId;
userName = it->sslName; userName = it->pgpName;
existingUser = true; existingUser = true;
} }
} }
@ -533,7 +533,7 @@ bool RsInit::getAccountIds(std::list<std::string> &ids)
std::cerr << "SSL Id: " << it->sslId << " PGP Id " << it->pgpId << std::cerr << "SSL Id: " << it->sslId << " PGP Id " << it->pgpId <<
std::cerr << " PGP Name: " << it->pgpName; std::cerr << " PGP Name: " << it->pgpName;
std::cerr << " PGP Email: " << it->pgpEmail; std::cerr << " PGP Email: " << it->pgpEmail;
std::cerr << " SSL Name: " << it->sslName; std::cerr << " Location: " << it->location;
std::cerr << std::endl; std::cerr << std::endl;
ids.push_back(it->sslId); ids.push_back(it->sslId);
@ -544,7 +544,7 @@ bool RsInit::getAccountIds(std::list<std::string> &ids)
bool RsInit::getAccountDetails(std::string id, bool RsInit::getAccountDetails(std::string id,
std::string &gpgId, std::string &gpgName, std::string &gpgId, std::string &gpgName,
std::string &gpgEmail, std::string &sslName) std::string &gpgEmail, std::string &location)
{ {
std::list<accountId>::iterator it; std::list<accountId>::iterator it;
for(it = RsInitConfig::accountIds.begin(); it != RsInitConfig::accountIds.end(); it++) for(it = RsInitConfig::accountIds.begin(); it != RsInitConfig::accountIds.end(); it++)
@ -554,7 +554,7 @@ bool RsInit::getAccountDetails(std::string id,
gpgId = it->pgpId; gpgId = it->pgpId;
gpgName = it->pgpName; gpgName = it->pgpName;
gpgEmail = it->pgpEmail; gpgEmail = it->pgpEmail;
sslName = it->sslName; location = it->location;
return true; return true;
} }
} }
@ -732,8 +732,8 @@ static bool checkAccount(std::string accountdir, accountId &id)
bool ret = false; bool ret = false;
/* check against authmanagers private keys */ /* check against authmanagers private keys */
LoadCheckX509andGetName(cert_name.c_str(), id.sslName, id.sslId); LoadCheckX509andGetLocation(cert_name.c_str(), id.location, id.sslId);
std::cerr << "sslName: " << id.sslName << " id: " << id.sslId << std::endl; std::cerr << "location: " << id.location << " id: " << id.sslId << std::endl;
std::string tmpid; std::string tmpid;
if (LoadCheckX509andGetIssuerName(cert_name.c_str(), id.pgpId, tmpid)) if (LoadCheckX509andGetIssuerName(cert_name.c_str(), id.pgpId, tmpid))
@ -949,10 +949,10 @@ bool RsInit::GenerateSSLCertificate(std::string gpg_id, std::string org, std
/* try to load it, and get Id */ /* try to load it, and get Id */
std::string sslName; std::string location;
int ret = 0; int ret = 0;
ret = LoadCheckX509andGetName(cert_name.c_str(), sslName, sslId); ret = LoadCheckX509andGetLocation(cert_name.c_str(), location, sslId);
/* Move directory to correct id */ /* Move directory to correct id */
std::string finalbase = RsInitConfig::basedir + RsInitConfig::dirSeperator + sslId + RsInitConfig::dirSeperator; std::string finalbase = RsInitConfig::basedir + RsInitConfig::dirSeperator + sslId + RsInitConfig::dirSeperator;

View File

@ -181,22 +181,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
LinksDialog *linksDialog = NULL; LinksDialog *linksDialog = NULL;
#ifdef RS_RELEASE_VERSION
ChannelFeed *channelFeed = NULL;
ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages),
createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
ForumsDialog *forumsDialog = NULL;
ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp));
ui.stackPages->add(linksDialog = new LinksDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_LINKS), tr("Links Cloud"), grp));
#else
ChannelFeed *channelFeed = NULL; ChannelFeed *channelFeed = NULL;
ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages), ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages),
createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp)); createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
@ -208,7 +192,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages), ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp));
#endif
NewsFeed *newsFeed = NULL; NewsFeed *newsFeed = NULL;
ui.stackPages->add(newsFeed = new NewsFeed(ui.stackPages), ui.stackPages->add(newsFeed = new NewsFeed(ui.stackPages),
createPageAction(QIcon(IMAGE_NEWSFEED), tr("News Feed"), grp)); createPageAction(QIcon(IMAGE_NEWSFEED), tr("News Feed"), grp));

View File

@ -22,6 +22,7 @@
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include "common/vmessagebox.h" #include "common/vmessagebox.h"
#include <gui/mainpagestack.h>
#include "rshare.h" #include "rshare.h"
#include "PeersDialog.h" #include "PeersDialog.h"
@ -96,6 +97,7 @@ PeersDialog::PeersDialog(QWidget *parent)
last_status_send_time = 0 ; last_status_send_time = 0 ;
connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) ); connect( ui.peertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peertreeWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend())); connect( ui.peertreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend()));
@ -104,6 +106,7 @@ PeersDialog::PeersDialog(QWidget *parent)
connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar())); connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar()));
connect( ui.actionSet_your_Personal_Message, SIGNAL(triggered()), this, SLOT(statusmessage())); connect( ui.actionSet_your_Personal_Message, SIGNAL(triggered()), this, SLOT(statusmessage()));
ui.peertabWidget->setTabPosition(QTabWidget::West);
ui.peertabWidget->addTab(new ProfileWidget(),QString(tr("Profile"))); ui.peertabWidget->addTab(new ProfileWidget(),QString(tr("Profile")));
ui.peertreeWidget->setColumnCount(4); ui.peertreeWidget->setColumnCount(4);
@ -127,7 +130,6 @@ PeersDialog::PeersDialog(QWidget *parent)
headerItem->setTextAlignment(1, Qt::AlignLeft | Qt::AlignVCenter); headerItem->setTextAlignment(1, Qt::AlignLeft | Qt::AlignVCenter);
headerItem->setTextAlignment(2, Qt::AlignHCenter | Qt::AlignVCenter); headerItem->setTextAlignment(2, Qt::AlignHCenter | Qt::AlignVCenter);
loadtabsettings();
loadEmoticonsgroupchat(); loadEmoticonsgroupchat();
connect(ui.lineEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) )); connect(ui.lineEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) ));
@ -175,9 +177,7 @@ PeersDialog::PeersDialog(QWidget *parent)
timer->start(500); /* half a second */ timer->start(500); /* half a second */
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
menu->addAction(ui.actionAdd_Friend); menu->addAction(ui.actionAdd_Friend);
menu->addSeparator();
menu->addAction(ui.actionCreate_new_Profile);
menu->addSeparator(); menu->addSeparator();
menu->addAction(ui.actionCreate_New_Forum); menu->addAction(ui.actionCreate_New_Forum);
menu->addAction(ui.actionCreate_New_Channel); menu->addAction(ui.actionCreate_New_Channel);
@ -186,21 +186,6 @@ PeersDialog::PeersDialog(QWidget *parent)
ui.menupushButton->setMenu(menu); ui.menupushButton->setMenu(menu);
QMenu *lookmenu = new QMenu();
lookmenu->addAction(ui.actionSort_Status_Descending_Order);
lookmenu->addAction(ui.actionSort_Status_Ascending_Order);
lookmenu->addSeparator();
lookmenu->addAction(ui.actionSet_Tabs_Right);
lookmenu->addAction(ui.actionSet_Tabs_Left);
lookmenu->addAction(ui.actionSet_Tabs_North);
lookmenu->addAction(ui.actionSet_Tabs_South);
lookmenu->addSeparator();
lookmenu->addAction(ui.actionSet_Tabs_Triangular);
lookmenu->addAction(ui.actionSet_Tabs_Rounded);
ui.lookpushButton->setMenu(lookmenu);
updateAvatar(); updateAvatar();
loadmypersonalstatus(); loadmypersonalstatus();
@ -1417,15 +1402,9 @@ void PeersDialog::on_actionAdd_Friend_activated()
connectwiz->show(); connectwiz->show();
} }
void PeersDialog::on_actionCreate_new_Profile_activated()
{
static GenCertDialog *gencertdialog = new GenCertDialog();
gencertdialog->show();
}
void PeersDialog::on_actionCreate_New_Forum_activated() void PeersDialog::on_actionCreate_New_Forum_activated()
{ {
((MainPageStack*)this->parent())->setCurrentIndex(8); // swtich to forum view
static CreateForum *cf = new CreateForum(this); static CreateForum *cf = new CreateForum(this);
cf->show(); cf->show();
@ -1434,6 +1413,7 @@ void PeersDialog::on_actionCreate_New_Forum_activated()
void PeersDialog::on_actionCreate_New_Channel_activated() void PeersDialog::on_actionCreate_New_Channel_activated()
{ {
CreateForum *cf = new CreateForum(NULL, false); CreateForum *cf = new CreateForum(NULL, false);
((MainPageStack*)this->parent())->setCurrentIndex(6); // swtich to forum view
cf->setWindowTitle(tr("Create a new Channel")); cf->setWindowTitle(tr("Create a new Channel"));
cf->ui.labelicon->setPixmap(QPixmap(":/images/add_channel64.png")); cf->ui.labelicon->setPixmap(QPixmap(":/images/add_channel64.png"));
@ -1456,84 +1436,3 @@ void PeersDialog::statusmessage()
static StatusMessage *statusmsgdialog = new StatusMessage(); static StatusMessage *statusmsgdialog = new StatusMessage();
statusmsgdialog->show(); statusmsgdialog->show();
} }
void PeersDialog::on_actionSet_Tabs_North_activated()
{
_settings->beginGroup("PeersDialog");
ui.peertabWidget->setTabPosition(QTabWidget::North);
_settings->setValue("TabWidget_Position",ui.peertabWidget->tabPosition());
_settings->endGroup();
}
void PeersDialog::on_actionSet_Tabs_South_activated()
{
_settings->beginGroup("PeersDialog");
ui.peertabWidget->setTabPosition(QTabWidget::South);
_settings->setValue("TabWidget_Position",ui.peertabWidget->tabPosition());
_settings->endGroup();
}
void PeersDialog::on_actionSet_Tabs_Left_activated()
{
_settings->beginGroup("PeersDialog");
ui.peertabWidget->setTabPosition(QTabWidget::West);
_settings->setValue("TabWidget_Position",ui.peertabWidget->tabPosition());
_settings->endGroup();
}
void PeersDialog::on_actionSet_Tabs_Right_activated()
{
_settings->beginGroup("PeersDialog");
ui.peertabWidget->setTabPosition(QTabWidget::East);
_settings->setValue("TabWidget_Position",ui.peertabWidget->tabPosition());
_settings->endGroup();
}
void PeersDialog::on_actionSet_Tabs_Triangular_activated()
{
ui.peertabWidget->setTabShape(QTabWidget::Triangular);
}
void PeersDialog::on_actionSet_Tabs_Rounded_activated()
{
ui.peertabWidget->setTabShape(QTabWidget::Rounded);
}
void PeersDialog::loadtabsettings()
{
_settings->beginGroup("PeersDialog");
if(_settings->value("TabWidget_Position","0").toInt() == 0)
{
qDebug() << "Tab North";
ui.peertabWidget->setTabPosition(QTabWidget::North);
}
else if (_settings->value("TabWidget_Position","1").toInt() == 1)
{
qDebug() << "Tab South";
ui.peertabWidget->setTabPosition(QTabWidget::South);
}
else if (_settings->value("TabWidget_Position","2").toInt() ==2)
{
qDebug() << "Tab West";
ui.peertabWidget->setTabPosition(QTabWidget::West);
}
else if(_settings->value("TabWidget_Position","3").toInt() ==3)
{
qDebug() << "Tab East";
ui.peertabWidget->setTabPosition(QTabWidget::East);
}
_settings->endGroup();
}

View File

@ -124,20 +124,10 @@ class PeersDialog : public RsAutoUpdatePage
void getAvatar(); void getAvatar();
void on_actionAdd_Friend_activated(); void on_actionAdd_Friend_activated();
void on_actionCreate_new_Profile_activated();
void on_actionCreate_New_Forum_activated(); void on_actionCreate_New_Forum_activated();
void on_actionCreate_New_Channel_activated(); void on_actionCreate_New_Channel_activated();
void loadmypersonalstatus(); void loadmypersonalstatus();
void loadtabsettings();
void on_actionSet_Tabs_Right_activated();
void on_actionSet_Tabs_North_activated();
void on_actionSet_Tabs_South_activated();
void on_actionSet_Tabs_Left_activated();
void on_actionSet_Tabs_Triangular_activated();
void on_actionSet_Tabs_Rounded_activated();
signals: signals:
void friendsUpdated() ; void friendsUpdated() ;

View File

@ -557,7 +557,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="3"> <item row="0" column="2">
<widget class="QPushButton" name="menupushButton"> <widget class="QPushButton" name="menupushButton">
<property name="toolTip"> <property name="toolTip">
<string>Add</string> <string>Add</string>
@ -598,33 +598,6 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<widget class="QPushButton" name="lookpushButton">
<property name="toolTip">
<string>Display</string>
</property>
<property name="styleSheet">
<string notr="true">QPushButton::menu-indicator {
subcontrol-origin: padding;
subcontrol-position: bottom right;
}
QPushButton:hover {
border: 1px solid #CCCCCC;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -1225,47 +1198,7 @@ background: white;}</string>
<string>Set your Personal Message</string> <string>Set your Personal Message</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Set your Personal Message</string> <string>Edit your status Message</string>
</property>
</action>
<action name="actionSet_Tabs_Right">
<property name="text">
<string>Set Tabs Right</string>
</property>
</action>
<action name="actionSet_Tabs_Left">
<property name="text">
<string>Set Tabs Left</string>
</property>
</action>
<action name="actionSet_Tabs_North">
<property name="text">
<string>Set Tabs North</string>
</property>
</action>
<action name="actionSet_Tabs_South">
<property name="text">
<string>Set Tabs South</string>
</property>
</action>
<action name="actionSet_Tabs_Triangular">
<property name="text">
<string>Set Tabs Triangular</string>
</property>
</action>
<action name="actionSet_Tabs_Rounded">
<property name="text">
<string>Set Tabs Rounded</string>
</property>
</action>
<action name="actionSort_Status_Descending_Order">
<property name="text">
<string>Sort Status Descending Order</string>
</property>
</action>
<action name="actionSort_Status_Ascending_Order">
<property name="text">
<string>Sort Status Ascending Order</string>
</property> </property>
</action> </action>
</widget> </widget>

View File

@ -75,9 +75,9 @@ StartDialog::StartDialog(QWidget *parent, Qt::WFlags flags)
for(it = accountIds.begin(), i = 0; it != accountIds.end(); it++, i++) for(it = accountIds.begin(), i = 0; it != accountIds.end(); it++, i++)
{ {
const QVariant & userData = QVariant(QString::fromStdString(*it)); const QVariant & userData = QVariant(QString::fromStdString(*it));
std::string gpgid, name, email, sslname; std::string gpgid, name, email, location;
RsInit::getAccountDetails(*it, gpgid, name, email, sslname); RsInit::getAccountDetails(*it, gpgid, name, email, location);
QString accountName = QString::fromStdString(name); QString accountName = QString::fromStdString(name) + " - " + QString::fromStdString(location);
ui.loadName->addItem(accountName, userData); ui.loadName->addItem(accountName, userData);
if (preferedId == *it) if (preferedId == *it)

View File

@ -65,8 +65,7 @@ void ProfileWidget::loadDialog()
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),detail)) if (rsPeers->getPeerDetails(rsPeers->getOwnId(),detail))
{ {
ui.name->setText(QString::fromStdString(detail.name)); ui.name->setText(QString::fromStdString(detail.name));
ui.orgloc->setText(QString::fromStdString(detail.org));
ui.country->setText(QString::fromStdString(detail.location)); ui.country->setText(QString::fromStdString(detail.location));
ui.peerid->setText(QString::fromStdString(detail.id)); ui.peerid->setText(QString::fromStdString(detail.id));
@ -74,7 +73,6 @@ void ProfileWidget::loadDialog()
// Dont Show a timestamp in RS calculate the day // Dont Show a timestamp in RS calculate the day
QDateTime date = QDateTime::fromTime_t(detail.lastConnect); QDateTime date = QDateTime::fromTime_t(detail.lastConnect);
QString stime = date.toString(Qt::LocalDate); QString stime = date.toString(Qt::LocalDate);
ui.lastcontact-> setText(stime);
/* set retroshare version */ /* set retroshare version */
std::map<std::string, std::string>::iterator vit; std::map<std::string, std::string>::iterator vit;
@ -94,7 +92,7 @@ void ProfileWidget::loadDialog()
std::list<std::string> ids; std::list<std::string> ids;
ids.clear(); ids.clear();
rsPeers->getFriendList(ids); rsPeers->getGPGAcceptedList(ids);
int friends = ids.size(); int friends = ids.size();
std::ostringstream out; std::ostringstream out;

File diff suppressed because it is too large Load Diff