19 #include "tdefilespeedbar.h"
20 #include "config-tdefile.h"
24 #include <tqtextcodec.h>
25 #include <tqtextstream.h>
27 #include <tdeconfig.h>
28 #include <tdeglobal.h>
29 #include <tdeglobalsettings.h>
30 #include <tdelocale.h>
31 #include <kprotocolinfo.h>
32 #include <kstandarddirs.h>
35 KFileSpeedBar::KFileSpeedBar( TQWidget *parent,
const char *name )
38 TDEConfig *config = TDEGlobal::config();
39 TDEConfigGroupSaver cs( config, ConfigGroup );
40 m_initializeSpeedbar = config->readBoolEntry(
"Set speedbar defaults",
42 setIconSize(TDEIcon::SizeSmallMedium);
43 readConfig( TDEGlobal::config(),
"KFileDialog Speedbar" );
45 if ( m_initializeSpeedbar )
47 insertItem(TQDir::homeDirPath(), i18n(
"Home Folder"),
false,
"folder_home");
48 insertItem(TDEGlobalSettings::desktopPath(), i18n(
"Desktop"),
false,
"desktop");
49 insertItem(TDEGlobalSettings::documentPath(), i18n(
"Documents"),
false,
"folder_wordprocessing");
50 insertItem(TDEGlobalSettings::downloadPath(), i18n(
"Downloads" ),
false,
"folder_html");
51 insertItem(TDEGlobalSettings::musicPath(), i18n(
"Music" ),
false,
"folder_sound");
52 insertItem(TDEGlobalSettings::picturesPath(), i18n(
"Pictures" ),
false,
"folder_image");
53 insertItem(TDEGlobalSettings::publicSharePath(), i18n(
"Public" ),
false,
"folder_open");
54 insertItem(TDEGlobalSettings::templatesPath(), i18n(
"Templates" ),
false,
"folder_grey");
55 insertItem(TDEGlobalSettings::videosPath(), i18n(
"Videos" ),
false,
"folder_video");
58 if (KProtocolInfo::isKnownProtocol(u))
60 insertItem(u, i18n(
"Storage Media"),
false, KProtocolInfo::icon(
"media"));
64 if (KProtocolInfo::isKnownProtocol(u))
66 insertItem(u, i18n(
"Network Folders"),
false, KProtocolInfo::icon(
"remote"));
71 KFileSpeedBar::~KFileSpeedBar()
75 void KFileSpeedBar::save( TDEConfig *config )
77 if ( m_initializeSpeedbar && isModified() )
79 TDEConfigGroup conf( config, ConfigGroup );
81 conf.writeEntry(
"Set speedbar defaults",
false,
true,
true );
84 writeConfig( config,
"KFileDialog Speedbar" );
87 TQSize KFileSpeedBar::sizeHint()
const
90 int ems = fontMetrics().width(
"mmmmmmmmmmmm");
91 if (sizeHint.width() < ems)
93 sizeHint.setWidth(ems);
98 #include "tdefilespeedbar.moc"
KURLBar is a widget that displays icons together with a description.
virtual TQSize sizeHint() const