19 #include "katemailfilesdialog.h"
20 #include "katemainwindow.h"
21 #include "kateviewmanager.h"
22 #include "katedocmanager.h"
24 #include <tdelistview.h>
25 #include <tdelocale.h>
30 #include <tqstringlist.h>
34 class KateDocCheckItem :
public TQCheckListItem {
36 KateDocCheckItem( TQListView *parent,
const TQString& text, Kate::Document *d )
37 : TQCheckListItem( parent, text, TQCheckListItem::CheckBox ), mdoc(d) {};
38 Kate::Document *doc() {
return mdoc; };
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 >>") ) ),
52 setButtonGuiItem( KDialogBase::Ok, KGuiItem( i18n(
"&Mail..."),
"mail-send") );
53 mw = makeVBoxMainWidget();
54 mw->installEventFilter(
this );
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 >></strong>."), mw );
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();
66 TQCheckListItem *item;
68 Kate::Document *doc = KateDocManager::self()->document( i );
70 item =
new KateDocCheckItem( list, doc->docName(), doc );
71 item->setText( 1, doc->url().prettyURL() );
72 if ( doc == currentDoc ) {
74 item->setSelected(
true );
80 connect(
this, TQ_SIGNAL(user1Clicked()),
this, TQ_SLOT(slotShowButton()) );
81 mw->setMinimumSize( lInfo->sizeHint() );
86 TQPtrList<Kate::Document> l;
87 TQListViewItem *item = list->firstChild();
89 if ( ((KateDocCheckItem*)item)->isOn() )
90 l.append( ((KateDocCheckItem*)item)->doc() );
91 item = item->nextSibling();
96 void KateMailDialog::slotShowButton()
98 if ( list->isVisible() ) {
99 setButtonText( User1, i18n(
"&Show All Documents >>") );
104 setButtonText( User1, i18n(
"&Hide Document List <<") );
105 lInfo->setText( i18n(
"Press <strong>Mail...</strong> to send selected documents") );
108 mw->setMinimumSize( TQSize( lInfo->sizeHint().width(), mw->sizeHint().height()) );
109 setMinimumSize( calculateSize( mw->minimumSize().width(), mw->sizeHint().height() ) );
110 resize( width(), minimumHeight() );
112 #include "katemailfilesdialog.moc"
TQPtrList< Kate::Document > selectedDocs()