Import release 2.0beta1

This commit is contained in:
Mario Fetka
2009-03-23 23:26:37 +00:00
parent 8b3dac7ce6
commit a899084e37
373 changed files with 147541 additions and 68476 deletions
+233 -288
View File
@@ -17,12 +17,12 @@
#include "kmessinterface.h"
#include "notification/systemtraywidget.h"
#include "settings/globalsettingsdialog.h"
#include "utils/kmessconfig.h"
#include "utils/kmessshared.h"
#include "kmessapplication.h"
#include "kmessdebug.h"
#include "systemtraywidget.h"
#include <QPoint>
#include <QSize>
@@ -36,6 +36,7 @@
#include <KLocale>
#include <KMenu>
#include <KMenuBar>
#include <KMessageBox>
#include <KSelectAction>
#include <KStandardAction>
#include <KStatusBar>
@@ -43,14 +44,20 @@
#include <KToolInvocation>
#include <KUrl>
#ifdef KMESSTEST
#include "utils/likeback/likeback.h"
#endif
// The constructor
KMessInterface::KMessInterface( QWidget *parent )
: KMainWindow( parent )
, isErrorStatus_(true)
, initialized_(false)
: KXmlGuiWindow( parent )
, actionCollection_( actionCollection() )
, isErrorStatus_( true )
, initialized_( false )
{
setObjectName( "ContactList" );
}
@@ -65,21 +72,6 @@ KMessInterface::~KMessInterface()
}
// Show the "about KDE" message.
void KMessInterface::aboutKDE()
{
helpMenu_->aboutKDE();
}
// Show the "about KMess" message.
void KMessInterface::aboutKMess()
{
helpMenu_->aboutApplication();
}
// "Add a new contact" was selected from the menu.
void KMessInterface::addNewContact()
@@ -87,7 +79,13 @@ void KMessInterface::addNewContact()
kDebug() << "not implemented";
}
// Show the chat history dialog and, if requested, that of a specific contact
void KMessInterface::showChatHistory( const QString &handle )
{
Q_UNUSED( handle );
kDebug() << "not implemented";
}
// "Add a new group" was selected from the menu.
void KMessInterface::addNewGroup()
@@ -113,8 +111,10 @@ void KMessInterface::changedListPictureSize( int /*mode*/ )
// A status was selected from the menu.
void KMessInterface::changeStatus( int /*index*/ )
void KMessInterface::changeStatus( QAction *action )
{
Q_UNUSED( action );
kDebug() << "not implemented";
}
@@ -127,6 +127,14 @@ void KMessInterface::changeViewMode(int /*mode*/)
}
void KMessInterface::showListExportDialog()
{
kDebug() << "not implemented";
}
void KMessInterface::showNetworkWindow()
{
kDebug() << "not implemented";
@@ -140,245 +148,163 @@ void KMessInterface::showTransferWindow()
// Create the "Actions" menu
void KMessInterface::createActionsMenu()
{
KAction *newAccount, *searchForContact, *searchByInterest;
KToggleAction *searchInContactList;
KMenu *actionsMenu;
// Create the menu
actionsMenu = new KMenu( i18n("&Actions"), this );
// Create the "settings" menus
newContact_ = new KAction( KIcon("list-add-user"), i18n("New &Contact"), this );
newGroup_ = new KAction( KIcon("user-group-new"), i18n("New &Group"), this );
searchForContact = new KAction( KIcon("edit-find-user"), i18n("Search for Contact"), this );
searchByInterest = new KAction( KIcon("system-search"), i18n("Search by &Interest"), this );
searchInContactList = new KToggleAction( KIcon("edit-find-user"), i18n("Search in Contact List"), actionCollection_ );
searchInContactList->setShortcut( QKeySequence::fromString( tr( "Ctrl+f" ) ) );
actionCollection_->addAction("edit-find-user", searchInContactList);
newAccount = new KAction( KIcon("user-identity"), i18n("New &Account"), this );
globalSettings_ = new KAction( KIcon("kmess"), i18n("Configure &KMess"), this );
connect( newContact_, SIGNAL( triggered(bool) ),
SLOT( addNewContact() ) );
connect( newGroup_, SIGNAL( triggered(bool) ),
SLOT( addNewGroup() ) );
connect( searchForContact, SIGNAL( triggered(bool) ),
SLOT( searchForContact() ) );
connect( searchByInterest, SIGNAL( triggered(bool) ),
SLOT( searchForContactByInterest() ) );
connect( searchInContactList, SIGNAL( triggered(bool) ),
SLOT( toggleShowSearchFrame(bool) ) );
connect( newAccount, SIGNAL( triggered(bool) ),
SLOT( createNewAccount() ) );
connect( globalSettings_, SIGNAL( triggered(bool) ),
SLOT( showGlobalSettings() ) );
// preferences-desktop-user
settingsActionMenu_ = new KActionMenu( KIcon("configure"), i18n("Account &Settings"), this );
// Plug the items into "settings"
actionsMenu->addAction( newContact_ );
actionsMenu->addAction( newGroup_ );
actionsMenu->addSeparator();
actionsMenu->addAction( searchForContact );
actionsMenu->addAction( searchByInterest );
actionsMenu->addAction( searchInContactList );
actionsMenu->addSeparator();
actionsMenu->addAction( newAccount );
actionsMenu->addAction( settingsActionMenu_ );
actionsMenu->addAction( globalSettings_ );
// Plug the menu into the menubar
menuBar()->addMenu( actionsMenu );
}
// Create the "Connect" menu
void KMessInterface::createConnectMenu()
{
KAction *close, *quit;
KMenu *connectMenu;
QStringList states;
// Create the menu
connectMenu = new KMenu( i18n("&Connect"), this );
// Create the "connect" menu items
connectActionMenu_ = new KActionMenu( KIcon("network-connect"), i18n("Co&nnect"), this );
disconnect_ = new KAction( KIcon("network-disconnect"), i18n("&Disconnect"), this );
showProfile_ = new KAction( KIcon("preferences-desktop-user"), i18n("Show My &Profile"), this );
status_ = new KSelectAction( KIcon("go-jump"), i18n("&My Status"), this );
states << i18n("Online")
<< i18n("Away")
<< i18n("Away with auto-reply")
<< i18n("Idle")
<< i18n("Be Right Back")
<< i18n("Busy")
<< i18n("Out to Lunch")
<< i18n("On the Phone")
<< i18n("Invisible");
status_->setItems(states);
connect( disconnect_, SIGNAL( triggered(bool) ),
this, SLOT( disconnectClicked() ) );
connect( showProfile_, SIGNAL( triggered(bool) ),
this, SLOT( showUserProfile() ) );
connect( status_, SIGNAL( triggered(int) ),
this, SLOT( changeStatus(int) ) );
close = KStandardAction::close( this, SLOT( menuClose() ), actionCollection_ );
quit = KStandardAction::quit ( this, SLOT( menuQuit() ), actionCollection_ );
// Plug the items into "connect"
connectMenu->addAction( connectActionMenu_ );
connectMenu->addAction( disconnect_ );
connectMenu->addSeparator( );
connectMenu->addAction( status_ );
connectMenu->addAction( showProfile_ );
connectMenu->addSeparator();
connectMenu->addAction( close );
connectMenu->addAction( quit );
/* toolBar( "mainToolBar" )->addAction( disconnect_ );
toolBar( "mainToolBar" )->addAction( status_ );*/
// Plug the menu into the menubar
menuBar()->addMenu( connectMenu );
}
// Create the "Help" menu
void KMessInterface::createHelpMenu()
{
KAction *aboutKDE, *aboutKMess, *helpContents;
KMenu *helpMenu;
// Create the menu
helpMenu = new KMenu( i18n("&Help"), this );
// Create the help menu.
helpMenu_ = new KHelpMenu(this, KGlobal::mainComponent().aboutData());
// Create the help menu items
helpContents = KStandardAction::helpContents( this, SLOT( helpContents() ), actionCollection_ );
aboutKMess = KStandardAction::aboutApp ( this, SLOT( aboutKMess() ), this );
aboutKDE = KStandardAction::aboutKDE ( this, SLOT( aboutKDE() ), this );
// Plug the items into "help-contents"
helpMenu->addAction( helpContents );
helpMenu->addSeparator();
helpMenu->addAction( aboutKMess );
helpMenu->addAction( aboutKDE );
// Plug the menu into the menubar
menuBar()->addMenu( helpMenu );
}
// Create the menus
void KMessInterface::createMenus()
{
// ActionCollection to collect the actions with a shortcut
actionCollection_ = new KActionCollection( this, KComponentData() );
// Create the 4 menus
createConnectMenu();
createViewMenu();
createActionsMenu();
createHelpMenu();
// Add collected actions
addActions( actionCollection_->actions() );
}
KAction *close, *quit;
KAction *newAccount, *searchForContact, *searchByInterest;
QStringList states;
QStringList viewModes, listPictureSizes;
// Create the actions for "Connect" menu
status_ = MsnStatus::getStatusMenu();
connectActionMenu_ = new KActionMenu ( KIcon("network-connect"), i18n("&Connect"), this );
disconnect_ = new KAction ( KIcon("network-disconnect"), i18n("&Disconnect"), this );
showProfile_ = new KAction ( KIcon("preferences-desktop-user"), i18n("Show My &Profile"), this );
close = KStandardAction::close( this, SLOT( menuClose() ), actionCollection_ );
quit = KStandardAction::quit ( this, SLOT( menuQuit() ), actionCollection_ );
// Create the "View" menu
void KMessInterface::createViewMenu()
{
QStringList viewModes, listPictureSizes;
// Create the actions for "View" menu
showAllowedAction_ = new KToggleAction( i18n("Show &Allowed Contacts"), this );
showOfflineAction_ = new KToggleAction( i18n("Show &Offline Contacts"), this );
showRemovedAction_ = new KToggleAction( i18n("Show &Removed Contacts"), this );
showHistoryBoxAction_ = new KToggleAction( KIcon("view-history"), i18n("Show &History Box"), this );
showSearchAction_ = new KToggleAction( KIcon("edit-find-user"), i18n("&Show Search Bar"), this );
showEmptyAction_ = new KToggleAction( i18n("Show &Empty Groups"), this );
listPictureSize_ = new KSelectAction( KIcon("view-list-tree"), i18n("&Display Pictures Size"), this );
viewMode_ = new KSelectAction( KIcon("view-list-tree"), i18n("&Sort Contacts by"), this );
showTransferAction_ = new KAction ( KIcon("document-open-remote"), i18n("Show &Transfer Window..."), this );
showStatusBar_ = KStandardAction::showStatusbar( this, SLOT( showStatusBar() ), this );
showMenuBar_ = KStandardAction::showMenubar ( this, SLOT( showMenuBar() ), this );
// Create the menu
viewMenu_ = new KMenu( i18n("&View"), this );
// Create the actions for "Actions" menu
newContact_ = new KAction( KIcon("list-add-user"), i18n("New &Contact..."), this );
newGroup_ = new KAction( KIcon("user-group-new"), i18n("New &Group..."), this );
exportList_ = new KAction( KIcon("document-export"),i18n("&Export Contact List..."), this );
searchForContact = new KAction( KIcon("edit-find-user"), i18n("Search for C&ontact"), this );
searchByInterest = new KAction( KIcon("system-search"), i18n("Search by &Interest"), this );
showHistory_ = new KAction( KIcon("user-identity"), i18n("Show Chat &History..."), this );
newAccount = new KAction( KIcon("user-identity"), i18n("New &Account..."), this );
showSettingsAction_ = new KAction( KIcon("configure"), i18n("Configure Account..."), this );
globalSettings_ = new KAction( KIcon("kmess"), i18n("Configure &KMess..."), this );
contextMenuAction_ = new KAction( KIcon("preferences-contact-list"), i18n("Show Selection &Menu"), this );
// Create the "view" menu items
showAllowedAction_ = new KToggleAction( i18n("Show &Allowed Contacts"), this );
showOfflineAction_ = new KToggleAction( i18n("Show &Offline Contacts"), this );
showRemovedAction_ = new KToggleAction( i18n("Show &Removed Contacts"), this );
showEmptyAction_ = new KToggleAction( i18n("Show &Empty Groups"), this );
// The list mode display picture
listPictureSize_ = new KSelectAction( KIcon("view-list-tree"), i18n("Display Pictures Size"), this );
listPictureSizes << i18n( "Do not display" )
// Populate PictureSize select
listPictureSizes << i18n( "Do Not Display" )
<< i18n( "Small" )
<< i18n( "Medium" )
<< i18n( "Large" );
listPictureSize_->setItems( listPictureSizes );
viewMode_ = new KSelectAction( KIcon("view-list-tree"), i18n("&Sort Contacts by"), this );
// Populate ViewMode select
viewModes << i18n("Group") // Account::VIEW_BYGROUP
<< i18n("Online/Offline") // Account::VIEW_BYSTATUS
<< i18n("Mixed"); // Account::VIEW_MIXED
viewMode_->setItems(viewModes);
showTransferAction_ = new KAction( KIcon("document-open-remote"), i18n("Show &Transfer Window"), this );
//showToolBar_ = new KToggleAction( i18n("Show &Tool bar"), this );
showStatusBar_ = KStandardAction::showStatusbar( this, SLOT( showStatusBar() ), this );
showMenuBar_ = KStandardAction::showMenubar( this, SLOT( showMenuBar() ), actionCollection_ );
// Add shortcut for Search in ContactList
showSearchAction_->setShortcut( QKeySequence::fromString( tr( "Ctrl+f" ) ) );
// Disable the context menu, because there's no selection on start
contextMenuAction_->setEnabled( false );
// Disable the 'Show Account Settings' action, there is no current account on start
showSettingsAction_->setEnabled( false );
// Connect slots to signals for "Connect" menu
connect( disconnect_, SIGNAL( triggered(bool) ),
this, SLOT ( disconnectClicked() ) );
connect( showProfile_, SIGNAL( triggered(bool) ),
this, SLOT ( showUserProfile() ) );
connect( status_, SIGNAL( triggered(QAction*) ),
this, SLOT ( changeStatus(QAction*) ) );
// Connect slots to signals for "View" menu
connect( viewMode_, SIGNAL( triggered(int) ),
this, SLOT ( changeViewMode(int) ) );
connect( listPictureSize_, SIGNAL( triggered(int) ),
this, SLOT ( changedListPictureSize(int) ) );
connect( showAllowedAction_, SIGNAL( triggered(bool) ),
this, SLOT ( toggleShowAllowed(bool) ) );
connect( showOfflineAction_, SIGNAL( triggered(bool) ),
this, SLOT ( toggleShowOffline(bool) ) );
connect( showRemovedAction_, SIGNAL( triggered(bool) ),
this, SLOT ( toggleShowRemoved(bool) ) );
connect( showEmptyAction_, SIGNAL( triggered(bool) ),
this, SLOT ( toggleShowEmpty(bool) ) );
connect( showTransferAction_, SIGNAL( triggered(bool) ),
this, SLOT ( showTransferWindow() ) );
// Connect slots to signals for "Actions" menu
connect( newContact_, SIGNAL( triggered(bool) ),
this, SLOT ( addNewContact() ) );
connect( newGroup_, SIGNAL( triggered(bool) ),
this, SLOT ( addNewGroup() ) );
connect( exportList_, SIGNAL( triggered(bool) ),
this, SLOT ( showListExportDialog() ) );
connect( searchForContact, SIGNAL( triggered(bool) ),
this, SLOT ( searchForContact() ) );
connect( searchByInterest, SIGNAL( triggered(bool) ),
this, SLOT ( searchForContactByInterest() ) );
connect( showHistoryBoxAction_,SIGNAL( triggered(bool) ),
this, SLOT ( toggleShowHistoryBox(bool) ) );
connect( showSearchAction_, SIGNAL( triggered(bool) ),
this, SLOT ( toggleShowSearchFrame(bool) ) );
connect( showHistory_, SIGNAL( triggered(bool) ),
this, SLOT ( showChatHistory() ) );
connect( newAccount, SIGNAL( triggered(bool) ),
this, SLOT ( createNewAccount() ) );
connect( globalSettings_, SIGNAL( triggered(bool) ),
this, SLOT ( showGlobalSettings() ) );
connect( contextMenuAction_, SIGNAL( triggered(bool) ),
this, SLOT ( showContextMenu() ) );
// Add actions to actionCollection for "Connect" menu
actionCollection_->addAction( "status", status_->menuAction() );
actionCollection_->addAction( "connect", connectActionMenu_ );
actionCollection_->addAction( "disconnect", disconnect_ );
actionCollection_->addAction( "showProfile", showProfile_ );
actionCollection_->addAction( "close", close );
actionCollection_->addAction( "quit", quit );
// Add actions to actionCollection for "View" menu
actionCollection_->addAction( "showAllowed", showAllowedAction_ );
actionCollection_->addAction( "showOffline", showOfflineAction_ );
actionCollection_->addAction( "showRemoved", showRemovedAction_ );
actionCollection_->addAction( "showEmpty", showEmptyAction_ );
actionCollection_->addAction( "pictureSizes", listPictureSize_ );
actionCollection_->addAction( "viewModes", viewMode_ );
actionCollection_->addAction( "showTransfers", showTransferAction_ );
actionCollection_->addAction( "showMenuBar", showMenuBar_ );
actionCollection_->addAction( "showStatusBar", showStatusBar_ );
// Add actions to actionCollection for "Actions" menu
actionCollection_->addAction( "newContact", newContact_ );
actionCollection_->addAction( "newGroup", newGroup_ );
actionCollection_->addAction( "exportList", exportList_ );
actionCollection_->addAction( "searchForContact", searchForContact );
actionCollection_->addAction( "searchByInterest", searchByInterest );
actionCollection_->addAction( "showHistoryBox", showHistoryBoxAction_);
actionCollection_->addAction( "showSearch", showSearchAction_ );
actionCollection_->addAction( "chatHistory", showHistory_ );
actionCollection_->addAction( "newAccount", newAccount );
actionCollection_->addAction( "settingsAccount", showSettingsAction_ );
actionCollection_->addAction( "settingsGlobal", globalSettings_ );
actionCollection_->addAction( "contextMenu", contextMenuAction_ );
#ifdef KMESS_NETWORK_WINDOW
showNetworkAction_ = new KAction( KIcon("network-workgroup"), i18n("Show &Network Window"), this );
connect( showNetworkAction_, SIGNAL( triggered(bool) ), this, SLOT( showNetworkWindow() ) );
showNetworkAction_ = new KAction( KIcon("network-workgroup"), i18n("Show &Network Window..."), this );
connect( showNetworkAction_, SIGNAL( triggered(bool) ),
this, SLOT ( showNetworkWindow() ) );
actionCollection_->addAction( "showNetwork", showNetworkAction_ );
#endif
// Connect the actions
// connect( showToolBar_, SIGNAL( triggered(bool) ), this, SLOT( showToolBar() ) );
connect( viewMode_, SIGNAL( triggered(int) ), this, SLOT( changeViewMode(int) ) );
connect( listPictureSize_,SIGNAL( triggered(int) ), this, SLOT( changedListPictureSize(int) ) );
connect( showAllowedAction_, SIGNAL( triggered(bool) ), this, SLOT( toggleShowAllowed(bool) ) );
connect( showOfflineAction_, SIGNAL( triggered(bool) ), this, SLOT( toggleShowOffline(bool) ) );
connect( showRemovedAction_, SIGNAL( triggered(bool) ), this, SLOT( toggleShowRemoved(bool) ) );
connect( showEmptyAction_, SIGNAL( triggered(bool) ), this, SLOT( toggleShowEmpty(bool) ) );
connect( showTransferAction_, SIGNAL( triggered(bool) ), this, SLOT( showTransferWindow() ) );
// Plug the items into "view"
viewMenu_->addAction( showAllowedAction_ );
viewMenu_->addAction( showRemovedAction_ );
viewMenu_->addAction( showOfflineAction_ );
viewMenu_->addAction( showEmptyAction_ );
viewMenu_->addSeparator();
viewMenu_->addAction( listPictureSize_);
viewMenu_->addSeparator();
viewMenu_->addAction( viewMode_ );
viewMenu_->addSeparator();
viewMenu_->addAction( showTransferAction_ );
viewMenu_->addSeparator();
// viewMenu_->addAction( showToolBar_ );
viewMenu_->addAction( showMenuBar_ );
viewMenu_->addAction( showStatusBar_ );
#ifdef KMESS_NETWORK_WINDOW
viewMenu_->addSeparator();
viewMenu_->addAction( showNetworkAction_ );
#endif
// Plug the menu into the menubar
menuBar()->addMenu( viewMenu_ );
}
// "Add new account" has been selected from the menu.
void KMessInterface::createNewAccount()
{
@@ -399,36 +325,16 @@ void KMessInterface::disconnectClicked()
// connected to the server.
void KMessInterface::enableMenus(bool connected)
{
connectActionMenu_->setEnabled( !connected );
disconnect_->setEnabled( connected );
if ( connected )
{
disconnect_->setIcon( KIcon("network-connect") );
stateChanged("connected");
}
else
{
disconnect_->setIcon( KIcon("network-disconnect") );
stateChanged("disconnected");
}
status_->setEnabled( connected );
newContact_ ->setEnabled( connected );
newGroup_ ->setEnabled( connected );
showAllowedAction_ ->setEnabled( connected );
showOfflineAction_ ->setEnabled( connected );
showRemovedAction_ ->setEnabled( connected );
showEmptyAction_ ->setEnabled( connected );
listPictureSize_->setEnabled( connected );
showProfile_ ->setEnabled( connected );
viewMode_ ->setEnabled( connected );
// showNetworkAction should ALWAYS be enabled!
}
// Show the user manual for KMess.
void KMessInterface::helpContents()
{
KToolInvocation::invokeHelp("kmess/index");
}
@@ -461,9 +367,36 @@ bool KMessInterface::initialize()
connect( onlineTimer_, SIGNAL( timeout() ),
this, SLOT( updateOnlineTimer() ) );
#ifdef KMESSTEST
// Enable LikeBack
LikeBack *likeBack = new LikeBack( LikeBack::AllButtons, true );
likeBack->setServer( "www.kmess.org", "/likeback/send.php", 80 );
likeBack->setWindowNamesListing( LikeBack::AllWindows );
QStringList acceptedLocales;
acceptedLocales << "en" << "nl" << "it" << "fr" << "de" << "es" << "el" << "hu";
likeBack->setAcceptedLanguages( acceptedLocales );
likeBack->sendACommentAction( actionCollection() );
#endif
// Create the menus
createMenus();
// Build the gui from xml (without toolbar support)
setupGUI( ( Keys | StatusBar | Create | Save ), "kmessinterfaceui.rc" );
// Autosave all GUI settings
#if KDE_IS_VERSION(4,0,70)
setAutoSaveSettings( KMessConfig::instance()->getGlobalConfig( "ContactListWindow" ),
true /* save WindowSize */ );
#else
setAutoSaveSettings( "ContactListWindow", true /* save WindowSize */ );
#endif
// Autosave all GUI settings
setAutoSaveSettings( "KMessInterface", true /* save WindowSize */ );
if ( ! initSystemTrayWidget() )
{
kDebug() << "Couldn't initialize the system tray widget.";
@@ -481,8 +414,6 @@ bool KMessInterface::initialize()
// Initialize the system tray widget
bool KMessInterface::initSystemTrayWidget()
{
bool initialized;
// Create the widget
systemTrayWidget_ = new SystemTrayWidget( this ) ;
if ( systemTrayWidget_ == 0 )
@@ -491,22 +422,14 @@ bool KMessInterface::initSystemTrayWidget()
return false;
}
// Initialize the widget
initialized = systemTrayWidget_->initialize();
if ( !initialized )
{
kDebug() << "Couldn't initialize system tray widget.";
return false;
}
// Plug some of the menu actions into the system tray widget's menu.
QMenu *menu = systemTrayWidget_->menu();
menu->addAction( connectActionMenu_ );
menu->addAction( disconnect_ );
menu->addSeparator();
menu->addAction( status_ );
menu->addMenu( status_ );
menu->addSeparator();
menu->addAction( settingsActionMenu_ );
menu->addAction( showSettingsAction_ );
menu->addAction( globalSettings_ );
// Make the connections for the system tray widget
@@ -617,7 +540,7 @@ bool KMessInterface::queryClose()
}
else
{
// Tell that KMess is still visible in the tray
// Tell that KMess is still visible in the tray
systemTrayWidget_->displayCloseMessage();
#ifdef KMESSDEBUG_KMESSINTERFACE
@@ -651,6 +574,10 @@ void KMessInterface::readProperties( const KConfigGroup &config )
group = config;
}
// Resize the window to decent dimensions if there's no saved state.
resize( 300, 500 );
restoreWindowSize( group );
// Pull in the window size and position
QSize windowsize = group.readEntry( "Size", QSize() );
if(!windowsize.isEmpty())
@@ -663,7 +590,7 @@ void KMessInterface::readProperties( const KConfigGroup &config )
move(position);
}
bool bViewMenubar = group.readEntry( "Show Menubar", true );
bool bViewMenubar = group.readEntry( "ShowMenuBar", true );
showMenuBar_->setChecked( bViewMenubar );
menuBar()->setVisible( bViewMenubar );
@@ -674,8 +601,7 @@ void KMessInterface::readProperties( const KConfigGroup &config )
showToolBar();
*/
bool bViewStatusbar = group.readEntry( "Show Statusbar", true );
showStatusBar_->setChecked( bViewStatusbar );
showStatusBar_->setChecked( group.readEntry( "ShowStatusBar", true ) );
showStatusBar();
// bar position settings
@@ -708,8 +634,8 @@ void KMessInterface::saveProperties(KConfigGroup &config)
group.writeEntry("Size", size() );
group.writeEntry("Position", pos() );
// group.writeEntry("Show Toolbar", showToolBar_->isChecked() );
group.writeEntry("Show Menubar", showMenuBar_->isChecked());
group.writeEntry("Show Statusbar", showStatusBar_->isChecked() );
group.writeEntry("ShowMenuBar", showMenuBar_ ->isChecked() );
group.writeEntry("ShowStatusBar", showStatusBar_->isChecked() );
// save the toolbar settings
/* KConfigGroup mainToolBarGroup = group.group( "mainToolBar" );
@@ -755,13 +681,33 @@ void KMessInterface::showGlobalSettings()
// "Show menu bar" was toggled.
void KMessInterface::showMenuBar()
{
if( ! showMenuBar_->isChecked() )
// Just show the menubar if it was hidden
if( ! menuBar()->isVisible() )
{
menuBar()->hide();
menuBar()->setVisible( true );
return;
}
// Ask the user if he/she really wants to hide the menubar, to avoid mistakes
// TODO: If the user disables the shortcut for the menu action, no shortcuts will be shown
int res = KMessageBox::questionYesNo( this,
i18nc( "Question dialog box message",
"<html>Are you sure you want to hide the menu bar? "
"You will be able to show it again by using this "
"keyboard shortcut: <b>%1</b></html>",
showMenuBar_->shortcut().primary().toString( QKeySequence::NativeText ) ),
i18nc( "Dialog box caption: hiding the menu bar", "Hiding the Menu" ),
KStandardGuiItem::yes(),
KStandardGuiItem::no(),
"hideMenuBarQuestion" );
if( res == KMessageBox::Yes )
{
menuBar()->setVisible( showMenuBar_->isChecked() );
}
else
{
menuBar()->show();
showMenuBar_->setChecked( true );
}
}
@@ -770,14 +716,7 @@ void KMessInterface::showMenuBar()
// "Show status bar" was toggled.
void KMessInterface::showStatusBar()
{
if(!showStatusBar_->isChecked())
{
statusBar()->hide();
}
else
{
statusBar()->show();
}
statusBar()->setVisible( showStatusBar_->isChecked() );
}
@@ -803,8 +742,6 @@ void KMessInterface::showUserProfile()
kDebug() << "not implemented";
}
// Change the status bar message.
void KMessInterface::statusMessage( QString message, bool isError )
{
@@ -856,6 +793,14 @@ void KMessInterface::toggleShowEmpty(bool /*show*/)
// The "show history box" menu item has been toggled.
void KMessInterface::toggleShowHistoryBox(bool /*show*/)
{
kDebug() << "not implemented";
}
// The "show search in contact list" menu item has been toggled.
void KMessInterface::toggleShowSearchFrame(bool /*show*/)
{