• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ap_Dialog_CollaborationShare.h

Go to the documentation of this file.
00001 /* Copyright (C) 2009 AbiSource Corporation B.V.
00002  *
00003  * This program is free software; you can redistribute it and/or
00004  * modify it under the terms of the GNU General Public License
00005  * as published by the Free Software Foundation; either version 2
00006  * of the License, or (at your option) any later version.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00016  * 02110-1301 USA.
00017  */
00018 
00019 #ifndef AP_DIALOG_COLLABORATIONSHARE_H
00020 #define AP_DIALOG_COLLABORATIONSHARE_H
00021 
00022 #include "ut_types.h"
00023 #include "xap_Frame.h"
00024 #include "xap_Dialog.h"
00025 #include "xav_View.h"
00026 #include "ut_vector.h"
00027 #include <account/xp/AccountHandler.h>
00028 #include <account/xp/Buddy.h>
00029 #include <account/xp/EventListener.h>
00030 
00031 // We can't store shared pointers in the GtkListStore or the Win32 ListView control,
00032 // so we use a hack to store it anyway: store the shared pointer in a C struct called
00033 // BuddyPtrWrapper. This obviously defies the whole reason of shared pointers, but we
00034 // have no choice with these C APIs ;/
00035 struct BuddyPtrWrapper
00036 {
00037 public:
00038     BuddyPtrWrapper(BuddyPtr pBuddy) : m_pBuddy(pBuddy) {}
00039     BuddyPtr getBuddy() { return m_pBuddy; }
00040 private:
00041     BuddyPtr m_pBuddy;
00042 };
00043 
00044 extern pt2Constructor ap_Dialog_CollaborationShare_Constructor;
00045 
00046 class AP_Dialog_CollaborationShare: public XAP_Dialog_NonPersistent, EventListener
00047 {
00048 public:
00049     AP_Dialog_CollaborationShare(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id);
00050     virtual ~AP_Dialog_CollaborationShare(void);
00051 
00052     virtual void        runModal(XAP_Frame * pFrame) = 0;
00053 
00054     void                signal(const Event& event, BuddyPtr pSource);
00055 
00056     typedef enum { a_OK, a_CANCEL } tAnswer;
00057 
00058     AP_Dialog_CollaborationShare::tAnswer   getAnswer(void) const
00059         { return m_answer; }
00060 
00061     AccountHandler* getAccount()
00062         { return m_pAccount; }
00063 
00064     const std::vector<std::string>& getAcl()
00065         { return m_vAcl; }
00066 
00067     void                        eventAccountChanged();
00068     void                        share(AccountHandler* pAccount, const std::vector<std::string>& vAcl);
00069 
00070 protected:
00071     AbiCollab*                  _getActiveSession();
00072     AccountHandler*             _getShareableAccountHandler();
00073     std::vector<std::string>    _getSessionACL();
00074 
00075     bool                        _populateShareState(BuddyPtr pBuddy);
00076     virtual void                _refreshWindow() = 0;
00077     virtual void                _populateBuddyModel(bool refresh) = 0;
00078     virtual AccountHandler*     _getActiveAccountHandler() = 0;
00079     virtual void                _setAccountHint(const UT_UTF8String& sHint) = 0;
00080 
00081     AP_Dialog_CollaborationShare::tAnswer m_answer;
00082     AccountHandler*             m_pAccount;
00083     std::vector<std::string>    m_vAcl;
00084 
00085 private:
00086     bool                        _inAcl(const std::vector<std::string>& vAcl, BuddyPtr pBuddy);
00087 };
00088 
00089 #endif /* AP_DIALOG_COLLABORATIONSHARE_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1