4 #include "kmfolderseldlg.h"
6 #include "kmmainwidget.h"
7 #include "globalsettings.h"
10 #include <klineedit.h>
11 #include <tdepopupmenu.h>
12 #include <kiconloader.h>
15 #include <tqtoolbutton.h>
19 using namespace KMail;
21 KMFolderSelDlg::KMFolderSelDlg( KMMainWidget * parent,
const TQString& caption,
22 bool mustBeReadWrite,
bool useGlobalSettings )
23 : KDialogBase( parent,
"folder dialog", true, caption,
24 Ok|Cancel|User1,
Ok, true,
25 KGuiItem(i18n(
"&New Subfolder..."),
"folder-new",
26 i18n(
"Create a new subfolder under the currently selected folder"))
28 mUseGlobalSettings( useGlobalSettings )
30 KMFolderTree * ft = parent->folderTree();
33 TQString preSelection = mUseGlobalSettings ?
34 GlobalSettings::self()->lastSelectedFolder() : TQString();
35 TQWidget * container = makeVBoxMainWidget();
36 new TQLabel( i18n(
"You can start typing to filter the list of folders"), container );
37 mTreeView =
new KMail::SimpleFolderTree( container, ft,
38 preSelection, mustBeReadWrite );
43 KMFolderSelDlg::KMFolderSelDlg( TQWidget * parent, KMFolderTree * tree,
44 const TQString& caption,
bool mustBeReadWrite,
bool useGlobalSettings )
45 : KDialogBase( parent,
"folder dialog", true, caption,
46 Ok|Cancel|User1,
Ok, true,
47 KGuiItem(i18n(
"&New Subfolder..."),
"folder-new",
48 i18n(
"Create a new subfolder under the currently selected folder"))
50 mUseGlobalSettings( useGlobalSettings )
52 TQString preSelection = mUseGlobalSettings ?
53 GlobalSettings::self()->lastSelectedFolder() : TQString();
54 TQWidget * container = makeVBoxMainWidget();
55 new TQLabel( i18n(
"You can start typing to filter the list of folders"), container );
56 mTreeView =
new KMail::SimpleFolderTree( container, tree,
57 preSelection, mustBeReadWrite );
62 void KMFolderSelDlg::init()
64 mTreeView->setFocus();
65 connect( mTreeView, TQ_SIGNAL( doubleClicked( TQListViewItem*,
const TQPoint&,
int ) ),
66 this, TQ_SLOT( slotSelect() ) );
67 connect( mTreeView, TQ_SIGNAL( selectionChanged() ),
68 this, TQ_SLOT( slotUpdateBtnStatus() ) );
74 KMFolderSelDlg::~KMFolderSelDlg()
77 if ( cur && mUseGlobalSettings ) {
78 GlobalSettings::self()->setLastSelectedFolder( cur->
idString() );
86 KMFolder * KMFolderSelDlg::folder(
void )
88 return (
KMFolder * ) mTreeView->folder();
92 void KMFolderSelDlg::setFolder(
KMFolder* folder )
94 mTreeView->setFolder( folder );
98 void KMFolderSelDlg::slotSelect()
104 void KMFolderSelDlg::slotUser1()
106 mTreeView->addChildFolder();
110 void KMFolderSelDlg::slotUpdateBtnStatus()
112 enableButton( User1, folder() &&
113 ( !folder()->noContent() && !folder()->noChildren() ) );
117 void KMFolderSelDlg::setFlags(
bool mustBeReadWrite,
bool showOutbox,
118 bool showImapFolders )
120 mTreeView->reload( mustBeReadWrite, showOutbox, showImapFolders );
123 void KMFolderSelDlg::readConfig()
125 TDEConfig *config = TDEGlobal::config();
126 config->setGroup(
"FolderSelectionDialog" );
128 TQSize size = config->readSizeEntry(
"Size" );
129 if ( !size.isEmpty() ) resize( size );
130 else resize( 500, 300 );
132 TQValueList<int> widths = config->readIntListEntry(
"ColumnWidths" );
133 if ( !widths.isEmpty() ) {
134 mTreeView->setColumnWidth(mTreeView->folderColumn(), widths[0]);
135 mTreeView->setColumnWidth(mTreeView->pathColumn(), widths[1]);
138 int colWidth = width() / 2;
139 mTreeView->setColumnWidth(mTreeView->folderColumn(), colWidth);
140 mTreeView->setColumnWidth(mTreeView->pathColumn(), colWidth);
144 void KMFolderSelDlg::writeConfig()
146 TDEConfig *config = TDEGlobal::config();
147 config->setGroup(
"FolderSelectionDialog" );
148 config->writeEntry(
"Size", size() );
150 TQValueList<int> widths;
151 widths.push_back(mTreeView->columnWidth(mTreeView->folderColumn()));
152 widths.push_back(mTreeView->columnWidth(mTreeView->pathColumn()));
153 config->writeEntry(
"ColumnWidths", widths );
157 #include "kmfolderseldlg.moc"
TQString idString() const
Returns a string that can be used to identify this folder.
@ Ok
The user rights/ACL have been fetched from the server sucessfully.