fixed case insensitive sorting in Keyring, and cleanup dead code

This commit is contained in:
csoler 2019-01-06 20:58:32 +01:00
parent ba57ddfef9
commit b7340ef7ee
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
4 changed files with 15 additions and 260 deletions

View file

@ -56,32 +56,10 @@
#define IMAGE_COPYLINK ":/images/copyrslink.png"
#define IMAGE_MESSAGE ":/images/mail_new.png"
/* Images for Status icons */
//following defined in model
/*#define IMAGE_AUTHED ":/images/accepted16.png"
#define IMAGE_DENIED ":/images/denied16.png"
#define IMAGE_TRUSTED ":/images/rs-2.png" */
// Defines for key list columns
//following defined in model
/*#define COLUMN_CHECK 0
#define COLUMN_PEERNAME 1
#define COLUMN_I_AUTH_PEER 2
#define COLUMN_PEER_AUTH_ME 3
#define COLUMN_PEERID 4
#define COLUMN_LAST_USED 5
#define COLUMN_COUNT 6 */
//RsPeerId getNeighRsCertId(QTreeWidgetItem *i);
/******
* #define NET_DEBUG 1
*****/
//static const unsigned int ROLE_SORT = Qt::UserRole + 1 ;
/** Constructor */
NetworkDialog::NetworkDialog(QWidget */*parent*/)
{
@ -113,33 +91,13 @@ NetworkDialog::NetworkDialog(QWidget */*parent*/)
connect(ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) );
connect(ui.connectTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(peerdetails()));
/* Set header resize modes and initial section sizes */
/* QHeaderView * _header = ui.connectTreeWidget->header () ;
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_CHECK, QHeaderView::Custom);
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_PEERNAME, QHeaderView::Interactive);
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_I_AUTH_PEER, QHeaderView::Interactive);
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_PEER_AUTH_ME, QHeaderView::Interactive);
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_PEERID, QHeaderView::Interactive);
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_LAST_USED, QHeaderView::Interactive); */
ui.onlyTrustedKeys->setMinimumWidth(20*f);
/* QMenu *menu = new QMenu();
menu->addAction(ui.actionTabsright);
menu->addAction(ui.actionTabswest);
menu->addAction(ui.actionTabssouth);
menu->addAction(ui.actionTabsnorth);
menu->addSeparator();
menu->addAction(ui.actionTabsTriangular);
menu->addAction(ui.actionTabsRounded); */
/* add filter actions */
ui.filterLineEdit->addFilter(QIcon(), tr("Name"), COLUMN_PEERNAME, tr("Search name"));
ui.filterLineEdit->addFilter(QIcon(), tr("Peer ID"), COLUMN_PEERID, tr("Search peer ID"));
ui.filterLineEdit->setCurrentFilter(COLUMN_PEERNAME);
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), PGPIdItemProxy, SLOT(setFilterWildcard(QString)));
}
void NetworkDialog::changeEvent(QEvent *e)
@ -173,13 +131,6 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
if(!rsPeers->getGPGDetails(peer_id, detail)) // that is not suppose to fail.
return ;
// if(peer_id != rsPeers->getGPGOwnId())
// {
// if(detail.accept_connection)
// contextMnu->addAction(QIcon(IMAGE_DENIED), tr("Deny friend"), this, SLOT(denyFriend()));
// else // not a friend
// contextMnu->addAction(QIcon(IMAGE_MAKEFRIEND), tr("Make friend..."), this, SLOT(makeFriend()));
// }
if(peer_id == rsPeers->getGPGOwnId())
contextMnu->addAction(QIcon(IMAGE_EXPORT), tr("Export/create a new node"), this, SLOT(on_actionExportKey_activated()));
@ -269,21 +220,6 @@ void NetworkDialog::denyFriend()
securedUpdateDisplay();
}
/*void NetworkDialog::deleteCert()
{
#ifdef TODO
// do whatever is needed to remove the certificate completely, hopping this
// will eventually remove the signature we've stamped on it.
std::cout << "Deleting friend !" << std::endl ;
QTreeWidgetItem *wi = getCurrentNeighbour();
std::string peer_id = wi->text(9).toStdString() ;
rsPeers->deleteCertificate(peer_id) ;
securedUpdateDisplay();
#endif
}*/
void NetworkDialog::makeFriend()
{
@ -322,162 +258,10 @@ void NetworkDialog::copyLink()
RSLinkClipboard::copyLinks(urls);
}
//void NetworkDialog::sendDistantMessage()
//{
// QTreeWidgetItem *wi = getCurrentNeighbour();
// if (wi == NULL) {
// return;
// }
//
// MessageComposer *nMsgDialog = MessageComposer::newMsg();
// if (nMsgDialog == NULL) {
// return;
// }
//
// DistantMsgPeerId pid ;
// RsPgpId mGpgId(wi->text(COLUMN_PEERID).toStdString()) ;
//
// if(rsMsgs->getDistantMessagePeerId(mGpgId,pid))
// {
// nMsgDialog->addRecipient(MessageComposer::TO, pid, mGpgId);
// nMsgDialog->show();
// nMsgDialog->activateWindow();
// }
//
// /* window will destroy itself! */
//}
/* Utility Fns */
/*RsPeerId getNeighRsCertId(QTreeWidgetItem *i)
{
RsPeerId id ( (i -> text(COLUMN_PEERID)).toStdString() );
return id;
} */
void NetworkDialog::on_actionAddFriend_activated()
{
// /* Create a new input dialog, which allows users to create files, too */
// use misc::getOpenFileName
// QFileDialog dialog (this, tr("Select a pem/pqi File"));
// //dialog.setDirectory(QFileInfo(ui.lineTorConfig->text()).absoluteDir());
// //dialog.selectFile(QFileInfo(ui.lineTorConfig->text()).fileName());
// dialog.setFileMode(QFileDialog::AnyFile);
// dialog.setReadOnly(false);
//
// /* Prompt the user to select a file or create a new one */
// if (!dialog.exec() || dialog.selectedFiles().isEmpty()) {
// return;
// }
// QString filename = QDir::convertSeparators(dialog.selectedFiles().at(0));
//
// /* Check if the file exists */
// QFile torrcFile(filename);
// if (!QFileInfo(filename).exists()) {
// /* The given file does not exist. Should we create it? */
// int response = VMessageBox::question(this,
// tr("File Not Found"),
// tr("%1 does not exist. Would you like to create it?")
// .arg(filename),
// VMessageBox::Yes, VMessageBox::No);
//
// if (response == VMessageBox::No) {
// /* Don't create it. Just bail. */
// return;
// }
// /* Attempt to create the specified file */
// if (!torrcFile.open(QIODevice::WriteOnly)) {
// VMessageBox::warning(this,
// tr("Failed to Create File"),
// tr("Unable to create %1 [%2]").arg(filename)
// .arg(torrcFile.errorString()),
// VMessageBox::Ok);
// return;
// }
// }
// //ui.lineTorConfig->setText(filename);
}
void NetworkDialog::on_actionExportKey_activated()
{
ProfileManager prof ;
prof.exec() ;
}
void NetworkDialog::on_actionCreate_New_Profile_activated()
{
// GenCertDialog gencertdialog (this);
// gencertdialog.exec ();
}
// void NetworkDialog::on_actionTabsnorth_activated()
// void NetworkDialog::on_actionExportKey_activated()
// {
// ui.networkTab->setTabPosition(QTabWidget::North);
//
// Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
// }
//
// void NetworkDialog::on_actionTabssouth_activated()
// {
// ui.networkTab->setTabPosition(QTabWidget::South);
//
// Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
//
// }
//
// void NetworkDialog::on_actionTabswest_activated()
// {
// ui.networkTab->setTabPosition(QTabWidget::West);
//
// Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
// }
//
// void NetworkDialog::on_actionTabsright_activated()
// {
// ui.networkTab->setTabPosition(QTabWidget::East);
//
// Settings->setValueToGroup("NetworkDialog", "TabWidget_Position",ui.networkTab->tabPosition());
// }
//
// void NetworkDialog::on_actionTabsTriangular_activated()
// {
// ui.networkTab->setTabShape(QTabWidget::Triangular);
// ui.tabBottom->setTabShape(QTabWidget::Triangular);
// }
//
// void NetworkDialog::on_actionTabsRounded_activated()
// {
// ui.networkTab->setTabShape(QTabWidget::Rounded);
// ui.tabBottom->setTabShape(QTabWidget::Rounded);
// }
//
// void NetworkDialog::loadtabsettings()
// {
// Settings->beginGroup("NetworkDialog");
//
// if(Settings->value("TabWidget_Position","0").toInt() == 0)
// {
// qDebug() << "Tab North";
// ui.networkTab->setTabPosition(QTabWidget::North);
// }
// else if (Settings->value("TabWidget_Position","1").toInt() == 1)
// {
// qDebug() << "Tab South";
// ui.networkTab->setTabPosition(QTabWidget::South);
// }
// else if (Settings->value("TabWidget_Position","2").toInt() ==2)
// {
// qDebug() << "Tab West";
// ui.networkTab->setTabPosition(QTabWidget::West);
// }
// else if(Settings->value("TabWidget_Position","3").toInt() ==3)
// {
// qDebug() << "Tab East";
// ui.networkTab->setTabPosition(QTabWidget::East);
// }
//
// Settings->endGroup();
// ProfileManager prof ;
// prof.exec() ;
// }
void NetworkDialog::filterColumnChanged(int col)
@ -487,8 +271,6 @@ void NetworkDialog::filterColumnChanged(int col)
//filterItems(ui.filterLineEdit->text());
}
void NetworkDialog::updateDisplay()
{
if (!rsPeers)