Show
Ignore:
Timestamp:
03/15/08 06:59:03 (9 months ago)
Author:
flynd
Message:

Now that LicqGui::showEventDialog changes existing event dialogs to requested message type we don't need this code in userviewbase anymore.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt4-gui/src/views/userviewbase.cpp

    r6097 r6100  
    4444using namespace LicqQtGui; 
    4545 
    46 /** 
    47  * Get a pointer to a dialog for sending events with the given @a type, to the contact 
    48  * @a id over the protocol @a ppid. If the dialog is already open, the dialog is 
    49  * converted to the correct type before being returned. 
    50  * 
    51  * @returns a pointer to a send event dialog of type @a T, or NULL on error. 
    52  */ 
    53 template<typename T> 
    54 static T* getSendEventDialog(EventType type, QString id, unsigned long ppid) 
    55 { 
    56   UserEventCommon* common = LicqGui::instance()->showEventDialog(type, id, ppid); 
    57   if (!common) 
    58     return NULL; 
    59  
    60   T* dialog = dynamic_cast<T*>(common); 
    61   if (!dialog) 
    62   { 
    63     UserSendCommon* base = dynamic_cast<UserSendCommon*>(common); 
    64     if (!base) 
    65       return NULL; 
    66  
    67     base->changeEventType(type); 
    68     dialog = dynamic_cast<T*>(LicqGui::instance()->showEventDialog(type, id, ppid)); 
    69     if (!dialog) 
    70       return NULL; 
    71   } 
    72  
    73   return dialog; 
    74 } 
    75  
    76 /// Convenient, wrapper functions for getSendEventDialog. 
    77 static inline UserSendContactEvent* getSendContactEventDialog(QString id, unsigned long ppid) 
    78 { 
    79   return getSendEventDialog<UserSendContactEvent>(ContactEvent, id, ppid); 
    80 } 
    81  
    82 static inline UserSendFileEvent* getSendFileEventDialog(QString id, unsigned long ppid) 
    83 { 
    84   return getSendEventDialog<UserSendFileEvent>(FileEvent, id, ppid); 
    85 } 
    86  
    87 static inline UserSendMsgEvent* getSendMsgEventDialog(QString id, unsigned long ppid) 
    88 { 
    89   return getSendEventDialog<UserSendMsgEvent>(MessageEvent, id, ppid); 
    90 } 
    91  
    92 static inline UserSendUrlEvent* getSendUrlEventDialog(QString id, unsigned long ppid) 
    93 { 
    94   return getSendEventDialog<UserSendUrlEvent>(UrlEvent, id, ppid); 
    95 } 
    96  
    9746UserViewBase::UserViewBase(ContactListModel* contactList, UserMenu* mnuUser, QWidget* parent) 
    9847  : QTreeView(parent), 
     
    229178        if (!(text = firstUrl.toLocalFile()).isEmpty()) 
    230179        { 
    231           UserSendFileEvent* sendFile = getSendFileEventDialog(id, ppid); 
     180          UserSendFileEvent* sendFile = dynamic_cast<UserSendFileEvent*>( 
     181              LicqGui::instance()->showEventDialog(FileEvent, id, ppid)); 
    232182          if (!sendFile) 
    233183            return; 
     
    246196        else 
    247197        { 
    248           UserSendUrlEvent* sendUrl = getSendUrlEventDialog(id, ppid); 
     198          UserSendUrlEvent* sendUrl = dynamic_cast<UserSendUrlEvent*>( 
     199              LicqGui::instance()->showEventDialog(UrlEvent, id, ppid)); 
    249200          if (!sendUrl) 
    250201            return; 
     
    275226            return; 
    276227 
    277           UserSendContactEvent* sendContact = getSendContactEventDialog(id, ppid); 
     228          UserSendContactEvent* sendContact = dynamic_cast<UserSendContactEvent*>( 
     229              LicqGui::instance()->showEventDialog(ContactEvent, id, ppid)); 
    278230          if (!sendContact) 
    279231            return; 
     
    284236        else 
    285237        { 
    286           UserSendMsgEvent* sendMsg = getSendMsgEventDialog(id, ppid); 
     238          UserSendMsgEvent* sendMsg = dynamic_cast<UserSendMsgEvent*>( 
     239              LicqGui::instance()->showEventDialog(MessageEvent, id, ppid)); 
    287240          if (!sendMsg) 
    288241            return;