Logo Search packages:      
Sourcecode: qtsmbstatus version File versions  Download package

void main_windows::InfoSMB (  )  [private, slot]

Info CIFS/SMB for log and balloon messages.

Info CIFS/SMB for log and balloon messages

Definition at line 713 of file main_windows.cpp.

References LogForm::eraseOldLog(), server::listMessages, and LogForm::on_filterEdit_textChanged().

Referenced by open_dialog_for_login().

{
      debugQt("main_windows::InfoSMB()");
      QString user;
      QString opened;
      QString machine;
      short unsigned int type_message=0;
      QString message;
      int occurence=0;
      int nb_occurences=3; // number of occurences on "balloon messages"
      server * item =dynamic_cast<server *>(listView->firstChild ());
      if (item)
      {
            while (!item->listMessages.isEmpty())
            {
                  occurence++;
                  if (occurence>1 && occurence<=nb_occurences) message+="\n"; // LineFeed
                  user=item->listMessages.first().user;
                  opened=item->listMessages.first().opened;
                  // limit size of text
                  if (opened.size()>60) opened=opened.left(7)+"..."+opened.right(50);
                  machine=item->listMessages.first().machine;
                  type_message=item->listMessages.first().type_message;
                  //view 3 occurences max
                  if (type_message==0 && occurence<=nb_occurences) message+=tr("User %1 has opened share %2 (%3)").arg(user).arg(opened).arg(machine);
                  if (type_message==1 && occurence<=nb_occurences) message+=tr("User %1 has opened file %2 (%3)").arg(user).arg(opened).arg(machine);
                  // log
                  if (log_activity) emit (refreshviewlog(item->listMessages.first()));
                  item->listMessages.removeFirst ();
            }
            if (occurence>nb_occurences) message+="\n  ..."; // hide others datas
            // refresh filter
            if (occurence>0) logform->on_filterEdit_textChanged();
            // erase old log
            logform->eraseOldLog();
            // just see 1 "balloon" (3 last occurences) if show_messages=true
            if (!message.isEmpty() && show_messages && !firstTime) trayicon->showMessage ( tr("CIFS/SMB activities"), message, QSystemTrayIcon::Information ) ;
      }
      firstTime=false;
}


Generated by  Doxygen 1.6.0   Back to index