parts/fileview/fileviewpart.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
#include "fileviewpart.h"
00015
00016
#include <qwhatsthis.h>
00017
#include <qvbox.h>
00018
#include <qtoolbutton.h>
00019
#include <qdom.h>
00020
#include <kcombobox.h>
00021
#include <qtimer.h>
00022
#include <kaction.h>
00023
#include <kdebug.h>
00024
#include <kiconloader.h>
00025
#include <klocale.h>
00026
#include <kdevgenericfactory.h>
00027
#include <kdialogbase.h>
00028
00029
#include "kdevcore.h"
00030
#include "kdevproject.h"
00031
#include "kdevmainwindow.h"
00032
00033
#include "partwidget.h"
00034
#include "domutil.h"
00035
#include "filetreewidget.h"
00036
#include "vcscolorsconfigwidget.h"
00037
#include "kdevversioncontrol.h"
00038
00039 #define FILETREE_OPTIONS 1
00040
00042
00044
00045 VCSColors FileViewPart::vcsColors;
00046
00048
00050
00051 typedef KDevGenericFactory<FileViewPart> FileViewFactory;
00052
static const KAboutData data(
"kdevfileview",
I18N_NOOP(
"File Tree"),
"1.0");
00053 K_EXPORT_COMPONENT_FACTORY( libkdevfileview,
FileViewFactory( &data ) )
00054
00055
00056
00058
00059
FileViewPart::
FileViewPart(
QObject *parent, const
char *name, const
QStringList &)
00060 :
KDevPlugin("FileView", "fileview", parent, name ? name : "
FileViewPart"),
00061 m_widget( 0 )
00062 {
00063 setInstance( FileViewFactory::instance() );
00064
00065
00066 m_widget =
new PartWidget(
this );
00067 m_widget->setIcon( SmallIcon(
"folder") );
00068 mainWindow()->embedSelectView( m_widget, i18n(
"File Tree"), i18n(
"File tree view in the project directory") );
00069
00070 _configProxy =
new ConfigWidgetProxy( core() );
00071 _configProxy->createProjectConfigPage( i18n(
"File Tree"),
FILETREE_OPTIONS );
00072 connect( _configProxy, SIGNAL(insertConfigWidget(
const KDialogBase*,
QWidget*,
unsigned int )),
00073
this, SLOT(insertConfigWidget(
const KDialogBase*,
QWidget*,
unsigned int )) );
00074
00075 loadSettings();
00076
00077 m_widget->showProjectFiles();
00078 }
00079
00081
00082 FileViewPart::~FileViewPart()
00083 {
00084
if (
m_widget)
00085
mainWindow()->
removeView(
m_widget );
00086
delete m_widget;
00087
00088
storeSettings();
00089
00090
delete _configProxy;
00091 }
00092
00094
00095 void FileViewPart::loadSettings()
00096 {
00097
const QColor added =
QColor(
"#CCFF99" ),
00098 updated = QColor(
"#FFFFCC" ),
00099 modified = QColor(
"#CCCCFF" ),
00100 conflict = QColor(
"#FF6666" ),
00101 sticky = QColor(
"#FFCCCC" ),
00102 needsPatch = QColor(
"#FFCCFF" ),
00103 needsCheckout = QColor(
"#FFCCFF" ),
00104 unknown = QColor( white ),
00105 defaultColor = QColor( white );
00106
00107
KConfig *cfg =
instance()->
config();
00108
00109
KConfigGroupSaver gs( cfg,
"VCS Colors" );
00110
vcsColors.
added = cfg->
readColorEntry(
"FileAddedColor", &added );
00111
vcsColors.
updated = cfg->
readColorEntry(
"FileUpdatedColor", &updated );
00112
vcsColors.
sticky = cfg->
readColorEntry(
"FileStickyColor", &sticky );
00113
vcsColors.
modified = cfg->
readColorEntry(
"FileModifiedColor", &modified );
00114
vcsColors.
conflict = cfg->
readColorEntry(
"FileConflictColor", &conflict );
00115
vcsColors.
needsPatch = cfg->
readColorEntry(
"FileNeedsPatchColor", &needsPatch );
00116
vcsColors.
needsCheckout = cfg->
readColorEntry(
"FileNeedsCheckoutColor", &needsCheckout );
00117
vcsColors.
unknown = cfg->
readColorEntry(
"FileUnknownColor", &unknown );
00118
vcsColors.
defaultColor = cfg->
readColorEntry(
"DefaultColor", &defaultColor );
00119 }
00120
00122
00123 void FileViewPart::storeSettings()
00124 {
00125
KConfig *cfg =
instance()->
config();
00126
00127
KConfigGroupSaver gs( cfg,
"VCS Colors" );
00128 cfg->
writeEntry(
"FileAddedColor",
vcsColors.
added );
00129 cfg->
writeEntry(
"FileUpdatedColor",
vcsColors.
updated );
00130 cfg->
writeEntry(
"FileStickyColor",
vcsColors.
sticky );
00131 cfg->
writeEntry(
"FileModifiedColor",
vcsColors.
modified );
00132 cfg->
writeEntry(
"FileConflictColor",
vcsColors.
conflict );
00133 cfg->
writeEntry(
"FileNeedsPatchColor",
vcsColors.
needsPatch );
00134 cfg->
writeEntry(
"FileNeedsCheckoutColor",
vcsColors.
needsCheckout );
00135 cfg->
writeEntry(
"FileUnknownColor",
vcsColors.
unknown );
00136 cfg->
writeEntry(
"DefaultColor",
vcsColors.
defaultColor );
00137 }
00138
00139 void FileViewPart::insertConfigWidget(
const KDialogBase* dlg,
QWidget * page,
unsigned int pagenumber )
00140 {
00141
if ( pagenumber ==
FILETREE_OPTIONS )
00142 {
00143
VCSColorsConfigWidget *w =
new VCSColorsConfigWidget(
this,
vcsColors, page,
"vcscolorsconfigwidget" );
00144 connect( dlg, SIGNAL(okClicked()), w, SLOT(slotAccept()) );
00145 }
00146 }
00147
00148
#include "fileviewpart.moc"
This file is part of the documentation for KDevelop Version 3.0.4.