Import release 2.0rc1

This commit is contained in:
Mario Fetka
2009-07-17 15:44:01 +00:00
parent 919dbe2a0f
commit 9d0ee5010b
187 changed files with 41747 additions and 39906 deletions
+69 -58
View File
@@ -56,7 +56,7 @@
#include <KToolBar>
#include <KToolInvocation>
#include <KWindowSystem>
#include <KStandardShortcut>
#ifdef KMESSDEBUG_CHATWINDOW
#define KMESSDEBUG_CHATWINDOW_TYPING_MESSAGES
@@ -133,14 +133,18 @@ ChatWindow::ChatWindow( QWidget *parent )
// Add them to the window
setDockOptions( QMainWindow::AnimatedDocks | QMainWindow::AllowTabbedDocks );
addDockWidget( Qt::RightDockWidgetArea, contactsDock_ );
addDockWidget( Qt::RightDockWidgetArea, standardEmoticonsDock_ );
addDockWidget( Qt::RightDockWidgetArea, customEmoticonsDock_ );
Qt::DockWidgetArea position = QApplication::isLeftToRight()
? Qt::RightDockWidgetArea
: Qt::LeftDockWidgetArea;
addDockWidget( position, contactsDock_ );
addDockWidget( position, standardEmoticonsDock_ );
addDockWidget( position, customEmoticonsDock_ );
//Install the event filters to catch events
installEventFilter( this );
inkEdit_ ->installEventFilter( this );
messageEdit_->installEventFilter( this );
winksWidget_->installEventFilter( this );
messageEdit_->viewport()->installEventFilter( this );
// Set the button icons
@@ -417,8 +421,6 @@ void ChatWindow::createMenus()
// Create the actions for "Chat" menu
inviteButton_ = new KAction ( KIcon("list-add-user"), i18n("&Invite..."), this );
sendAction_ = new KAction ( KIcon("folder-remote"), i18n("Send a &File..."), this );
webcamAction_ = new KAction ( KIcon("webcamsend"), i18n("Webcam Chat"), this );
meetingAction_ = new KAction ( KIcon("gnomemeeting"), i18n("Start a &Meeting"), this );
nudgeAction_ = new KAction ( KIcon("preferences-desktop-notification-bell"), i18n("Send a &Nudge!"), this );
saveAction = new KAction ( KIcon("document-save"), i18n("Save Chat..."), this );
closeAllAction_ = new KAction ( KIcon("dialog-close"), i18n("Close &All Tabs"), this );
@@ -448,7 +450,6 @@ void ChatWindow::createMenus()
showMenuBar_ = KStandardAction::showMenubar( this, SLOT( showMenuBar() ), actionCollection_ );
// Add shorter texts for the toolbar items
meetingAction_->setIconText( i18n("Meeting") );
nudgeAction_ ->setIconText( i18n("Nudge") );
sendAction_ ->setIconText( i18n("Send a &File") );
@@ -507,12 +508,8 @@ void ChatWindow::createMenus()
this, SLOT ( slotInviteContact() ) );
connect( sendAction_, SIGNAL( triggered(bool) ),
this, SLOT ( startFileTransfer() ) );
connect( webcamAction_, SIGNAL( triggered(bool) ),
this, SLOT ( startWebcamTransfer() ) );
connect( nudgeAction_, SIGNAL( triggered(bool) ),
this, SLOT ( sendNudge() ) );
connect( meetingAction_, SIGNAL( triggered(bool) ),
this, SLOT ( startMeeting() ) );
connect( saveAction, SIGNAL( triggered(bool) ),
this, SLOT ( saveChat() ) );
connect( closeAllAction_, SIGNAL( triggered() ),
@@ -537,10 +534,6 @@ void ChatWindow::createMenus()
// Add actions to actionCollection for "Chat" menu
actionCollection_->addAction( "send", sendAction_ );
#if ENABLE_WEBCAM
actionCollection_->addAction( "webcam", webcamAction_ );
#endif
actionCollection_->addAction( "meeting", meetingAction_ );
actionCollection_->addAction( "nudge", nudgeAction_ );
actionCollection_->addAction( "save", saveAction );
actionCollection_->addAction( "closeAll", closeAllAction_ );
@@ -563,17 +556,6 @@ void ChatWindow::createMenus()
// Add actions to actionCollection for "Settings" menu
actionCollection_->addAction( "spellCheck", spellCheckAction_ );
#ifdef HAS_KPHONE // If KPhone is not enabled, don't support voice conversation
KAction *conversation = new KAction( "kphone", i18nc( "Menu/toolbar action for voice conversations (KPhone support)",
"Start or Stop a &Conversation"), this );
connect( send, SIGNAL( triggered(bool) ),
this, SLOT ( startConversation() ) );
actionCollection_->addAction( "conversation", conversation );
#endif
}
@@ -722,6 +704,7 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event )
// is complex enough as it is now...)
if( obj != messageEdit_ && obj != messageEdit_->viewport()
&& obj != inkEdit_
&& obj != winksWidget_
&& obj != standardEmoticonsWidget_
&& obj != customEmoticonsWidget_ )
{
@@ -841,7 +824,17 @@ bool ChatWindow::eventFilter( QObject *obj, QEvent *event )
}
}
// Another key was pressed: switch to the message editor if needed
// check if this is a Find key sequence. if so, stop it before it gets to the message edit
// this prevents the Ctrl+F key sequence being consumed by KTextEdit.
// KTextEdit does not stop consuming the find/replace key sequences if we disable find/replace
// (bug has been filed with KDE) so this hack is necessary.
if ( KStandardShortcut::find().contains(key | keyEvent->modifiers() ) )
{
editFind();
return true;
}
// Another key was pressed: switch to the message editor if needed
if( editorChooser_->currentWidget() != textPage_ )
{
slotSwitchEditor();
@@ -1467,6 +1460,32 @@ void ChatWindow::sendNudge()
// Sets the window icon for this chat window
void ChatWindow::setChatWindowIcon()
{
Chat *chat = getCurrentChat();
if( chat == 0 )
{
return;
}
QPixmap kmessIcon = KIconLoader::global()->loadIcon( "kmess-shadow", KIconLoader::Panel );
QPixmap userIcon;
if ( chat->getParticipants().size() == 1 )
{
userIcon = KIcon( "user-identity" ).pixmap( 60, 60 );
}
else
{
userIcon = KIcon( "system-users" ).pixmap( 60, 60 );
}
setWindowIcon( KMessShared::drawIconOverlay( userIcon, kmessIcon, kmessIcon.size().width(), kmessIcon.size().height(), .60, .90 ) );
}
// Change the active chat
void ChatWindow::setCurrentChat( Chat *chat )
{
@@ -1496,10 +1515,8 @@ void ChatWindow::setEnabled( bool isEnabled )
// Set the state of the extra contact actions
emoticonAction_ ->setEnabled( isEnabled );
meetingAction_ ->setEnabled( isEnabled );
nudgeAction_ ->setEnabled( isEnabled );
sendAction_ ->setEnabled( isEnabled );
webcamAction_ ->setEnabled( isEnabled );
changeFontAction_ ->setEnabled( isEnabled );
changeFontColorAction_ ->setEnabled( isEnabled );
spellCheckAction_ ->setEnabled( isEnabled );
@@ -1509,8 +1526,15 @@ void ChatWindow::setEnabled( bool isEnabled )
pasteAction_ ->setEnabled( isEnabled );
// Update the winks and handwriting buttons
updateModeButtons();
if( isEnabled )
{
updateModeButtons();
}
else
{
inkButton_ ->setEnabled( false );
winksButton_->setEnabled( false );
}
// The window is being enabled back, replace some stuff which changes
// on every connection
if( isEnabled )
@@ -1526,7 +1550,9 @@ void ChatWindow::setEnabled( bool isEnabled )
// Enable or disable the parts of the window which allow user interaction
void ChatWindow::setUIState( UIState state )
{
switch( state)
uiState_ = state;
switch( state )
{
case Disconnecting:
case Disconnected:
@@ -2181,6 +2207,8 @@ void ChatWindow::slotTabChanged( int currentIndex )
}
#endif
// update the icon for this window appropriately.
setChatWindowIcon();
// Reset the color
const QPalette palette;
@@ -2293,6 +2321,12 @@ void ChatWindow::slotUpdateChatInfo( Chat *chat )
const QStringList& participantsList( chat->getParticipants() );
if ( chat == getCurrentChat() )
{
// update the icon for this window appropriately.
setChatWindowIcon();
}
// getCaption() should return a properly html-escaped string
QString chatCaption( chat->getCaption() );
@@ -2346,14 +2380,6 @@ void ChatWindow::slotUpdateChatInfo( Chat *chat )
// Start a voice conversation
void ChatWindow::startConversation()
{
getCurrentChat()->startConversation();
}
// Start a file transfer
void ChatWindow::startFileTransfer()
{
@@ -2362,22 +2388,6 @@ void ChatWindow::startFileTransfer()
// Start GnomeMeeting with a contact.
void ChatWindow::startMeeting()
{
getCurrentChat()->startMeeting();
}
// Start a file transfer
void ChatWindow::startWebcamTransfer()
{
getCurrentChat()->startWebcamTransfer();
}
// Called when the "use emoticons" action is called.
void ChatWindow::toggleEmoticons( bool useEmoticons )
{
@@ -2418,8 +2428,9 @@ void ChatWindow::toggleSpellCheck( bool useSpellCheck )
// Update the status of the tiny writing mode buttons
void ChatWindow::updateModeButtons()
{
// don't do anything when the window / chat was just closed
if( getCurrentChat() == NULL )
// don't do anything when the window
// chat was just closed or user is not connected
if( getCurrentChat() == NULL || uiState_ != Connected)
{
return;
}