diff --git a/retroshare-gui/src/gui/GenCertDialog.cpp b/retroshare-gui/src/gui/GenCertDialog.cpp index 70d8463ba..b2923d87f 100644 --- a/retroshare-gui/src/gui/GenCertDialog.cpp +++ b/retroshare-gui/src/gui/GenCertDialog.cpp @@ -178,18 +178,18 @@ void GenCertDialog::init() ui.genPGPuser->clear() ; - std::list pgpIds; - std::list::iterator it; + std::list pgpIds; + std::list::iterator it; bool foundGPGKeys = false; if (!mOnlyGenerateIdentity) { if (RsAccounts::GetPGPLogins(pgpIds)) { for(it = pgpIds.begin(); it != pgpIds.end(); it++) { - QVariant userData(QString::fromStdString(*it)); + QVariant userData(QString::fromStdString( (*it).toStdString() )); std::string name, email; RsAccounts::GetPGPLoginDetails(*it, name, email); std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl; - QString gid = QString::fromStdString(*it).right(8) ; + QString gid = QString::fromStdString( (*it).toStdString()).right(8) ; ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData); foundGPGKeys = true; } @@ -310,7 +310,7 @@ void GenCertDialog::exportIdentity() return ; QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex()); - std::string gpg_id = data.toString().toStdString() ; + PGPIdType gpg_id (data.toString().toStdString()) ; if(RsAccounts::ExportIdentity(fname.toStdString(),gpg_id)) QMessageBox::information(this,tr("Identity saved"),tr("Your identity was successfully saved\nIt is encrypted\n\nYou can now copy it to another computer\nand use the import button to load it")) ; @@ -325,7 +325,7 @@ void GenCertDialog::importIdentity() if(fname.isNull()) return ; - std::string gpg_id ; + PGPIdType gpg_id ; std::string err_string ; if(!RsAccounts::ImportIdentity(fname.toStdString(),gpg_id,err_string)) @@ -340,7 +340,7 @@ void GenCertDialog::importIdentity() RsAccounts::GetPGPLoginDetails(gpg_id, name, email); std::cerr << "Adding PGPUser: " << name << " id: " << gpg_id << std::endl; - QMessageBox::information(this,tr("New identity imported"),tr("Your identity was imported successfully:")+" \n"+"\nName :"+QString::fromStdString(name)+"\nemail: " + QString::fromStdString(email)+"\nKey ID: "+QString::fromStdString(gpg_id)+"\n\n"+tr("You can use it now to create a new location.")) ; + QMessageBox::information(this,tr("New identity imported"),tr("Your identity was imported successfully:")+" \n"+"\nName :"+QString::fromStdString(name)+"\nemail: " + QString::fromStdString(email)+"\nKey ID: "+QString::fromStdString(gpg_id.toStdString())+"\n\n"+tr("You can use it now to create a new location.")) ; } init() ; @@ -350,7 +350,7 @@ void GenCertDialog::genPerson() { /* Check the data from the GUI. */ std::string genLoc = ui.location_input->text().toUtf8().constData(); - std::string PGPId; + PGPIdType PGPId; bool isHiddenLoc = false; if (ui.hidden_checkbox->isChecked()) @@ -389,7 +389,7 @@ void GenCertDialog::genPerson() return; } QVariant data = ui.genPGPuser->itemData(pgpidx); - PGPId = (data.toString()).toStdString(); + PGPId = PGPIdType((data.toString()).toStdString()); } else { if (ui.password_input->text().length() < 3 || ui.name_input->text().length() < 3 || genLoc.length() < 3) { /* Message Dialog */ @@ -446,7 +446,7 @@ void GenCertDialog::genPerson() /* GenerateSSLCertificate - selects the PGP Account */ //RsInit::SelectGPGAccount(PGPId); - std::string sslId; + RsPeerId sslId; std::cerr << "GenCertDialog::genPerson() Generating SSL cert with gpg id : " << PGPId << std::endl; std::string err; bool okGen = RsAccounts::GenerateSSLCertificate(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err); diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 3dc82e176..4e764a39d 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -203,7 +203,7 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ ) QMenu *contextMnu = new QMenu; - std::string peer_id = wi->text(COLUMN_PEERID).toStdString() ; + PGPIdType peer_id(wi->text(COLUMN_PEERID).toStdString()) ; // That's what context menus are made for RsPeerDetails detail; @@ -231,17 +231,17 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ ) void NetworkDialog::removeUnusedKeys() { - std::list pre_selected ; - std::list ids ; + std::list pre_selected ; + std::list ids ; rsPeers->getGPGAllList(ids) ; RsPeerDetails details ; time_t now = time(NULL) ; time_t THREE_MONTHS = 3*31*24*60*60 ;//3*DayPerMonth*HoursPerDay*MinPerHour*SecPerMin - for(std::list::const_iterator it(ids.begin());it!=ids.end();++it) + for(std::list::const_iterator it(ids.begin());it!=ids.end();++it) { - rsPeers->getPeerDetails(*it,details) ; + rsPeers->getGPGDetails(*it,details) ; if(rsPeers->haveSecretKey(*it)) { @@ -255,13 +255,13 @@ void NetworkDialog::removeUnusedKeys() } } - std::list selected = FriendSelectionDialog::selectFriends(NULL, + std::list selected = FriendSelectionDialog::selectFriends(NULL, tr("Clean keyring"), tr("The selected keys below haven't been used in the last 3 months. \nDo you want to delete them permanently ? \n\nNotes: Your old keyring will be backed up.\n The removal may fail when running multiple Retroshare instances on the same machine."),FriendSelectionWidget::MODUS_CHECK,FriendSelectionWidget::SHOW_GPG | FriendSelectionWidget::SHOW_NON_FRIEND_GPG, FriendSelectionWidget::IDTYPE_GPG, pre_selected) ; std::cerr << "Removing these keys from the keyring: " << std::endl; - for(std::list::const_iterator it(selected.begin());it!=selected.end();++it) + for(std::list::const_iterator it(selected.begin());it!=selected.end();++it) std::cerr << " " << *it << std::endl; std::string backup_file ; @@ -298,7 +298,7 @@ void NetworkDialog::removeUnusedKeys() void NetworkDialog::denyFriend() { QTreeWidgetItem *wi = getCurrentNeighbour(); - std::string peer_id = wi->text(COLUMN_PEERID).toStdString() ; + PGPIdType peer_id( wi->text(COLUMN_PEERID).toStdString() ); rsPeers->removeFriend(peer_id) ; securedUpdateDisplay(); @@ -364,12 +364,12 @@ void NetworkDialog::sendDistantMessage() return; } - std::string hash ; - std::string mGpgId = wi->text(COLUMN_PEERID).toStdString() ; + Sha1CheckSum hash ; + PGPIdType mGpgId(wi->text(COLUMN_PEERID).toStdString()) ; if(rsMsgs->getDistantMessageHash(mGpgId,hash)) { - nMsgDialog->addRecipient(MessageComposer::TO, hash, mGpgId); + nMsgDialog->addRecipient(MessageComposer::TO, hash.toStdString(), mGpgId.toStdString()); nMsgDialog->show(); nMsgDialog->activateWindow(); } @@ -397,8 +397,8 @@ void NetworkDialog::insertConnect() // // last_time = now ; - std::list neighs; //these are GPG ids - std::list::iterator it; + std::list neighs; //these are GPG ids + std::list::iterator it; rsPeers->getGPGAllList(neighs); /* get a link to the table */ @@ -408,7 +408,7 @@ void NetworkDialog::insertConnect() int index = 0; while (index < connectWidget->topLevelItemCount()) { - std::string gpg_widget_id = (connectWidget->topLevelItem(index))->text(COLUMN_PEERID).toStdString(); + PGPIdType gpg_widget_id( (connectWidget->topLevelItem(index))->text(COLUMN_PEERID).toStdString() ); RsPeerDetails detail; if ( (!rsPeers->getGPGDetails(gpg_widget_id, detail)) || (ui.onlyTrustedKeys->isChecked() && (detail.validLvl < RS_TRUST_LVL_MARGINAL && !detail.accept_connection))) delete (connectWidget->takeTopLevelItem(index)); @@ -435,7 +435,7 @@ void NetworkDialog::insertConnect() /* make a widget per friend */ QTreeWidgetItem *item; - QList list = connectWidget->findItems(QString::fromStdString(*it), Qt::MatchExactly, COLUMN_PEERID); + QList list = connectWidget->findItems(QString::fromStdString( (*it).toStdString() ), Qt::MatchExactly, COLUMN_PEERID); if (list.size() == 1) { item = list.front(); } else { @@ -451,7 +451,7 @@ void NetworkDialog::insertConnect() item -> setText(COLUMN_PEERNAME, QString::fromUtf8(detail.name.c_str())); /* (4) key id */ - item -> setText(COLUMN_PEERID, QString::fromStdString(detail.id)); + item -> setText(COLUMN_PEERID, QString::fromStdString(detail.id.toStdString())); } //QString TrustLevelString ; @@ -548,7 +548,7 @@ void NetworkDialog::insertConnect() rsPeers->getGPGDetails(rsPeers->getGPGOwnId(), ownGPGDetails); /* make a widget per friend */ QTreeWidgetItem *self_item; - QList list = connectWidget->findItems(QString::fromStdString(ownGPGDetails.gpg_id), Qt::MatchExactly, COLUMN_PEERID); + QList list = connectWidget->findItems(QString::fromStdString(ownGPGDetails.gpg_id.toStdString()), Qt::MatchExactly, COLUMN_PEERID); if (list.size() == 1) { self_item = list.front(); } else { @@ -559,7 +559,7 @@ void NetworkDialog::insertConnect() self_item->setIcon(COLUMN_CHECK,(QIcon(IMAGE_AUTHED))); self_item->setText(COLUMN_PEERNAME, QString::fromUtf8(ownGPGDetails.name.c_str()) + " (" + tr("yourself") + ")"); self_item->setText(COLUMN_I_AUTH_PEER,"N/A"); - self_item->setText(COLUMN_PEERID, QString::fromStdString(ownGPGDetails.id)); + self_item->setText(COLUMN_PEERID, QString::fromStdString(ownGPGDetails.id.toStdString())); // Color each Background column in the Network Tab except the first one => 1-9 for(int i=0;igetOwnId(); + RsPeerId ownId = rsPeers->getOwnId(); if (!rsPeers->getPeerDetails(ownId, detail)) { diff --git a/retroshare-gui/src/gui/StartDialog.cpp b/retroshare-gui/src/gui/StartDialog.cpp index 8a1e2dc67..516add40f 100644 --- a/retroshare-gui/src/gui/StartDialog.cpp +++ b/retroshare-gui/src/gui/StartDialog.cpp @@ -45,9 +45,9 @@ StartDialog::StartDialog(QWidget *parent) /* get all available pgp private certificates.... * mark last one as default. */ - std::list accountIds; - std::list::iterator it; - std::string preferedId; + std::list accountIds; + std::list::iterator it; + RsPeerId preferedId; RsAccounts::GetPreferredAccountId(preferedId); int pidx = -1; int i; @@ -56,10 +56,11 @@ StartDialog::StartDialog(QWidget *parent) { for(it = accountIds.begin(), i = 0; it != accountIds.end(); it++, i++) { - const QVariant & userData = QVariant(QString::fromStdString(*it)); - std::string gpgid, name, email, location; + const QVariant & userData = QVariant(QString::fromStdString((*it).toStdString())); + PGPIdType gpgid ; + std::string name, email, location; RsAccounts::GetAccountDetails(*it, gpgid, name, email, location); - QString accountName = QString::fromUtf8(name.c_str()) + " (" + QString::fromStdString(gpgid).right(8) + ") - " + QString::fromUtf8(location.c_str()); + QString accountName = QString::fromUtf8(name.c_str()) + " (" + QString::fromStdString(gpgid.toStdString()).right(8) + ") - " + QString::fromUtf8(location.c_str()); ui.loadName->addItem(accountName, userData); if (preferedId == *it) @@ -84,8 +85,6 @@ void StartDialog::closeEvent (QCloseEvent * event) void StartDialog::loadPerson() { - std::string accountId = ""; - int pgpidx = ui.loadName->currentIndex(); if (pgpidx < 0) { @@ -95,7 +94,7 @@ void StartDialog::loadPerson() } QVariant data = ui.loadName->itemData(pgpidx); - accountId = (data.toString()).toStdString(); + RsPeerId accountId = RsPeerId((data.toString()).toStdString()); if (Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked())) { accept(); diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index 7801780f1..90747b1c9 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -526,7 +526,7 @@ void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::listgetOwnId(); + RsPeerId id = rsPeers->getOwnId(); uint pos = 0; @@ -937,25 +937,25 @@ void NotifyQt::testToaster(uint notifyFlags, /*RshareSettings::enumToasterPositi toaster = new Toaster(new MessageToaster(std::string(), tr("Unknown title"), QString("[%1]").arg(tr("Encrypted message")))); break; case RS_POPUP_MSG: - toaster = new Toaster(new MessageToaster(id, title, message)); + toaster = new Toaster(new MessageToaster(id.toStdString(), title, message)); break; case RS_POPUP_CONNECT: - toaster = new Toaster(new OnlineToaster(id)); + toaster = new Toaster(new OnlineToaster(id.toStdString())); break; case RS_POPUP_DOWNLOAD: - toaster = new Toaster(new DownloadToaster(id, title)); + toaster = new Toaster(new DownloadToaster(id.toStdString(), title)); break; case RS_POPUP_CHAT: - toaster = new Toaster(new ChatToaster(id, message)); + toaster = new Toaster(new ChatToaster(id.toStdString(), message)); break; case RS_POPUP_GROUPCHAT: - toaster = new Toaster(new GroupChatToaster(id, message)); + toaster = new Toaster(new GroupChatToaster(id.toStdString(), message)); break; case RS_POPUP_CHATLOBBY: - toaster = new Toaster(new ChatLobbyToaster(id, title, message)); + toaster = new Toaster(new ChatLobbyToaster(id.toStdString(), title, message)); break; case RS_POPUP_CONNECT_ATTEMPT: - toaster = new Toaster(new FriendRequestToaster(id, title, id)); + toaster = new Toaster(new FriendRequestToaster(id.toStdString(), title, id.toStdString())); break; } diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index 889069eab..4061a8f33 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -19,14 +19,14 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ -#error "******************************************************************************************************************" -#error "**** Retroshare trunk/ is currently being merged to v0.6 and protocols are not stable. It is unlikely that *****" -#error "**** you want to compile the trunk now. *****" -#error "**** *****" -#error "**** To compile the latest Retroshare 0.5.5, please go to branches/v0.5.5 *****" -#error "**** *****" -#error "**** --- The dev team --- *****" -#error "******************************************************************************************************************" +//#error "******************************************************************************************************************" +//#error "**** Retroshare trunk/ is currently being merged to v0.6 and protocols are not stable. It is unlikely that *****" +//#error "**** you want to compile the trunk now. *****" +//#error "**** *****" +//#error "**** To compile the latest Retroshare 0.5.5, please go to branches/v0.5.5 *****" +//#error "**** *****" +//#error "**** --- The dev team --- *****" +//#error "******************************************************************************************************************" #include #include @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) /* Login Dialog */ /* check for existing Certificate */ bool genCert = false; - std::list accountIds; + std::list accountIds; if (RsAccounts::GetAccountIds(accountIds) && (accountIds.size() > 0)) { StartDialog sd; @@ -296,7 +296,7 @@ int main(int argc, char *argv[]) splashScreen.show(); splashScreen.showMessage(rshare.translate("SplashScreen", "Load profile"), Qt::AlignHCenter | Qt::AlignBottom); - std::string preferredId; + RsPeerId preferredId; RsAccounts::GetPreferredAccountId(preferredId); // true: note auto-login is active diff --git a/retroshare-gui/src/rshare.cpp b/retroshare-gui/src/rshare.cpp index 2ae079903..eab0e7664 100644 --- a/retroshare-gui/src/rshare.cpp +++ b/retroshare-gui/src/rshare.cpp @@ -606,7 +606,7 @@ void Rshare::blinkTimer() } } -bool Rshare::loadCertificate(const std::string &accountId, bool autoLogin) +bool Rshare::loadCertificate(const RsPeerId &accountId, bool autoLogin) { if (!RsAccounts::SelectAccount(accountId)) { diff --git a/retroshare-gui/src/rshare.h b/retroshare-gui/src/rshare.h index 4368e9ade..ee04b7686 100644 --- a/retroshare-gui/src/rshare.h +++ b/retroshare-gui/src/rshare.h @@ -36,6 +36,7 @@ #include #include "util/log.h" +#include "retroshare/rstypes.h" /** Rshare's version string */ #define RSHARE_VERSION "0.7" @@ -89,7 +90,7 @@ public: /** Recalculates matching stylesheet for widget **/ static void refreshStyleSheet(QWidget *widget, bool processChildren); - static bool loadCertificate(const std::string &accountId, bool autoLogin); + static bool loadCertificate(const RsPeerId &accountId, bool autoLogin); /** * Update Language, Style and StyleSheet.