Commit d4b4bd9b authored by Daniel Molkentin's avatar Daniel Molkentin
Browse files

replacing splash screen with an in place introduction screen

svn path=/trunk/kdepim/; revision=384982
parent a67f55d7
SUBDIRS = icons
pics_DATA = splash.png
picsdir = $(kde_datadir)/kontact/pics
SUBDIRS = about
INCLUDES = -I$(top_srcdir)/kontact/interfaces -I$(top_srcdir) $(all_includes)
lib_LTLIBRARIES = libkontact.la
......@@ -10,8 +12,9 @@ bin_PROGRAMS = kontact
kontact_METASOURCES = AUTO
kontact_LDFLAGS = $(all_libraries) $(KDE_RPATH)
kontact_LDADD = $(top_builddir)/libkdepim/libkdepim.la \
$(top_builddir)/kontact/interfaces/libkpinterfaces.la libkontact.la $(LIB_KPARTS) $(LIB_KUTILS)
kontact_SOURCES = main.cpp mainwindow.cpp splash.cpp sidepanebase.cpp \
$(top_builddir)/kontact/interfaces/libkpinterfaces.la libkontact.la \
$(LIB_KPARTS) $(LIB_KUTILS) $(LIB_KHTML)
kontact_SOURCES = main.cpp mainwindow.cpp sidepanebase.cpp \
sidepane.cpp iconsidepane.cpp aboutdialog.cpp
kontact_COMPILE_FIRST = prefs.h
......
......@@ -36,5 +36,7 @@
<entry type="Int" name="SidePaneIconSize">
<default>32</default>
</entry>
<entry type="String" name="LastVersionSeen">
</entry>
</group>
</kcfg>
......@@ -34,7 +34,6 @@
#include "plugin.h"
#include <qlabel.h>
#include "splash.h"
#include "prefs.h"
#include "mainwindow.h"
......@@ -73,7 +72,6 @@ static void listPlugins()
static KCmdLineOptions options[] =
{
{ "module <module>", I18N_NOOP("Start with a specific Kontact module"), 0 },
{ "nosplash", I18N_NOOP("Disable the splash screen"), 0 },
{ "iconify", I18N_NOOP("Start in iconified (minimized) mode"), 0 },
{ "list", I18N_NOOP("List all possible modules and exit"), 0 },
KCmdLineLastOption
......@@ -92,21 +90,18 @@ int KontactApp::newInstance()
{
moduleName = QString::fromLocal8Bit(args->getOption("module"));
}
Kontact::Splash* splash = new Kontact::Splash( 0, "splash" );
if ( !mMainWindow && args->isSet("splash") ) // only the first time
splash->show();
if ( isRestored() ) {
// There can only be one main window
if ( KMainWindow::canBeRestored( 1 ) ) {
mMainWindow = new Kontact::MainWindow(splash);
mMainWindow = new Kontact::MainWindow();
setMainWidget( mMainWindow );
mMainWindow->show();
mMainWindow->restore( 1 );
}
} else {
if ( !mMainWindow ) {
mMainWindow = new Kontact::MainWindow( splash );
mMainWindow = new Kontact::MainWindow();
if ( !moduleName.isEmpty() )
mMainWindow->activePluginModule( moduleName );
mMainWindow->show();
......
......@@ -56,6 +56,12 @@
#include <ksettings/componentsdialog.h>
#include <kstringhandler.h>
#include <krsqueezedtextlabel.h>
#include <khtml_part.h>
#include <khtmlview.h>
#include <libkdepim/kfileio.h>
#include <kcursor.h>
#include <krun.h>
#include <kaboutdata.h>
#include <infoextension.h>
......@@ -68,14 +74,12 @@
#include "progressdialog.h"
#include "statusbarprogresswidget.h"
#include "broadcaststatus.h"
#include "splash.h"
using namespace Kontact;
MainWindow::MainWindow(Kontact::Splash *splash)
MainWindow::MainWindow()
: Kontact::Core(), mTopWidget( 0 ), mHeaderText( 0 ), mHeaderPixmap( 0 ), mSplitter( 0 ),
mSplash( splash ), mCurrentPlugin( 0 ), mLastInfoExtension( 0 ), mAboutDialog( 0 ),
mReallyClose( false )
mCurrentPlugin( 0 ), mLastInfoExtension( 0 ), mAboutDialog( 0 ), mReallyClose( false )
{
// Set this to be the group leader for all subdialogs - this means
// modal subdialogs will only affect this dialog, not the other windows
......@@ -104,6 +108,13 @@ void MainWindow::initGUI()
resize( 700, 520 ); // initial size to prevent a scrollbar in sidepane
setAutoSaveSettings();
// ### why doesn't that work?
if (Prefs::self()->lastVersionSeen() == kapp->aboutData()->version())
{
mMainStack->raiseWidget( mTopWidget );
Prefs::self()->setLastVersionSeen(kapp->aboutData()->version());
}
}
......@@ -115,15 +126,9 @@ void MainWindow::initObject()
QString( "[X-KDE-KontactPluginVersion] == %1" ).arg( KONTACT_PLUGIN_VERSION ) );
mPluginInfos = KPluginInfo::fromServices( offers, Prefs::self()->config(), "Plugins" );
QProgressBar *bar = mSplash->progressBar();
int count = 3;
count += mPluginInfos.count();
bar->setTotalSteps( count );
KPluginInfo::List::Iterator it;
for ( it = mPluginInfos.begin(); it != mPluginInfos.end(); ++it ) {
( *it )->load();
bar->setProgress( bar->progress() + 1 );
}
......@@ -134,29 +139,19 @@ void MainWindow::initObject()
loadPlugins();
bar->setProgress( bar->progress() + 1 );
if ( mSidePane )
mSidePane->updatePlugins();
// flush paint events
kapp->processEvents();
bar->setProgress( bar->progress() + 1 );
KSettings::Dispatcher::self()->registerInstance( instance(), this,
SLOT( updateConfig() ) );
loadSettings();
bar->setProgress( bar->progress() + 1 );
statusBar()->show();
// we are done - remove splash
delete mSplash;
mSplash=0;
showTip( false );
// done initializing
......@@ -206,13 +201,20 @@ void MainWindow::activatePluginModule()
void MainWindow::initWidgets()
{
QHBox *topWidget = new QHBox( this );
topWidget->setFrameStyle( QFrame::Panel | QFrame::Sunken );
// master stack
mMainStack = new QWidgetStack( this );
setCentralWidget( mMainStack );
mTopWidget = topWidget;
// includes sidebar and part stack
mTopWidget = new QHBox( mMainStack );
mTopWidget->setFrameStyle( QFrame::Panel | QFrame::Sunken );
mMainStack->addWidget( mTopWidget );
setCentralWidget( mTopWidget );
// holds about screen
initAboutScreen();
//mMainStack->raiseWidget( mTopWidget );
// init appropriate sidebar (disabled for now)
mSidePaneType = Prefs::self()->mSidePaneType;
QHBox *mBox = 0;
......@@ -234,6 +236,8 @@ void MainWindow::initWidgets()
QSizePolicy::Preferred ) );
}
mSidePane->setActionCollection( actionCollection() );
connect( mSidePane, SIGNAL( pluginSelected( Kontact::Plugin * ) ),
......@@ -252,7 +256,7 @@ void MainWindow::initWidgets()
vBox->setSpacing( 0 );
mStack = new QWidgetStack( vBox );
mPartsStack = new QWidgetStack( vBox );
/* Create a progress dialog and hide it. */
KPIM::ProgressDialog *progressDialog = new KPIM::ProgressDialog( statusBar(), this );
......@@ -266,8 +270,60 @@ void MainWindow::initWidgets()
statusBar()->addWidget( mStatusMsgLabel, 10 , false );
statusBar()->addWidget( mLittleProgress, 0 , true );
mLittleProgress->show();
// keep introscreen
// ### maybe add links and text only past this point?
}
void MainWindow::initAboutScreen()
{
QHBox *introbox = new QHBox( mMainStack );
mMainStack->addWidget( introbox );
mMainStack->raiseWidget(introbox);
KHTMLPart *introPart = new KHTMLPart( introbox );
introPart->widget()->setFocusPolicy( WheelFocus );
// Let's better be paranoid and disable plugins (it defaults to enabled):
introPart->setPluginsEnabled( false );
introPart->setJScriptEnabled( false ); // just make this explicit
introPart->setJavaEnabled( false ); // just make this explicit
introPart->setMetaRefreshEnabled( false );
introPart->setURLCursor( KCursor::handCursor() );
introPart->view()->setLineWidth( 0 );
QString location = locate( "data", "kontact/about/main.html" );
QString content = KPIM::kFileToString( location );
introPart->begin(KURL( location ) );
QString appName(i18n("Kontact"));
QString catchPhrase(i18n("Get Organized!"));
QString quickDescription(i18n("The KDE Personal Information Management Suite"));
QString info = i18n("<h2 style='text-align:center; margin-top: 0px;'>Welcome to Kontact %1</h2>"
"<p>%2</p><ul>"
"<li><a href=\"%3\">Read Manual</a></li>"
"<li><a href=\"%4\">Visit Kontact Website</a></li>"
"<li><a href=\"%5\">Configure Kontact as Groupware Client</a></li>"
"</ul><p style=\"margin-bottom: 0px\"> <a href=\"%6\">Skip this introduction</a></p>")
.arg(kapp->aboutData()->version())
.arg(i18n("Some introductionary text goes here..."))
.arg("help:/kontact")
.arg("http://kontact.kde.org")
.arg("exec:/gwwizard")
.arg("exec:/switch");
introPart->write( content.arg( QFont().pointSize() ).arg( appName )
.arg( catchPhrase ).arg( quickDescription ).arg( info ) );
introPart->end();
connect(introPart->browserExtension(),
SIGNAL(openURLRequest(const KURL &, const KParts::URLArgs &)),
SLOT(slotOpenUrl(const KURL &)));
connect(introPart->browserExtension(),
SIGNAL(createNewWindow(const KURL &, const KParts::URLArgs &)),
SLOT(slotOpenUrl(const KURL &)));
}
void MainWindow::setupActions()
{
KStdAction::quit( this, SLOT( slotQuit() ), actionCollection() );
......@@ -456,10 +512,10 @@ void MainWindow::addPlugin( Kontact::Plugin *plugin )
void MainWindow::partLoaded( Kontact::Plugin * /*plugin*/, KParts::ReadOnlyPart *part )
{
// See if we have this part already (e.g. due to two plugins sharing it)
if ( mStack->id( part->widget() ) != -1 )
if ( mPartsStack->id( part->widget() ) != -1 )
return;
mStack->addWidget( part->widget() );
mPartsStack->addWidget( part->widget() );
mPartManager->addPart( part, false );
// Workaround for KParts misbehavior: addPart calls show!
......@@ -481,7 +537,7 @@ void MainWindow::slotActivePartChanged( KParts::Part *part )
}
kdDebug(5600) << "Part activated: " << part << " with stack id. "
<< mStack->id( part->widget() )<< endl;
<< mPartsStack->id( part->widget() )<< endl;
QObjectList *l = part->queryList( "KParts::InfoExtension" );
KParts::InfoExtension *ie = 0;
if ( l )
......@@ -561,7 +617,7 @@ void MainWindow::selectPlugin( Kontact::Plugin *plugin )
Q_ASSERT( view );
if ( view ) {
mStack->raiseWidget( view );
mPartsStack->raiseWidget( view );
view->show();
if ( mFocusWidgets.contains( plugin->identifier() ) ) {
......@@ -829,6 +885,26 @@ void MainWindow::slotNewToolbarConfig()
applyMainWindowSettings( KGlobal::config(), "MainWindow" );
}
void MainWindow::slotOpenUrl(const KURL &url)
{
kdDebug() << url.url() << endl;
if (url.protocol() == "exec")
{
if (url.path() == "/switch" )
{
mMainStack->raiseWidget( mTopWidget );
}
if (url.path() == "/gwwizard" )
{
KRun::runCommand("groupwarewizard");
slotQuit();
}
}
else
new KRun(url, this);
}
bool MainWindow::queryClose()
{
if ( kapp->sessionSaving() || mReallyClose )
......@@ -847,7 +923,6 @@ bool MainWindow::queryClose()
return localClose;
}
void MainWindow::slotShowStatusMsg( const QString &msg )
{
if ( !statusBar() || !mStatusMsgLabel )
......
......@@ -40,6 +40,7 @@ class KRSqueezedTextLabel;
class QHBox;
class QSplitter;
class QVBox;
class QFrame;
namespace KPIM
{
......@@ -63,7 +64,6 @@ struct InfoExtData
class Plugin;
class SidePaneBase;
class AboutDialog;
class Splash;
typedef QValueList<Kontact::Plugin*> PluginList;
......@@ -72,7 +72,7 @@ class MainWindow : public Kontact::Core, public KDCOPServiceStarter
Q_OBJECT
public:
MainWindow(Splash *splash);
MainWindow();
~MainWindow();
// KDCOPServiceStarter interface
......@@ -108,10 +108,11 @@ class MainWindow : public Kontact::Core, public KDCOPServiceStarter
void showAboutDialog();
void slotShowStatusMsg( const QString& );
void activatePluginModule();
void slotOpenUrl(const KURL &url);
protected:
void initWidgets();
void initAboutScreen();
void loadSettings();
void saveSettings();
......@@ -136,18 +137,17 @@ class MainWindow : public Kontact::Core, public KDCOPServiceStarter
void configureToolbars();
private:
QWidget *mTopWidget;
QFrame *mTopWidget;
QHBox *mHeaderFrame;
QLabel *mHeaderText;
QLabel *mHeaderPixmap;
QSplitter *mSplitter;
Splash *mSplash;
KToolBarPopupAction *mNewActions;
SidePaneBase *mSidePane;
QWidgetStack *mStack;
QWidgetStack *mMainStack;
QWidgetStack *mPartsStack;
Plugin *mCurrentPlugin;
KParts::PartManager *mPartManager;
PluginList mPlugins;
......
/*
This file is part of the KDE project
Copyright (C) 2002 Daniel Molkentin <molkentin@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qcursor.h>
#include <qdesktopwidget.h>
#include <qlabel.h>
#include <qprogressbar.h>
#include <kapplication.h>
#include <kglobalsettings.h>
#include <kiconloader.h>
#include "splash.h"
using namespace Kontact;
Splash::Splash( QWidget *parent, const char *name )
: QVBox( parent, name, WStyle_Customize | WStyle_Splash )
{
QLabel *lbl = new QLabel( this );
QPixmap splash( UserIcon( "splash" ) );
lbl->setBackgroundPixmap( splash );
mProgressBar = new QProgressBar( this );
resize( splash.size() );
setFrameStyle( QFrame::Box | QFrame::Plain );
QRect desk = KGlobalSettings::splashScreenDesktopGeometry();
setGeometry( ( desk.width() / 2 ) - ( width() / 2 ) + desk.left(),
( desk.height() / 2 ) - ( height() / 2 ) + desk.top(),
width(), height() );
}
#include "splash.moc"
/*
This file is part of the KDE project
Copyright (C) 2002 Daniel Molkentin <molkentin@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef SPLASH_H
#define SPLASH_H
#include <qvbox.h>
class QProgressBar;
namespace Kontact {
class Splash : public QVBox
{
Q_OBJECT
public:
Splash( QWidget *parent, const char *name = 0 );
~Splash() {};
QProgressBar* progressBar() const { return mProgressBar; }
protected:
QProgressBar* mProgressBar;
};
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment