Commit aa5f0143 authored by Christian Loose's avatar Christian Loose

* Remove CervisiaShell's dependency on CervisiaPart
* Moved filter status indicator to CervisiaPart

svn path=/trunk/kdesdk/cervisia/; revision=206106
parent b2108c60
2003-02-10 Christian Loose <christian.loose@hamburg.de>
* Remove CervisiaShell's dependency on CervisiaPart
* Moved filter status indicator to CervisiaPart
2003-02-06 Christian Loose <christian.loose@hamburg.de>
* Try to get the user name and email address for the
......
......@@ -12,11 +12,12 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <qlabel.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include <qtextstream.h>
#include <qtooltip.h>
#include <qcursor.h>
#include <kaboutdata.h>
#include <kaction.h>
......@@ -25,6 +26,7 @@
#include <kinstance.h>
#include <klocale.h>
#include <kprocess.h>
#include <kstatusbar.h>
#include <kstdaction.h>
#include <kxmlguifactory.h>
#include <krun.h>
......@@ -116,6 +118,21 @@ CervisiaPart::CervisiaPart( QWidget *parentWidget, const char *widgetName,
protocol->setFocusPolicy( QWidget::StrongFocus );
setWidget(splitter);
#if KDE_IS_VERSION(3,1,90)
statusBar = new CervisiaStatusBarExtension(this);
// create the active filter indicator and add it to the statusbar
filterLabel = new QLabel("UR", statusBar->statusBar());
filterLabel->setFixedSize(filterLabel->sizeHint());
filterLabel->setText("");
QToolTip::add(filterLabel,
i18n("F - All files are hidden, the tree shows only directories\n"
"N - All up-to-date files are hidden\n"
"R - All removed files are hidden"));
statusBar->addStatusBarItem(filterLabel, 0, true);
#endif
setupActions();
readSettings();
connect( update, SIGNAL( selectionChanged() ), this, SLOT( updateActions() ) );
......@@ -1606,9 +1623,7 @@ void CervisiaPart::setFilter()
str += "R";
}
// TODO: Find a new way to handle the status items as you can't do this with KParts yet
//filterLabel->setText(str);
emit filterStatusChanged(str);
filterLabel->setText(str);
}
......
......@@ -15,9 +15,13 @@
#ifndef CERVISIAPART_H
#define CERVISIAPART_H
#include <kdeversion.h>
#include <kparts/part.h>
#include <kparts/browserextension.h>
#include <kparts/genericfactory.h>
#if KDE_IS_VERSION(3,1,90)
#include <kparts/statusbarextension.h>
#endif
#include "addremovedlg.h"
#include "commitdlg.h"
......@@ -34,6 +38,19 @@ class KAboutData;
class KRecentFilesAction;
class CvsService_stub;
#if KDE_IS_VERSION(3,1,90)
class CervisiaStatusBarExtension : public KParts::StatusBarExtension
{
public:
CervisiaStatusBarExtension(KParts::ReadOnlyPart* parent)
: KParts::StatusBarExtension(parent, "CervisiaStatusBarExtension")
{
}
};
#endif
/**
* An embeddable Cervisia viewer.
*/
......@@ -55,9 +72,6 @@ public:
static KAboutData* createAboutData();
signals:
void filterStatusChanged(QString status);
public slots:
// unused because we overwrite the default behaviour of openURL()
virtual bool openFile() { return true; }
......@@ -109,6 +123,7 @@ public slots:
void slotHideFiles();
void slotHideUpToDate();
void slotHideRemoved();
void slotHideNotInCVS();
void slotHideEmptyDirectories();
......@@ -151,8 +166,6 @@ private:
bool hasRunningJob;
QSplitter *splitter;
// TODO: Find a new way to handle the status items as you can't do this with KParts yet
// QLabel *filterLabel;
QString sandbox;
QString repository;
......@@ -166,6 +179,10 @@ private:
KRecentFilesAction *recent;
CvsService_stub* cvsService;
#if KDE_IS_VERSION(3,1,90)
CervisiaStatusBarExtension* statusBar;
QLabel* filterLabel;
#endif
};
typedef KParts::GenericFactory<CervisiaPart> CervisiaFactory;
......
......@@ -15,21 +15,19 @@
#include "cervisiashell.h"
#include <qlabel.h>
#include <qtooltip.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kedittoolbar.h>
#include <kfiledialog.h>
#include <khelpmenu.h>
#include <kkeydialog.h>
#include <klibloader.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kstdaction.h>
#include <kstatusbar.h>
#include <kurl.h>
#include "cervisiapart.h"
CervisiaShell::CervisiaShell( const char *name )
......@@ -40,8 +38,8 @@ CervisiaShell::CervisiaShell( const char *name )
KLibFactory* factory = KLibLoader::self()->factory("libcervisiapart");
if( factory )
{
part = static_cast<CervisiaPart*>(factory->create(this,
"cervisiaview", "CervisiaPart"));
part = static_cast<KParts::ReadOnlyPart*>(factory->create(this,
"cervisiaview", "KParts::ReadOnlyPart"));
if( part )
setCentralWidget(part->widget());
}
......@@ -54,18 +52,7 @@ CervisiaShell::CervisiaShell( const char *name )
setupActions();
// create the active filter indicator and add it to the statusbar
filterLabel = new QLabel("UR", statusBar());
filterLabel->setFixedSize(filterLabel->sizeHint());
filterLabel->setText("");
QToolTip::add(filterLabel, i18n("F - All files are hidden, the tree shows only directories\n"
"N - All up-to-date files are hidden\n"
"R - All removed files are hidden"));
statusBar()->addWidget(filterLabel, 0, true);
connect( part, SIGNAL( filterStatusChanged(QString) ),
this, SLOT( slotChangeFilterStatus(QString) ) );
//
// Magic needed for status texts
//
......@@ -164,11 +151,6 @@ void CervisiaShell::slotNewToolbarConfig()
applyMainWindowSettings( KGlobal::config(), autoSaveGroup() );
}
void CervisiaShell::slotChangeFilterStatus(QString status)
{
filterLabel->setText(status);
}
bool CervisiaShell::queryExit()
{
writeSettings();
......@@ -192,7 +174,7 @@ void CervisiaShell::writeSettings()
KConfig* config = KGlobal::config();
config->setGroup("Session");
config->writeEntry("Current Directory", part->sandBox());
config->writeEntry("Current Directory", part->url().path());
// write to disk
config->sync();
......
......@@ -18,8 +18,6 @@
#include <kparts/mainwindow.h>
class QLabel;
class CervisiaPart;
class KRecentFilesAction;
/**
......@@ -43,7 +41,6 @@ public slots:
protected slots:
void slotNewToolbarConfig();
void slotChangeFilterStatus(QString status);
protected:
void setupActions();
......@@ -54,9 +51,7 @@ private:
void readSettings();
void writeSettings();
CervisiaPart *part;
QLabel *filterLabel;
KParts::ReadOnlyPart *part;
};
#endif // CERVISIASHELL_H
......
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