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

kate

  • kate
  • app
katemailfilesdialog.cpp
1 /* This file is part of the KDE project
2  Copyright (C) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
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 #include "katemailfilesdialog.h"
20 #include "katemainwindow.h"
21 #include "kateviewmanager.h"
22 #include "katedocmanager.h"
23 
24 #include <tdelistview.h>
25 #include <tdelocale.h>
26 #include <kurl.h>
27 
28 #include <tqevent.h>
29 #include <tqlabel.h>
30 #include <tqstringlist.h>
31 #include <tqvbox.h>
32 
33 /* a private check list item, that can store a Kate::Document*. */
34 class KateDocCheckItem : public TQCheckListItem {
35  public:
36  KateDocCheckItem( TQListView *parent, const TQString& text, Kate::Document *d )
37  : TQCheckListItem( parent, text, TQCheckListItem::CheckBox ), mdoc(d) {};
38  Kate::Document *doc() { return mdoc; };
39  private:
40  Kate::Document *mdoc;
41 };
42 
44 // KateMailDialog implementation
46 KateMailDialog::KateMailDialog( TQWidget *parent, KateMainWindow *mainwin )
47  : KDialogBase( parent, "kate mail dialog", true, i18n("Email Files"),
48  Ok|Cancel|User1, Ok, false,
49  KGuiItem( i18n("&Show All Documents >>") ) ),
50  mainWindow( mainwin )
51 {
52  setButtonGuiItem( KDialogBase::Ok, KGuiItem( i18n("&Mail..."), "mail-send") );
53  mw = makeVBoxMainWidget();
54  mw->installEventFilter( this );
55 
56  lInfo = new TQLabel( i18n(
57  "<p>Press <strong>Mail...</strong> to email the current document."
58  "<p>To select more documents to send, press <strong>Show All Documents&nbsp;&gt;&gt;</strong>."), mw );
59  // TODO avoid untill needed - later
60  list = new TDEListView( mw );
61  list->addColumn( i18n("Name") );
62  list->addColumn( i18n("URL") );
63  Kate::Document *currentDoc = mainWindow->viewManager()->activeView()->getDoc();
64  uint n = KateDocManager::self()->documents();
65  uint i = 0;
66  TQCheckListItem *item;
67  while ( i < n ) {
68  Kate::Document *doc = KateDocManager::self()->document( i );
69  if ( doc ) {
70  item = new KateDocCheckItem( list, doc->docName(), doc );
71  item->setText( 1, doc->url().prettyURL() );
72  if ( doc == currentDoc ) {
73  item->setOn( true );
74  item->setSelected( true );
75  }
76  }
77  i++;
78  }
79  list->hide();
80  connect( this, TQ_SIGNAL(user1Clicked()), this, TQ_SLOT(slotShowButton()) );
81  mw->setMinimumSize( lInfo->sizeHint() );
82 }
83 
84 TQPtrList<Kate::Document> KateMailDialog::selectedDocs()
85 {
86  TQPtrList<Kate::Document> l;
87  TQListViewItem *item = list->firstChild();
88  while ( item ) {
89  if ( ((KateDocCheckItem*)item)->isOn() )
90  l.append( ((KateDocCheckItem*)item)->doc() );
91  item = item->nextSibling();
92  }
93  return l;
94 }
95 
96 void KateMailDialog::slotShowButton()
97 {
98  if ( list->isVisible() ) {
99  setButtonText( User1, i18n("&Show All Documents >>") );
100  list->hide();
101  }
102  else {
103  list->show();
104  setButtonText( User1, i18n("&Hide Document List <<") );
105  lInfo->setText( i18n("Press <strong>Mail...</strong> to send selected documents") );
106 
107  }
108  mw->setMinimumSize( TQSize( lInfo->sizeHint().width(), mw->sizeHint().height()) );
109  setMinimumSize( calculateSize( mw->minimumSize().width(), mw->sizeHint().height() ) );
110  resize( width(), minimumHeight() );
111 }
112 #include "katemailfilesdialog.moc"
KateMailDialog::selectedDocs
TQPtrList< Kate::Document > selectedDocs()
Definition: katemailfilesdialog.cpp:84

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kate

Skip menu "kate"
  • kate
  • libkonq
  • twin
  •   lib
Generated for kate by doxygen 1.9.1
This website is maintained by Timothy Pearson.