• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
  • management
kmprinterview.cpp
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License version 2 as published by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  **/
19 
20 #include "kmprinterview.h"
21 #include "kmprinter.h"
22 #include "kmiconview.h"
23 #include "kmlistview.h"
24 #include "kmtimer.h"
25 #include "kmmanager.h"
26 
27 #include <tqlayout.h>
28 #include <tqpopupmenu.h>
29 #include <tdeaction.h>
30 #include <tdelocale.h>
31 
32 KMPrinterView::KMPrinterView(TQWidget *parent, const char *name)
33 : TQWidgetStack(parent,name), m_type(KMPrinterView::Icons)
34 {
35  m_iconview = new KMIconView(this);
36  addWidget(m_iconview,0);
37  m_listview = new KMListView(this);
38  addWidget(m_listview,1);
39  m_current = TQString();
40  m_listset = false;
41 
42  connect(m_iconview,TQ_SIGNAL(rightButtonClicked(const TQString&,const TQPoint&)),TQ_SIGNAL(rightButtonClicked(const TQString&,const TQPoint&)));
43  connect(m_listview,TQ_SIGNAL(rightButtonClicked(const TQString&,const TQPoint&)),TQ_SIGNAL(rightButtonClicked(const TQString&,const TQPoint&)));
44  connect(m_iconview,TQ_SIGNAL(printerSelected(const TQString&)),TQ_SIGNAL(printerSelected(const TQString&)));
45  connect(m_listview,TQ_SIGNAL(printerSelected(const TQString&)),TQ_SIGNAL(printerSelected(const TQString&)));
46  connect(m_iconview,TQ_SIGNAL(printerSelected(const TQString&)),TQ_SLOT(slotPrinterSelected(const TQString&)));
47  connect(m_listview,TQ_SIGNAL(printerSelected(const TQString&)),TQ_SLOT(slotPrinterSelected(const TQString&)));
48 
49  setViewType(m_type);
50  setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
51 }
52 
53 KMPrinterView::~KMPrinterView()
54 {
55 }
56 
57 void KMPrinterView::setPrinterList(TQPtrList<KMPrinter> *list)
58 {
59  if (m_type != KMPrinterView::Tree || list == 0)
60  m_iconview->setPrinterList(list);
61  if (m_type == KMPrinterView::Tree || list == 0)
62  m_listview->setPrinterList(list);
63  m_listset = ( list != 0 );
64 }
65 
66 void KMPrinterView::setPrinter( KMPrinter *p )
67 {
68  if ( m_type == KMPrinterView::Tree )
69  m_listview->setPrinter( p );
70  else
71  m_iconview->setPrinter( p );
72 }
73 
74 void KMPrinterView::setViewType(ViewType t)
75 {
76  m_type = t;
77  switch (m_type)
78  {
79  case KMPrinterView::Icons:
80  m_iconview->setViewMode(KMIconView::Big);
81  break;
82  case KMPrinterView::List:
83  m_iconview->setViewMode(KMIconView::Small);
84  break;
85  default:
86  break;
87  }
88  TQString oldcurrent = m_current;
89  if ( m_listset )
90  setPrinterList(KMManager::self()->printerList(false));
91  if (m_type == KMPrinterView::Tree)
92  {
93  raiseWidget(m_listview);
94  m_listview->setPrinter(oldcurrent);
95  }
96  else
97  {
98  raiseWidget(m_iconview);
99  m_iconview->setPrinter(oldcurrent);
100  }
101 }
102 
103 void KMPrinterView::slotPrinterSelected(const TQString& p)
104 {
105  m_current = p;
106 }
107 
108 TQSize KMPrinterView::minimumSizeHint() const
109 {
110  return TQWidgetStack::minimumSizeHint();
111 }
112 
113 #include "kmprinterview.moc"

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • 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 tdeprint by doxygen 1.9.1
This website is maintained by Timothy Pearson.