20 #include "kmprinterview.h"
21 #include "kmprinter.h"
22 #include "kmiconview.h"
23 #include "kmlistview.h"
25 #include "kmmanager.h"
28 #include <tqpopupmenu.h>
29 #include <tdeaction.h>
30 #include <tdelocale.h>
32 KMPrinterView::KMPrinterView(TQWidget *parent,
const char *name)
33 : TQWidgetStack(parent,name), m_type(KMPrinterView::Icons)
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();
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&)));
50 setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
53 KMPrinterView::~KMPrinterView()
57 void KMPrinterView::setPrinterList(TQPtrList<KMPrinter> *list)
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 );
66 void KMPrinterView::setPrinter( KMPrinter *p )
68 if ( m_type == KMPrinterView::Tree )
69 m_listview->setPrinter( p );
71 m_iconview->setPrinter( p );
74 void KMPrinterView::setViewType(ViewType t)
79 case KMPrinterView::Icons:
80 m_iconview->setViewMode(KMIconView::Big);
82 case KMPrinterView::List:
83 m_iconview->setViewMode(KMIconView::Small);
88 TQString oldcurrent = m_current;
90 setPrinterList(KMManager::self()->printerList(
false));
91 if (m_type == KMPrinterView::Tree)
93 raiseWidget(m_listview);
94 m_listview->setPrinter(oldcurrent);
98 raiseWidget(m_iconview);
99 m_iconview->setPrinter(oldcurrent);
103 void KMPrinterView::slotPrinterSelected(
const TQString& p)
108 TQSize KMPrinterView::minimumSizeHint()
const
110 return TQWidgetStack::minimumSizeHint();
113 #include "kmprinterview.moc"