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:
csoler 2010-03-25 21:35:14 +00:00
parent b623f0d427
commit d4e50d09ab
4 changed files with 62 additions and 92 deletions

View File

@ -111,8 +111,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated QObject setup routine */ /* Invoke the Qt Designer generated QObject setup routine */
ui.setupUi(this); ui.setupUi(this);
updateToolBaricons();
/* Create RshareSettings object */ /* Create RshareSettings object */
_settings = new RshareSettings(); _settings = new RshareSettings();
@ -183,7 +181,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
ui.stackPages->add(messagesDialog = new MessagesDialog(ui.stackPages), 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 #ifndef RS_RELEASE_VERSION
ChannelFeed *channelFeed = NULL; ChannelFeed *channelFeed = NULL;
@ -332,59 +330,59 @@ void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
void MainWindow::updateStatus() void MainWindow::updateStatus()
{ {
if (ratesstatus) if (ratesstatus)
ratesstatus->getRatesStatus(); ratesstatus->getRatesStatus();
if (peerstatus) if (peerstatus)
peerstatus->getPeerStatus(); peerstatus->getPeerStatus();
if (natstatus) if (natstatus)
natstatus->getNATStatus(); natstatus->getNATStatus();
std::list<std::string> ids; std::list<std::string> ids;
rsPeers->getOnlineList(ids); rsPeers->getOnlineList(ids);
int online = ids.size(); int online = ids.size();
std::list<MsgInfoSummary> msgList;
std::list<MsgInfoSummary>::const_iterator it;
rsMsgs -> getMessageSummaries(msgList); std::list<MsgInfoSummary> msgList;
std::list<MsgInfoSummary>::const_iterator it;
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"));
}
}
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) 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 );
}
}
}

View File

@ -105,8 +105,6 @@ public slots:
void updateHashingInfo(const QString&) ; void updateHashingInfo(const QString&) ;
void displayErrorMessage(int,int,const QString&) ; void displayErrorMessage(int,int,const QString&) ;
void updateToolBaricons();
protected: protected:
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);
@ -190,7 +188,7 @@ private:
QLabel *_hashing_info_label ; QLabel *_hashing_info_label ;
QIcon MessageIcon; QAction *messageAction ;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::MainWindow ui; Ui::MainWindow ui;

View File

@ -1021,7 +1021,8 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
std::list<DirDetails>::iterator it; std::list<DirDetails>::iterator it;
getFileInfoFromIndexList(qmil, files_info); 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; if ((*it).type & DIR_TYPE_PERSON) continue;
std::string fullpath, name; std::string fullpath, name;
@ -1035,25 +1036,19 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
name = fullpath; name = fullpath;
} }
if (!openFolder) { std::cerr << "Opennign this file: " << name << std::endl ;
if ((*it).type & DIR_TYPE_FILE) {
QDesktopServices::openUrl(QUrl::fromLocalFile(name.c_str())); QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8(name.c_str(),name.length())));
}
} else {
if (dirs_to_open.end() == std::find(dirs_to_open.begin(), dirs_to_open.end(), fullpath)) {
dirs_to_open.push_back(fullpath);
}
}
} }
if (openFolder) { // if (openFolder) {
std::list<std::string>::iterator dit; // std::list<std::string>::iterator dit;
for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++) // for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++)
{ // {
std::cerr << "Opennign this folder: " << (*dit).c_str() << std::endl ; // std::cerr << "Opennign this folder: " << (*dit).c_str() << std::endl ;
QDesktopServices::openUrl(QUrl::fromLocalFile((*dit).c_str())); // QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8((*dit).c_str())));
} // }
} // }
#ifdef RDM_DEBUG #ifdef RDM_DEBUG
std::cerr << "::::::::::::Done RemoteDirModel::openSelected()" << std::endl; std::cerr << "::::::::::::Done RemoteDirModel::openSelected()" << std::endl;

View File

@ -613,7 +613,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
QMenu contextMnu2( this ); QMenu contextMnu2( this );
// //
QAction* menuAction = fileAssotiationAction(currentFile) ; // QAction* menuAction = fileAssotiationAction(currentFile) ;
//new QAction(QIcon(IMAGE_PLAY), currentFile, this); //new QAction(QIcon(IMAGE_PLAY), currentFile, this);
//tr( "111Play File(s)" ), this ); //tr( "111Play File(s)" ), this );
// connect( openfolderAct , SIGNAL( triggered() ), this, // connect( openfolderAct , SIGNAL( triggered() ), this,
@ -684,7 +684,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
contextMnu2.addAction( openfolderAct); contextMnu2.addAction( openfolderAct);
else else
{ {
contextMnu2.addAction( menuAction ); // contextMnu2.addAction( menuAction );
contextMnu2.addAction( openfileAct); contextMnu2.addAction( openfileAct);
} }