[Libreoffice-commits] .: Branch 'feature/tubes' - sc/source tubes/source
Matus Kukan
mkukan at kemper.freedesktop.org
Mon Jul 16 15:55:42 PDT 2012
sc/source/ui/collab/contacts.cxx | 23 +++++++++++------------
sc/source/ui/collab/contacts.hrc | 1 +
sc/source/ui/collab/contacts.src | 10 ++++++++--
tubes/source/contact-list.cxx | 30 ++++++++++++++++++++----------
4 files changed, 40 insertions(+), 24 deletions(-)
New commits:
commit e3d1001c08d255c588ed6ca93f3b58b2161cce45
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Jul 17 00:32:37 2012 +0200
tubes: improve contacts dialog
- do not show until it's ready
- do not close it with buttons
- buttons for both 1-1 and MUC sessions
- display all online contacts
Change-Id: Idfbea7ffdf76ef3f31dbeeefe62d69cb5e3e64b7
diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx
index 51bd1e4..4536e2e 100644
--- a/sc/source/ui/collab/contacts.cxx
+++ b/sc/source/ui/collab/contacts.cxx
@@ -47,6 +47,7 @@ class TubeContacts : public ModelessDialog
{
FixedLine maLabel;
PushButton maBtnConnect;
+ PushButton maBtnGroup;
PushButton maBtnInvite;
PushButton maBtnListen;
SvxSimpleTableContainer maListContainer;
@@ -55,6 +56,7 @@ class TubeContacts : public ModelessDialog
ScDocFuncSend* mpSender;
DECL_LINK( BtnConnectHdl, void * );
+ DECL_LINK( BtnGroupHdl, void * );
DECL_LINK( BtnInviteHdl, void * );
DECL_LINK( BtnListenHdl, void * );
@@ -152,12 +154,14 @@ public:
ModelessDialog( NULL, ScResId( RID_SCDLG_CONTACTS ) ),
maLabel( this, ScResId( FL_LABEL ) ),
maBtnConnect( this, ScResId( BTN_CONNECT ) ),
+ maBtnGroup( this, ScResId( BTN_GROUP ) ),
maBtnInvite( this, ScResId( BTN_INVITE ) ),
maBtnListen( this, ScResId( BTN_LISTEN ) ),
maListContainer( this, ScResId( CTL_LIST ) ),
maList( maListContainer ),
mpManager( TeleManager::get() )
{
+ Hide();
ScDocShell *pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
ScDocFunc *pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
mpSender = dynamic_cast<ScDocFuncSend*> (pDocFunc);
@@ -185,6 +189,7 @@ public:
}
}
maBtnConnect.SetClickHdl( LINK( this, TubeContacts, BtnConnectHdl ) );
+ maBtnGroup.SetClickHdl( LINK( this, TubeContacts, BtnGroupHdl ) );
maBtnInvite.SetClickHdl( LINK( this, TubeContacts, BtnInviteHdl ) );
maBtnListen.SetClickHdl( LINK( this, TubeContacts, BtnListenHdl ) );
@@ -200,7 +205,6 @@ public:
sHeader += String( ScResId( STR_HEADER_NAME ) );
sHeader += '\t';
maList.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT );
- Show();
}
virtual ~TubeContacts()
{
@@ -221,7 +225,6 @@ public:
ContactList *pContacts = mpManager->getContactList();
if ( pContacts )
{
- fprintf( stderr, "contacts !\n" );
AccountContactPairV aPairs = pContacts->getContacts();
AccountContactPairV::iterator it;
for( it = aPairs.begin(); it != aPairs.end(); it++ )
@@ -240,10 +243,6 @@ public:
aImage = Image( aBitmap );
}
}
- fprintf( stderr, "'%s' => '%s' '%s'\n",
- tp_account_get_display_name( it->first ),
- tp_contact_get_alias( it->second ),
- tp_contact_get_identifier( it->second ) );
rtl::OUStringBuffer aEntry( 128 );
aEntry.append( sal_Unicode( '\t' ) );
aEntry.append( fromUTF8 ( tp_contact_get_alias( it->second ) ) );
@@ -256,31 +255,31 @@ public:
pEntry->SetUserData( &maACs.back() );
}
}
+ Show();
}
};
IMPL_LINK_NOARG( TubeContacts, BtnConnectHdl )
{
-#if 0
StartBuddySession();
-#else
+ return 0;
+}
+
+IMPL_LINK_NOARG( TubeContacts, BtnGroupHdl )
+{
StartGroupSession();
-#endif
- Close();
return 0;
}
IMPL_LINK_NOARG( TubeContacts, BtnInviteHdl )
{
Invite();
- Close();
return 0;
}
IMPL_LINK_NOARG( TubeContacts, BtnListenHdl )
{
Listen();
- Close();
return 0;
}
diff --git a/sc/source/ui/collab/contacts.hrc b/sc/source/ui/collab/contacts.hrc
index 59aeb67..4d7cc5f 100644
--- a/sc/source/ui/collab/contacts.hrc
+++ b/sc/source/ui/collab/contacts.hrc
@@ -5,6 +5,7 @@
#define BTN_CONNECT 3
#define BTN_INVITE 4
#define BTN_LISTEN 5
+#define BTN_GROUP 6
#define STR_HEADER_ALIAS 20
#define STR_HEADER_NAME 21
diff --git a/sc/source/ui/collab/contacts.src b/sc/source/ui/collab/contacts.src
index 27d1dca..6a868ae 100644
--- a/sc/source/ui/collab/contacts.src
+++ b/sc/source/ui/collab/contacts.src
@@ -9,7 +9,7 @@ ModelessDialog RID_SCDLG_CONTACTS
Hide = FALSE ;
Moveable = TRUE ;
Closeable = TRUE ;
- Size = MAP_APPFONT ( 220 , 215 ) ;
+ Size = MAP_APPFONT ( 220 , 225 ) ;
OutputSize = TRUE ;
Text [ en-US ] = "Contacts" ;
@@ -23,7 +23,13 @@ ModelessDialog RID_SCDLG_CONTACTS
{
Pos = MAP_APPFONT( 70 , 200 );
Size = MAP_APPFONT( 50 , 10 );
- Text [ en-US ] = "Collaborate";
+ Text [ en-US ] = "startBuddySession";
+ };
+ PushButton BTN_GROUP
+ {
+ Pos = MAP_APPFONT( 70 , 212 );
+ Size = MAP_APPFONT( 50 , 10 );
+ Text [ en-US ] = "startGroupSession";
};
PushButton BTN_INVITE
{
diff --git a/tubes/source/contact-list.cxx b/tubes/source/contact-list.cxx
index c74a950..0d46803 100644
--- a/tubes/source/contact-list.cxx
+++ b/tubes/source/contact-list.cxx
@@ -61,6 +61,7 @@ ContactList::ContactList(TpAccountManager *pAccountManager)
TP_CONTACT_FEATURE_ALIAS,
TP_CONTACT_FEATURE_AVATAR_DATA,
TP_CONTACT_FEATURE_CAPABILITIES,
+ TP_CONTACT_FEATURE_PRESENCE,
TP_CONTACT_FEATURE_INVALID);
}
@@ -70,16 +71,25 @@ ContactList::~ContactList()
mpAccountManager = NULL;
}
-static gboolean
-contact_supports_libo_dtube (TpContact *contact)
+static bool
+tb_contact_is_online (TpContact *contact)
{
- TpCapabilities *caps = tp_contact_get_capabilities (contact);
-
- if (caps == NULL)
- return FALSE;
-
- return tp_capabilities_supports_dbus_tubes (caps,
- TP_HANDLE_TYPE_CONTACT, TeleManager::getFullServiceName().getStr());
+ switch (tp_contact_get_presence_type (contact))
+ {
+ case TP_CONNECTION_PRESENCE_TYPE_UNSET:
+ case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
+ return false;
+ case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
+ case TP_CONNECTION_PRESENCE_TYPE_AWAY:
+ case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
+ case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
+ case TP_CONNECTION_PRESENCE_TYPE_BUSY:
+ return true;
+ case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
+ case TP_CONNECTION_PRESENCE_TYPE_ERROR:
+ default:
+ return false;
+ }
}
AccountContactPairV ContactList::getContacts()
@@ -113,7 +123,7 @@ AccountContactPairV ContactList::getContacts()
reinterpret_cast<TpContact *>(g_ptr_array_index (contacts, i));
if (contact != self &&
- contact_supports_libo_dtube (contact))
+ tb_contact_is_online (contact))
{
g_object_ref (account);
g_object_ref (contact);
More information about the Libreoffice-commits
mailing list