mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-05 12:51:08 -05:00
fixed open file, removed file action menu (already handled by the system), fixed the update of message icon when there is a new message
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@2633 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b623f0d427
commit
d4e50d09ab
@ -111,8 +111,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
/* Invoke the Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
updateToolBaricons();
|
||||
|
||||
/* Create RshareSettings object */
|
||||
_settings = new RshareSettings();
|
||||
|
||||
@ -183,7 +181,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
|
||||
ui.stackPages->add(messagesDialog = new MessagesDialog(ui.stackPages),
|
||||
createPageAction(QIcon(MessageIcon), tr("Messages"), grp));
|
||||
messageAction = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
|
||||
|
||||
#ifndef RS_RELEASE_VERSION
|
||||
ChannelFeed *channelFeed = NULL;
|
||||
@ -332,59 +330,59 @@ void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
|
||||
void MainWindow::updateStatus()
|
||||
{
|
||||
|
||||
if (ratesstatus)
|
||||
ratesstatus->getRatesStatus();
|
||||
if (ratesstatus)
|
||||
ratesstatus->getRatesStatus();
|
||||
|
||||
if (peerstatus)
|
||||
peerstatus->getPeerStatus();
|
||||
if (peerstatus)
|
||||
peerstatus->getPeerStatus();
|
||||
|
||||
if (natstatus)
|
||||
natstatus->getNATStatus();
|
||||
if (natstatus)
|
||||
natstatus->getNATStatus();
|
||||
|
||||
std::list<std::string> ids;
|
||||
rsPeers->getOnlineList(ids);
|
||||
int online = ids.size();
|
||||
|
||||
std::list<MsgInfoSummary> msgList;
|
||||
std::list<MsgInfoSummary>::const_iterator it;
|
||||
std::list<std::string> ids;
|
||||
rsPeers->getOnlineList(ids);
|
||||
int online = ids.size();
|
||||
|
||||
rsMsgs -> getMessageSummaries(msgList);
|
||||
|
||||
for(it = msgList.begin(); it != msgList.end(); it++)
|
||||
{
|
||||
|
||||
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_INBOX && ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW))
|
||||
{
|
||||
trayIcon->setIcon(QIcon(":/images/newmsg.png"));
|
||||
trayIcon->setToolTip(tr("RetroShare") + "\n" + tr("You has a new message"));
|
||||
}
|
||||
else if (online == 0)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else if (online < 2)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_ONEONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else if (online < 3)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_TWOONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_RETROSHARE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
std::list<MsgInfoSummary> msgList;
|
||||
std::list<MsgInfoSummary>::const_iterator it;
|
||||
|
||||
rsMsgs -> getMessageSummaries(msgList);
|
||||
bool new_msg = false ;
|
||||
|
||||
for(it = msgList.begin(); it != msgList.end(); it++)
|
||||
if ((it -> msgflags & RS_MSG_BOXMASK) == RS_MSG_INBOX && ((it -> msgflags & RS_MSG_NEW) == RS_MSG_NEW))
|
||||
new_msg = true ;
|
||||
|
||||
if(new_msg)
|
||||
messageAction->setIcon(QIcon(QPixmap(":/images/messages_new.png"))) ;
|
||||
else
|
||||
messageAction->setIcon(QIcon(QPixmap(":/images/evolution.png"))) ;
|
||||
|
||||
if(new_msg)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(":/images/newmsg.png"));
|
||||
trayIcon->setToolTip(tr("RetroShare") + "\n" + tr("You has a new message"));
|
||||
}
|
||||
else if (online == 0)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else if (online < 2)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_ONEONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else if (online < 3)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_TWOONLINE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
else
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_RETROSHARE));
|
||||
trayIcon->setToolTip(tr("RetroShare"));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateHashingInfo(const QString& s)
|
||||
@ -672,25 +670,4 @@ void MainWindow::setStyle()
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::updateToolBaricons()
|
||||
{
|
||||
std::list<MsgInfoSummary> msgList;
|
||||
std::list<MsgInfoSummary>::const_iterator it;
|
||||
|
||||
rsMsgs -> getMessageSummaries(msgList);
|
||||
|
||||
for(it = msgList.begin(); it != msgList.end(); it++)
|
||||
{
|
||||
|
||||
if (it -> msgflags & RS_MSG_NEW)
|
||||
{
|
||||
MessageIcon.addPixmap(QPixmap(":/images/messages_new.png"), QIcon::Normal, QIcon::On );
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageIcon.addPixmap(QPixmap(":/images/evolution.png"), QIcon::Normal, QIcon::On );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -105,8 +105,6 @@ public slots:
|
||||
void updateHashingInfo(const QString&) ;
|
||||
void displayErrorMessage(int,int,const QString&) ;
|
||||
|
||||
void updateToolBaricons();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
||||
@ -190,7 +188,7 @@ private:
|
||||
|
||||
QLabel *_hashing_info_label ;
|
||||
|
||||
QIcon MessageIcon;
|
||||
QAction *messageAction ;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MainWindow ui;
|
||||
|
@ -1021,7 +1021,8 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
|
||||
std::list<DirDetails>::iterator it;
|
||||
getFileInfoFromIndexList(qmil, files_info);
|
||||
|
||||
for (it = files_info.begin(); it != files_info.end(); it++) {
|
||||
for (it = files_info.begin(); it != files_info.end(); it++)
|
||||
{
|
||||
if ((*it).type & DIR_TYPE_PERSON) continue;
|
||||
|
||||
std::string fullpath, name;
|
||||
@ -1035,25 +1036,19 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
|
||||
name = fullpath;
|
||||
}
|
||||
|
||||
if (!openFolder) {
|
||||
if ((*it).type & DIR_TYPE_FILE) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(name.c_str()));
|
||||
}
|
||||
} else {
|
||||
if (dirs_to_open.end() == std::find(dirs_to_open.begin(), dirs_to_open.end(), fullpath)) {
|
||||
dirs_to_open.push_back(fullpath);
|
||||
}
|
||||
}
|
||||
std::cerr << "Opennign this file: " << name << std::endl ;
|
||||
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8(name.c_str(),name.length())));
|
||||
}
|
||||
|
||||
if (openFolder) {
|
||||
std::list<std::string>::iterator dit;
|
||||
for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++)
|
||||
{
|
||||
std::cerr << "Opennign this folder: " << (*dit).c_str() << std::endl ;
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile((*dit).c_str()));
|
||||
}
|
||||
}
|
||||
// if (openFolder) {
|
||||
// std::list<std::string>::iterator dit;
|
||||
// for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++)
|
||||
// {
|
||||
// std::cerr << "Opennign this folder: " << (*dit).c_str() << std::endl ;
|
||||
// QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8((*dit).c_str())));
|
||||
// }
|
||||
// }
|
||||
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "::::::::::::Done RemoteDirModel::openSelected()" << std::endl;
|
||||
|
@ -613,7 +613,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
QMenu contextMnu2( this );
|
||||
//
|
||||
|
||||
QAction* menuAction = fileAssotiationAction(currentFile) ;
|
||||
// QAction* menuAction = fileAssotiationAction(currentFile) ;
|
||||
//new QAction(QIcon(IMAGE_PLAY), currentFile, this);
|
||||
//tr( "111Play File(s)" ), this );
|
||||
// connect( openfolderAct , SIGNAL( triggered() ), this,
|
||||
@ -684,7 +684,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
contextMnu2.addAction( openfolderAct);
|
||||
else
|
||||
{
|
||||
contextMnu2.addAction( menuAction );
|
||||
// contextMnu2.addAction( menuAction );
|
||||
contextMnu2.addAction( openfileAct);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user