Show
Ignore:
Timestamp:
05/28/08 13:47:07 (6 months ago)
Author:
eugene
Message:

Added an ability to skip protocols for which an owner exists.

Location:
trunk/qt4-gui/src/widgets
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/widgets/protocombobox.cpp

    r5822 r6224  
    3131  : QComboBox(parent) 
    3232{ 
     33  fillComboBox(); 
     34} 
     35 
     36ProtoComboBox::ProtoComboBox(bool skipExisting, QWidget* parent) 
     37  : QComboBox(parent) 
     38{ 
     39  fillComboBox(skipExisting); 
     40} 
     41 
     42void ProtoComboBox::fillComboBox(bool skipExisting) 
     43{ 
     44  QString id; 
     45  unsigned long ppid; 
     46  ICQOwner* o; 
     47 
    3348  FOR_EACH_PROTO_PLUGIN_START(gLicqDaemon) 
    3449  { 
    35     unsigned long ppid = (*_ppit)->PPID(); 
     50    ppid = (*_ppit)->PPID(); 
     51    o = gUserManager.FetchOwner(ppid, LOCK_R); 
     52    if (o == NULL) 
     53      id = "0"; 
     54    else 
     55    { 
     56      if (skipExisting) 
     57      { 
     58        gUserManager.DropOwner(ppid); 
     59        continue; 
     60      } 
     61      else 
     62      { 
     63        id = o->IdString(); 
     64        gUserManager.DropOwner(ppid); 
     65      } 
     66    } 
     67 
    3668    addItem( 
    37         IconManager::instance()->iconForStatus(ICQ_STATUS_ONLINE, "0", ppid), // icon 
     69        IconManager::instance()->iconForStatus(ICQ_STATUS_ONLINE, id, ppid), // icon 
    3870        (*_ppit)->Name(), // protocol name 
    3971        QString::number(ppid) // user data 
  • trunk/qt4-gui/src/widgets/protocombobox.h

    r5822 r6224  
    3333public: 
    3434  ProtoComboBox(QWidget* parent = 0); 
     35  ProtoComboBox(bool skipExisting, QWidget* parent = 0); 
    3536 
    3637  unsigned long currentPpid() const; 
    3738  bool setCurrentPpid(unsigned long ppid); 
     39 
     40private: 
     41  void fillComboBox(bool skipExisting = false); 
    3842}; 
    3943