• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdefile
 

tdeio/tdefile

  • tdeio
  • tdefile
tdefilespeedbar.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
3 
4  library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation, version 2.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #include "tdefilespeedbar.h"
20 #include "config-tdefile.h"
21 
22 #include <tqdir.h>
23 #include <tqfile.h>
24 #include <tqtextcodec.h>
25 #include <tqtextstream.h>
26 
27 #include <tdeconfig.h>
28 #include <tdeglobal.h>
29 #include <tdeglobalsettings.h>
30 #include <tdelocale.h>
31 #include <kprotocolinfo.h>
32 #include <kstandarddirs.h>
33 #include <kurl.h>
34 
35 KFileSpeedBar::KFileSpeedBar( TQWidget *parent, const char *name )
36  : KURLBar( true, parent, name )
37 {
38  TDEConfig *config = TDEGlobal::config();
39  TDEConfigGroupSaver cs( config, ConfigGroup );
40  m_initializeSpeedbar = config->readBoolEntry( "Set speedbar defaults",
41  true );
42  setIconSize(TDEIcon::SizeSmallMedium);
43  readConfig( TDEGlobal::config(), "KFileDialog Speedbar" );
44 
45  if ( m_initializeSpeedbar )
46  {
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");
56 
57  KURL u = "media:/";
58  if (KProtocolInfo::isKnownProtocol(u))
59  {
60  insertItem(u, i18n("Storage Media"), false, KProtocolInfo::icon("media"));
61  }
62 
63  u = "remote:/";
64  if (KProtocolInfo::isKnownProtocol(u))
65  {
66  insertItem(u, i18n("Network Folders"), false, KProtocolInfo::icon("remote"));
67  }
68  }
69 }
70 
71 KFileSpeedBar::~KFileSpeedBar()
72 {
73 }
74 
75 void KFileSpeedBar::save( TDEConfig *config )
76 {
77  if ( m_initializeSpeedbar && isModified() )
78  {
79  TDEConfigGroup conf( config, ConfigGroup );
80  // write to kdeglobals
81  conf.writeEntry( "Set speedbar defaults", false, true, true );
82  }
83 
84  writeConfig( config, "KFileDialog Speedbar" );
85 }
86 
87 TQSize KFileSpeedBar::sizeHint() const
88 {
89  TQSize sizeHint = KURLBar::sizeHint();
90  int ems = fontMetrics().width("mmmmmmmmmmmm");
91  if (sizeHint.width() < ems)
92  {
93  sizeHint.setWidth(ems);
94  }
95  return sizeHint;
96 }
97 
98 #include "tdefilespeedbar.moc"
KURLBar
KURLBar is a widget that displays icons together with a description.
Definition: kurlbar.h:231
KURLBar::sizeHint
virtual TQSize sizeHint() const
Definition: kurlbar.cpp:471

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.9.1
This website is maintained by Timothy Pearson.