-rw-r--r-- | kmicromail/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 2de5b40..704a9ab 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,153 +1,153 @@ | |||
1 | 1 | ||
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qvbox.h> | 4 | #include <qvbox.h> |
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | #include <kdialog.h> | 8 | #include <kdialog.h> |
9 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
10 | #include <kapplication.h> | 10 | #include <kapplication.h> |
11 | 11 | ||
12 | #ifndef DESKTOP_VERSION | 12 | #ifndef DESKTOP_VERSION |
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #endif | 14 | #endif |
15 | #include "defines.h" | 15 | #include "defines.h" |
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #include <KDGanttMinimizeSplitter.h> | 17 | #include <KDGanttMinimizeSplitter.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <kabc/stdaddressbook.h> | 20 | #include <kabc/stdaddressbook.h> |
21 | 21 | ||
22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
23 | : QMainWindow( parent, name ) //, flags ) | 23 | : QMainWindow( parent, name ) //, flags ) |
24 | { | 24 | { |
25 | setCaption( tr( "OpieMail/Pi" ) ); | 25 | setCaption( tr( "KOpieMail/Pi" ) ); |
26 | setToolBarsMovable( false ); | 26 | setToolBarsMovable( false ); |
27 | KABC::StdAddressBook::self(); | 27 | KABC::StdAddressBook::self(); |
28 | toolBar = new QToolBar( this ); | 28 | toolBar = new QToolBar( this ); |
29 | menuBar = new QMenuBar( toolBar ); | 29 | menuBar = new QMenuBar( toolBar ); |
30 | mailMenu = new QPopupMenu( menuBar ); | 30 | mailMenu = new QPopupMenu( menuBar ); |
31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
32 | settingsMenu = new QPopupMenu( menuBar ); | 32 | settingsMenu = new QPopupMenu( menuBar ); |
33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
34 | 34 | ||
35 | addToolBar( toolBar ); | 35 | addToolBar( toolBar ); |
36 | toolBar->setHorizontalStretchable( true ); | 36 | toolBar->setHorizontalStretchable( true ); |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 40 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
41 | 0, 0, this ); | 41 | 0, 0, this ); |
42 | composeMail->addTo( toolBar ); | 42 | composeMail->addTo( toolBar ); |
43 | composeMail->addTo( mailMenu ); | 43 | composeMail->addTo( mailMenu ); |
44 | 44 | ||
45 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 45 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
46 | 0, 0, this ); | 46 | 0, 0, this ); |
47 | sendQueued->addTo( toolBar ); | 47 | sendQueued->addTo( toolBar ); |
48 | sendQueued->addTo( mailMenu ); | 48 | sendQueued->addTo( mailMenu ); |
49 | 49 | ||
50 | /* | 50 | /* |
51 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 51 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
52 | 0, 0, this ); | 52 | 0, 0, this ); |
53 | syncFolders->addTo( toolBar ); | 53 | syncFolders->addTo( toolBar ); |
54 | syncFolders->addTo( mailMenu ); | 54 | syncFolders->addTo( mailMenu ); |
55 | */ | 55 | */ |
56 | 56 | ||
57 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 57 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
58 | 0, 0, this, 0, true ); | 58 | 0, 0, this, 0, true ); |
59 | showFolders->addTo( toolBar ); | 59 | showFolders->addTo( toolBar ); |
60 | showFolders->addTo( mailMenu ); | 60 | showFolders->addTo( mailMenu ); |
61 | showFolders->setOn( true ); | 61 | showFolders->setOn( true ); |
62 | connect(showFolders, SIGNAL( toggled(bool) ), | 62 | connect(showFolders, SIGNAL( toggled(bool) ), |
63 | SLOT( slotShowFolders(bool) ) ); | 63 | SLOT( slotShowFolders(bool) ) ); |
64 | 64 | ||
65 | /* | 65 | /* |
66 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), | 66 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), |
67 | 0, 0, this ); | 67 | 0, 0, this ); |
68 | searchMails->addTo( toolBar ); | 68 | searchMails->addTo( toolBar ); |
69 | searchMails->addTo( mailMenu ); | 69 | searchMails->addTo( mailMenu ); |
70 | */ | 70 | */ |
71 | 71 | ||
72 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 72 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
73 | deleteMails->addTo( toolBar ); | 73 | deleteMails->addTo( toolBar ); |
74 | deleteMails->addTo( mailMenu ); | 74 | deleteMails->addTo( mailMenu ); |
75 | connect( deleteMails, SIGNAL( activated() ), | 75 | connect( deleteMails, SIGNAL( activated() ), |
76 | SLOT( slotDeleteMail() ) ); | 76 | SLOT( slotDeleteMail() ) ); |
77 | 77 | ||
78 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , | 78 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , |
79 | 0, 0, this ); | 79 | 0, 0, this ); |
80 | editSettings->addTo( settingsMenu ); | 80 | editSettings->addTo( settingsMenu ); |
81 | connect( editSettings, SIGNAL( activated() ), | 81 | connect( editSettings, SIGNAL( activated() ), |
82 | SLOT( slotEditSettings() ) ); | 82 | SLOT( slotEditSettings() ) ); |
83 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , | 83 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , |
84 | 0, 0, this ); | 84 | 0, 0, this ); |
85 | editAccounts->addTo( settingsMenu ); | 85 | editAccounts->addTo( settingsMenu ); |
86 | 86 | ||
87 | //setCentralWidget( view ); | 87 | //setCentralWidget( view ); |
88 | 88 | ||
89 | QVBox* wrapperBox = new QVBox( this ); | 89 | QVBox* wrapperBox = new QVBox( this ); |
90 | setCentralWidget( wrapperBox ); | 90 | setCentralWidget( wrapperBox ); |
91 | 91 | ||
92 | // QWidget *view = new QWidget( wrapperBox ); | 92 | // QWidget *view = new QWidget( wrapperBox ); |
93 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 93 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
94 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 94 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
95 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 95 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
96 | 96 | ||
97 | folderView = new AccountView( split ); | 97 | folderView = new AccountView( split ); |
98 | folderView->header()->hide(); | 98 | folderView->header()->hide(); |
99 | folderView->setRootIsDecorated( false ); | 99 | folderView->setRootIsDecorated( false ); |
100 | folderView->addColumn( tr( "Mailbox" ) ); | 100 | folderView->addColumn( tr( "Mailbox" ) ); |
101 | 101 | ||
102 | //layout->addWidget( folderView ); | 102 | //layout->addWidget( folderView ); |
103 | 103 | ||
104 | mailView = new QListView( split ); | 104 | mailView = new QListView( split ); |
105 | mailView->addColumn( tr( " " ) ); | 105 | mailView->addColumn( tr( " " ) ); |
106 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 106 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
107 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 107 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
108 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 108 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
109 | mailView->addColumn( tr( "Date" ),QListView::Manual); | 109 | mailView->addColumn( tr( "Date" ),QListView::Manual); |
110 | mailView->setAllColumnsShowFocus(true); | 110 | mailView->setAllColumnsShowFocus(true); |
111 | //mailView->setSorting(-1); | 111 | //mailView->setSorting(-1); |
112 | mailView->setRootIsDecorated( false ); | 112 | mailView->setRootIsDecorated( false ); |
113 | statusWidget = new StatusWidget( wrapperBox ); | 113 | statusWidget = new StatusWidget( wrapperBox ); |
114 | statusWidget->hide(); | 114 | statusWidget->hide(); |
115 | 115 | ||
116 | //layout->addWidget( mailView ); | 116 | //layout->addWidget( mailView ); |
117 | //layout->setStretchFactor( folderView, 1 ); | 117 | //layout->setStretchFactor( folderView, 1 ); |
118 | //layout->setStretchFactor( mailView, 2 ); | 118 | //layout->setStretchFactor( mailView, 2 ); |
119 | 119 | ||
120 | slotAdjustLayout(); | 120 | slotAdjustLayout(); |
121 | #ifndef DESKTOP_VERSION | 121 | #ifndef DESKTOP_VERSION |
122 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 122 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
123 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 123 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
124 | #endif | 124 | #endif |
125 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 125 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, |
126 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 126 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
127 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 127 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, |
128 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 128 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
129 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 129 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
130 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 130 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
131 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 131 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
132 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 132 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
133 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 133 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
134 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 134 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
135 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 135 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
136 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 136 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
137 | //mailView->setMultiSelection ( true ); | 137 | //mailView->setMultiSelection ( true ); |
138 | mailView->setSelectionMode( QListView::Extended ); | 138 | mailView->setSelectionMode( QListView::Extended ); |
139 | QValueList<int> list; | 139 | QValueList<int> list; |
140 | int fw = 100; | 140 | int fw = 100; |
141 | if ( QApplication::desktop()->width() > 320 ) | 141 | if ( QApplication::desktop()->width() > 320 ) |
142 | fw = 50; | 142 | fw = 50; |
143 | list.append( fw ); | 143 | list.append( fw ); |
144 | list.append( 100 ); | 144 | list.append( 100 ); |
145 | split->setSizes( list ); | 145 | split->setSizes( list ); |
146 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 146 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
147 | mailView->setShowSortIndicator ( true ); | 147 | mailView->setShowSortIndicator ( true ); |
148 | QLabel *spacer = new QLabel( toolBar ); | 148 | QLabel *spacer = new QLabel( toolBar ); |
149 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 149 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
150 | toolBar->setStretchableWidget( spacer ); | 150 | toolBar->setStretchableWidget( spacer ); |
151 | 151 | ||
152 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); | 152 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); |
153 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 153 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |