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

tdeio/tdefile

  • tdeio
  • tdefile
kpreviewprops.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2005 Stephan Binner <binner@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
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 
20 #include "kpreviewprops.h"
21 
22 #include <tqlayout.h>
23 
24 #include <tdefilemetapreview.h>
25 #include <tdeglobalsettings.h>
26 #include <tdelocale.h>
27 
28 class KPreviewPropsPlugin::KPreviewPropsPluginPrivate
29 {
30 public:
31  KPreviewPropsPluginPrivate() {}
32  ~KPreviewPropsPluginPrivate() {}
33 };
34 
35 KPreviewPropsPlugin::KPreviewPropsPlugin(KPropertiesDialog* props)
36  : KPropsDlgPlugin(props)
37 {
38  d = new KPreviewPropsPluginPrivate;
39 
40  if (properties->items().count()>1)
41  return;
42 
43  createLayout();
44 }
45 
46 void KPreviewPropsPlugin::createLayout()
47 {
48  // let the dialog create the page frame
49  TQFrame* topframe = properties->addPage(i18n("P&review"));
50  topframe->setFrameStyle(TQFrame::NoFrame);
51 
52  TQVBoxLayout* tmp = new TQVBoxLayout(topframe, 0, 0);
53 
54  preview = new KFileMetaPreview(topframe);
55 
56  tmp->addWidget(preview) ;
57  connect( properties, TQT_SIGNAL( aboutToShowPage( TQWidget * ) ), TQT_SLOT( aboutToShowPage( TQWidget* ) ) );
58 }
59 
60 KPreviewPropsPlugin::~KPreviewPropsPlugin()
61 {
62  delete d;
63 }
64 
65 bool KPreviewPropsPlugin::supports( KFileItemList _items )
66 {
67  if ( _items.count() != 1)
68  return false;
69  if( !TDEGlobalSettings::showFilePreview(_items.first()->url()))
70  return false;
71  KMimeType::Ptr mt = KMimeType::findByURL( _items.first()->url() );
72  if ( mt->inherits("inode/directory") || mt->name() == "application/octet-stream" )
73  return false;
74 
75  //TODO Copy everything of KFileMetaPreview::previewProviderFor() ?
76 
77  return true;
78 }
79 
80 void KPreviewPropsPlugin::aboutToShowPage( TQWidget* widget )
81 {
82  if ( TQT_TQOBJECT(widget) != TQT_TQOBJECT(preview->parent()) )
83  return;
84 
85  disconnect( properties, TQT_SIGNAL( aboutToShowPage( TQWidget * ) ), this, TQT_SLOT( aboutToShowPage( TQWidget* ) ) );
86  preview->showPreview(properties->item()->url());
87 }
88 
89 #include "kpreviewprops.moc"
KPreviewPropsPlugin::supports
static bool supports(KFileItemList _items)
Tests whether a preview for the first item should be shown.
Definition: kpreviewprops.cpp:65
KPropertiesDialog
The main properties dialog class.
Definition: kpropertiesdialog.h:70
KPropertiesDialog::item
KFileItem * item()
Definition: kpropertiesdialog.h:262
KPropsDlgPlugin
A Plugin in the Properties dialog This is an abstract class.
Definition: kpropertiesdialog.h:437
KPropsDlgPlugin::properties
KPropertiesDialog * properties
Pointer to the dialog.
Definition: kpropertiesdialog.h:480

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.8.8
This website is maintained by Timothy Pearson.