Skip to content

Commit

Permalink
Merge pull request #84 from nailyk-fr/links
Browse files Browse the repository at this point in the history
[3.0.3][Feature] Make links clickable
  • Loading branch information
tobydox committed Feb 2, 2017
2 parents d0f6020 + bf2151c commit 6741404
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions ica/src/MessageBoxSlave.cpp
Expand Up @@ -45,25 +45,31 @@ bool MessageBoxSlave::handleMessage( const Ipc::Msg &m )
{
if( m.cmd() == ItalcSlaveManager::MessageBoxSlave::ShowMessageBox )
{
QMessageBox dialog;

QString msg = m.arg( ItalcSlaveManager::MessageBoxSlave::Text );
msg.replace(QRegExp("((?:https?|ftp)://\\S+)"), "<a href=\"\\1\">\\1</a>");
msg.replace("\n","<br />");

dialog.setTextInteractionFlags(Qt::TextBrowserInteraction);
dialog.setTextFormat(Qt::RichText);
dialog.setText(msg);
dialog.setWindowTitle(m.arg( ItalcSlaveManager::MessageBoxSlave::Title ));


if( m.arg( ItalcSlaveManager::MessageBoxSlave::Icon ).toInt() == QMessageBox::Warning )
{
QMessageBox::warning( Q_NULLPTR,
m.arg( ItalcSlaveManager::MessageBoxSlave::Title ),
m.arg( ItalcSlaveManager::MessageBoxSlave::Text ) );
dialog.setIcon(QMessageBox::Icon::Warning );
}
else if( m.arg( ItalcSlaveManager::MessageBoxSlave::Icon ).toInt() == QMessageBox::Critical )
{
QMessageBox::critical( Q_NULLPTR,
m.arg( ItalcSlaveManager::MessageBoxSlave::Title ),
m.arg( ItalcSlaveManager::MessageBoxSlave::Text ) );
dialog.setIcon(QMessageBox::Icon::Critical );
}
else
{
QMessageBox::information( Q_NULLPTR,
m.arg( ItalcSlaveManager::MessageBoxSlave::Title ),
m.arg( ItalcSlaveManager::MessageBoxSlave::Text ) );
dialog.setIcon(QMessageBox::Icon::Information );
}

dialog.exec();
return true;
}

Expand Down

0 comments on commit 6741404

Please sign in to comment.