-rw-r--r-- | kmicromail/mainwindow.cpp | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 250d114..0794e00 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,337 +1,357 @@ | |||
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 | #ifdef DESKTOP_VERSION | 12 | #ifdef DESKTOP_VERSION |
13 | #include <qapplication.h> | 13 | #include <qapplication.h> |
14 | #include <qstatusbar.h> | 14 | #include <qstatusbar.h> |
15 | #include <kabc/stdaddressbook.h> | 15 | #include <kabc/stdaddressbook.h> |
16 | extern QStatusBar* globalSstatusBarMainWindow; | 16 | extern QStatusBar* globalSstatusBarMainWindow; |
17 | #else | 17 | #else |
18 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
19 | #include <klocale.h> | 19 | #include <klocale.h> |
20 | #endif | 20 | #endif |
21 | #include "defines.h" | 21 | #include "defines.h" |
22 | #include "koprefs.h" | ||
22 | #include "mainwindow.h" | 23 | #include "mainwindow.h" |
23 | #include "mailistviewitem.h" | 24 | #include "mailistviewitem.h" |
24 | #include <KDGanttMinimizeSplitter.h> | 25 | #include <KDGanttMinimizeSplitter.h> |
25 | 26 | ||
26 | #include "koprefs.h" | 27 | #include "koprefs.h" |
27 | 28 | ||
28 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 29 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
29 | : QMainWindow( parent, name ) //, flags ) | 30 | : QMainWindow( parent, name ) //, flags ) |
30 | { | 31 | { |
31 | #ifdef DESKTOP_VERSION | 32 | #ifdef DESKTOP_VERSION |
32 | globalSstatusBarMainWindow = statusBar(); | 33 | globalSstatusBarMainWindow = statusBar(); |
33 | #endif | 34 | #endif |
34 | setCaption( i18n( "KOpieMail/Pi" ) ); | 35 | setCaption( i18n( "KOpieMail/Pi" ) ); |
35 | setToolBarsMovable( false ); | 36 | setToolBarsMovable( false ); |
36 | //KABC::StdAddressBook::self(); | 37 | //KABC::StdAddressBook::self(); |
37 | toolBar = new QToolBar( this ); | 38 | toolBar = new QToolBar( this ); |
38 | menuBar = new QPEMenuBar( toolBar ); | 39 | menuBar = new QPEMenuBar( toolBar ); |
39 | mailMenu = new QPopupMenu( menuBar ); | 40 | mailMenu = new QPopupMenu( menuBar ); |
40 | menuBar->insertItem( i18n( "Mail" ), mailMenu ); | 41 | menuBar->insertItem( i18n( "Mail" ), mailMenu ); |
41 | settingsMenu = new QPopupMenu( menuBar ); | 42 | settingsMenu = new QPopupMenu( menuBar ); |
42 | menuBar->insertItem( i18n( "Settings" ), settingsMenu ); | 43 | menuBar->insertItem( i18n( "Settings" ), settingsMenu ); |
43 | 44 | ||
44 | addToolBar( toolBar ); | 45 | addToolBar( toolBar ); |
45 | toolBar->setHorizontalStretchable( true ); | 46 | toolBar->setHorizontalStretchable( true ); |
46 | QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), | 47 | QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), |
47 | 0, 0, this ); | 48 | 0, 0, this ); |
48 | connect(getMail, SIGNAL( activated() ), | 49 | connect(getMail, SIGNAL( activated() ), |
49 | SLOT( slotGetAllMail() ) ); | 50 | SLOT( slotGetAllMail() ) ); |
50 | getMail->addTo( mailMenu ); | 51 | getMail->addTo( mailMenu ); |
51 | 52 | ||
52 | getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), | 53 | getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), |
53 | 0, 0, this ); | 54 | 0, 0, this ); |
54 | getMail->addTo( toolBar ); | 55 | getMail->addTo( toolBar ); |
55 | getMail->addTo( mailMenu ); | 56 | getMail->addTo( mailMenu ); |
56 | connect(getMail, SIGNAL( activated() ), | 57 | connect(getMail, SIGNAL( activated() ), |
57 | SLOT( slotGetMail() ) ); | 58 | SLOT( slotGetMail() ) ); |
58 | 59 | ||
59 | composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), | 60 | composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), |
60 | 0, 0, this ); | 61 | 0, 0, this ); |
61 | composeMail->addTo( toolBar ); | 62 | composeMail->addTo( toolBar ); |
62 | composeMail->addTo( mailMenu ); | 63 | composeMail->addTo( mailMenu ); |
63 | 64 | ||
64 | sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , | 65 | sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , |
65 | 0, 0, this ); | 66 | 0, 0, this ); |
66 | sendQueued->addTo( toolBar ); | 67 | sendQueued->addTo( toolBar ); |
67 | sendQueued->addTo( mailMenu ); | 68 | sendQueued->addTo( mailMenu ); |
68 | 69 | ||
69 | /* | 70 | /* |
70 | syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, | 71 | syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, |
71 | 0, 0, this ); | 72 | 0, 0, this ); |
72 | syncFolders->addTo( toolBar ); | 73 | syncFolders->addTo( toolBar ); |
73 | syncFolders->addTo( mailMenu ); | 74 | syncFolders->addTo( mailMenu ); |
74 | */ | 75 | */ |
75 | 76 | ||
76 | showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , | 77 | showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , |
77 | 0, 0, this, 0, true ); | 78 | 0, 0, this, 0, true ); |
78 | showFolders->addTo( toolBar ); | 79 | showFolders->addTo( toolBar ); |
79 | showFolders->addTo( mailMenu ); | 80 | showFolders->addTo( mailMenu ); |
80 | showFolders->setOn( true ); | 81 | showFolders->setOn( true ); |
81 | connect(showFolders, SIGNAL( toggled(bool) ), | 82 | connect(showFolders, SIGNAL( toggled(bool) ), |
82 | SLOT( slotShowFolders(bool) ) ); | 83 | SLOT( slotShowFolders(bool) ) ); |
83 | 84 | ||
84 | /* | 85 | /* |
85 | searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), | 86 | searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), |
86 | 0, 0, this ); | 87 | 0, 0, this ); |
87 | searchMails->addTo( toolBar ); | 88 | searchMails->kopddTo( toolBar ); |
88 | searchMails->addTo( mailMenu ); | 89 | searchMails->addTo( mailMenu ); |
89 | */ | 90 | */ |
90 | 91 | ||
91 | deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 92 | deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
92 | deleteMails->addTo( toolBar ); | 93 | deleteMails->addTo( toolBar ); |
93 | deleteMails->addTo( mailMenu ); | 94 | deleteMails->addTo( mailMenu ); |
94 | connect( deleteMails, SIGNAL( activated() ), | 95 | connect( deleteMails, SIGNAL( activated() ), |
95 | SLOT( slotDeleteAllMail() ) ); | 96 | SLOT( slotDeleteAllMail() ) ); |
96 | 97 | ||
97 | editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , | 98 | editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , |
98 | 0, 0, this ); | 99 | 0, 0, this ); |
99 | editSettings->addTo( settingsMenu ); | 100 | editSettings->addTo( settingsMenu ); |
100 | connect( editSettings, SIGNAL( activated() ), | 101 | connect( editSettings, SIGNAL( activated() ), |
101 | SLOT( slotEditSettings() ) ); | 102 | SLOT( slotEditSettings() ) ); |
102 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , | 103 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , |
103 | 0, 0, this ); | 104 | 0, 0, this ); |
104 | editAccounts->addTo( settingsMenu ); | 105 | editAccounts->addTo( settingsMenu ); |
105 | codecMenu = new QPopupMenu( menuBar ); | 106 | codecMenu = new QPopupMenu( menuBar ); |
106 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); | 107 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); |
107 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); | 108 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); |
108 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); | 109 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); |
109 | codecMenu->insertItem( "Chinese (big-5)",3,3); | 110 | codecMenu->insertItem( "Chinese (big-5)",3,3); |
110 | codecMenu->insertItem( "Unicode (utf-8)",4,4); | 111 | codecMenu->insertItem( "Unicode (utf-8)",4,4); |
111 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); | 112 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); |
112 | //disabled | 113 | //disabled |
113 | //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); | 114 | //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); |
114 | //setCentralWidget( view ); | 115 | //setCentralWidget( view ); |
115 | 116 | ||
116 | QVBox* wrapperBox = new QVBox( this ); | 117 | QVBox* wrapperBox = new QVBox( this ); |
117 | setCentralWidget( wrapperBox ); | 118 | setCentralWidget( wrapperBox ); |
118 | 119 | ||
119 | // QWidget *view = new QWidget( wrapperBox ); | 120 | // QWidget *view = new QWidget( wrapperBox ); |
120 | KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox); | 121 | KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox); |
121 | splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down); | 122 | splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down); |
122 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor); | 123 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor); |
123 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 124 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
124 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 125 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
125 | QWidget* infoBox = new QWidget( splithor ); | 126 | subLE = 0; |
126 | QGridLayout *griLay = new QGridLayout( infoBox, 2,2); | 127 | fromLE = 0; |
127 | griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 ); | 128 | toLE = 0; |
128 | griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); | 129 | if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) { |
129 | griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); | 130 | QWidget* infoBox = new QWidget( splithor ); |
130 | griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ; | 131 | QGridLayout *griLay = new QGridLayout( infoBox, 2,2); |
131 | griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ; | 132 | if ( KOPrefs::instance()->mShowInfoSub ) { |
132 | griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; | 133 | griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 ); |
133 | infoBox->setMaximumHeight( infoBox->sizeHint().height() ); | 134 | griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ; |
135 | } | ||
136 | if ( KOPrefs::instance()->mShowInfoFrom ) { | ||
137 | griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); | ||
138 | griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ; | ||
139 | } | ||
140 | if ( KOPrefs::instance()->mShowInfoTo ) { | ||
141 | griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); | ||
142 | griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; | ||
143 | } | ||
144 | infoBox->setMaximumHeight( infoBox->sizeHint().height() ); | ||
145 | if ( !KOPrefs::instance()->mShowInfoStart ) { | ||
146 | QTimer::singleShot( 1,splithor, SLOT ( toggle() ) ); | ||
147 | } | ||
148 | } | ||
149 | |||
150 | |||
134 | folderView = new AccountView( split ); | 151 | folderView = new AccountView( split ); |
135 | folderView->header()->hide(); | 152 | folderView->header()->hide(); |
136 | folderView->setRootIsDecorated( false ); | 153 | folderView->setRootIsDecorated( false ); |
137 | folderView->addColumn( i18n( "Mailbox" ) ); | 154 | folderView->addColumn( i18n( "Mailbox" ) ); |
138 | 155 | ||
139 | //layout->addWidget( folderView ); | 156 | //layout->addWidget( folderView ); |
140 | 157 | ||
141 | mailView = new QListView( split ); | 158 | mailView = new QListView( split ); |
142 | mailView->addColumn( i18n( " " ) ); | 159 | mailView->addColumn( i18n( " " ) ); |
143 | mailView->addColumn( i18n( "Subject" ),QListView::Manual ); | 160 | mailView->addColumn( i18n( "Subject" ),QListView::Manual ); |
144 | mailView->addColumn( i18n( "Sender" ),QListView::Manual ); | 161 | mailView->addColumn( i18n( "Sender" ),QListView::Manual ); |
145 | mailView->addColumn( i18n( "Size" ),QListView::Manual); | 162 | mailView->addColumn( i18n( "Size" ),QListView::Manual); |
146 | mailView->addColumn( i18n( "Date" ),QListView::Manual); | 163 | mailView->addColumn( i18n( "Date" ),QListView::Manual); |
147 | if ( KOPrefs::instance()->mShowToField ) | 164 | if ( KOPrefs::instance()->mShowToField ) |
148 | mailView->addColumn( i18n( "To" ),QListView::Manual); | 165 | mailView->addColumn( i18n( "To" ),QListView::Manual); |
149 | mailView->setAllColumnsShowFocus(true); | 166 | mailView->setAllColumnsShowFocus(true); |
150 | //mailView->setSorting(-1); | 167 | //mailView->setSorting(-1); |
151 | mailView->setRootIsDecorated( false ); | 168 | mailView->setRootIsDecorated( false ); |
152 | statusWidget = new StatusWidget( wrapperBox ); | 169 | statusWidget = new StatusWidget( wrapperBox ); |
153 | statusWidget->hide(); | 170 | statusWidget->hide(); |
154 | 171 | ||
155 | //layout->addWidget( mailView ); | 172 | //layout->addWidget( mailView ); |
156 | //layout->setStretchFactor( folderView, 1 ); | 173 | //layout->setStretchFactor( folderView, 1 ); |
157 | //layout->setStretchFactor( mailView, 2 ); | 174 | //layout->setStretchFactor( mailView, 2 ); |
158 | 175 | ||
159 | slotAdjustLayout(); | 176 | slotAdjustLayout(); |
160 | #ifndef DESKTOP_VERSION | 177 | #ifndef DESKTOP_VERSION |
161 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 178 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
162 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 179 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
163 | QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); | 180 | if ( subLE ) |
164 | QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); | 181 | QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); |
165 | QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); | 182 | if ( fromLE ) |
183 | QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); | ||
184 | if ( toLE ) | ||
185 | QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); | ||
166 | #endif | 186 | #endif |
167 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 187 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, |
168 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 188 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
169 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 189 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, |
170 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 190 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
171 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 191 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
172 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 192 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
173 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 193 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
174 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 194 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
175 | 195 | ||
176 | connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, | 196 | connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, |
177 | SLOT( setInfoFields(QListViewItem*) ) ); | 197 | SLOT( setInfoFields(QListViewItem*) ) ); |
178 | 198 | ||
179 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 199 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
180 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 200 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
181 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 201 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
182 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 202 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
183 | //mailView->setMultiSelection ( true ); | 203 | //mailView->setMultiSelection ( true ); |
184 | mailView->setSelectionMode( QListView::Extended ); | 204 | mailView->setSelectionMode( QListView::Extended ); |
185 | QValueList<int> list; | 205 | QValueList<int> list; |
186 | int fw = 100; | 206 | int fw = 100; |
187 | if ( QApplication::desktop()->width() > 320 ) | 207 | if ( QApplication::desktop()->width() > 320 ) |
188 | fw = 50; | 208 | fw = 50; |
189 | list.append( fw ); | 209 | list.append( fw ); |
190 | list.append( 100 ); | 210 | list.append( 100 ); |
191 | split->setSizes( list ); | 211 | split->setSizes( list ); |
192 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 212 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
193 | mailView->setShowSortIndicator ( true ); | 213 | mailView->setShowSortIndicator ( true ); |
194 | QLabel *spacer = new QLabel( toolBar ); | 214 | QLabel *spacer = new QLabel( toolBar ); |
195 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 215 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
196 | toolBar->setStretchableWidget( spacer ); | 216 | toolBar->setStretchableWidget( spacer ); |
197 | 217 | ||
198 | QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); | 218 | QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); |
199 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 219 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
200 | if ( QApplication::desktop()->width() > 320 ) | 220 | if ( QApplication::desktop()->width() > 320 ) |
201 | closeMail->addTo(toolBar); | 221 | closeMail->addTo(toolBar); |
202 | closeMail->addTo(mailMenu); | 222 | closeMail->addTo(mailMenu); |
203 | 223 | ||
204 | 224 | ||
205 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); | 225 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); |
206 | menuBar->insertItem( i18n( "Help" ), helpMenu ); | 226 | menuBar->insertItem( i18n( "Help" ), helpMenu ); |
207 | QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); | 227 | QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); |
208 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); | 228 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); |
209 | li->addTo(helpMenu); | 229 | li->addTo(helpMenu); |
210 | li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); | 230 | li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); |
211 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); | 231 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); |
212 | li->addTo(helpMenu); | 232 | li->addTo(helpMenu); |
213 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); | 233 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); |
214 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); | 234 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); |
215 | li->addTo(helpMenu); | 235 | li->addTo(helpMenu); |
216 | connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); | 236 | connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); |
217 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | 237 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); |
218 | #ifdef DESKTOP_VERSION | 238 | #ifdef DESKTOP_VERSION |
219 | resize ( 640, 480 ); | 239 | resize ( 640, 480 ); |
220 | #endif | 240 | #endif |
221 | } | 241 | } |
222 | 242 | ||
223 | MainWindow::~MainWindow() | 243 | MainWindow::~MainWindow() |
224 | { | 244 | { |
225 | } | 245 | } |
226 | 246 | ||
227 | void MainWindow::setInfoFields(QListViewItem* item ) | 247 | void MainWindow::setInfoFields(QListViewItem* item ) |
228 | { | 248 | { |
229 | if ( item == 0) { | 249 | if ( item == 0) { |
230 | subLE->setText(""); | 250 | if ( subLE ) subLE->setText(""); |
231 | fromLE->setText(""); | 251 | if ( fromLE ) fromLE->setText(""); |
232 | toLE->setText(""); | 252 | if ( toLE ) toLE->setText(""); |
233 | return; | 253 | return; |
234 | } | 254 | } |
235 | RecMailP mail = ((MailListViewItem*)item)->data(); | 255 | RecMailP mail = ((MailListViewItem*)item)->data(); |
236 | subLE->setText(mail->getSubject()); | 256 | if ( subLE ) subLE->setText(mail->getSubject()); |
237 | fromLE->setText(mail->getFrom()); | 257 | if ( fromLE ) fromLE->setText(mail->getFrom()); |
238 | toLE->setText(mail->To().join(";" )); | 258 | if ( toLE ) toLE->setText(mail->To().join(";" )); |
239 | subLE->setCursorPosition(0); | 259 | if ( subLE ) subLE->setCursorPosition(0); |
240 | fromLE->setCursorPosition(0); | 260 | if ( fromLE ) fromLE->setCursorPosition(0); |
241 | toLE->setCursorPosition(0); | 261 | if ( toLE ) toLE->setCursorPosition(0); |
242 | 262 | ||
243 | } | 263 | } |
244 | void MainWindow::slotSetCodec( int codec ) | 264 | void MainWindow::slotSetCodec( int codec ) |
245 | { | 265 | { |
246 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); | 266 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); |
247 | //qDebug("codec %d ", codec); | 267 | //qDebug("codec %d ", codec); |
248 | KOPrefs::instance()->mCurrentCodec = codec; | 268 | KOPrefs::instance()->mCurrentCodec = codec; |
249 | KOPrefs::instance()->isDirty = true; | 269 | KOPrefs::instance()->isDirty = true; |
250 | QString name; | 270 | QString name; |
251 | switch ( codec ) { | 271 | switch ( codec ) { |
252 | case 0: | 272 | case 0: |
253 | name = "iso-8859-1"; | 273 | name = "iso-8859-1"; |
254 | break; | 274 | break; |
255 | case 1: | 275 | case 1: |
256 | name = "iso-8859-5"; | 276 | name = "iso-8859-5"; |
257 | break; | 277 | break; |
258 | case 2: | 278 | case 2: |
259 | name = "iso-8859-15"; | 279 | name = "iso-8859-15"; |
260 | break; | 280 | break; |
261 | case 3: | 281 | case 3: |
262 | name = "big-5"; | 282 | name = "big-5"; |
263 | break; | 283 | break; |
264 | case 4: | 284 | case 4: |
265 | name = "utf-8"; | 285 | name = "utf-8"; |
266 | break; | 286 | break; |
267 | case 5: | 287 | case 5: |
268 | name = KOPrefs::instance()->mSendCodec.lower(); | 288 | name = KOPrefs::instance()->mSendCodec.lower(); |
269 | break; | 289 | break; |
270 | } | 290 | } |
271 | KOPrefs::instance()->mCurrentCodeName = name ; | 291 | KOPrefs::instance()->mCurrentCodeName = name ; |
272 | codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); | 292 | codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); |
273 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); | 293 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); |
274 | } | 294 | } |
275 | void MainWindow::showLicence() | 295 | void MainWindow::showLicence() |
276 | { | 296 | { |
277 | KApplication::showLicence(); | 297 | KApplication::showLicence(); |
278 | } | 298 | } |
279 | void MainWindow::showAbout() | 299 | void MainWindow::showAbout() |
280 | { | 300 | { |
281 | QString version; | 301 | QString version; |
282 | #include <../version> | 302 | #include <../version> |
283 | 303 | ||
284 | QString cap = "About KOpieMail/Pi"; | 304 | QString cap = "About KOpieMail/Pi"; |
285 | QString text =i18n("KOpieMail/Platform-independent\n") + | 305 | QString text =i18n("KOpieMail/Platform-independent\n") + |
286 | "(OM/Pi) " + version + " - " | 306 | "(OM/Pi) " + version + " - " |
287 | 307 | ||
288 | #ifdef DESKTOP_VERSION | 308 | #ifdef DESKTOP_VERSION |
289 | "Desktop Edition\n" | 309 | "Desktop Edition\n" |
290 | #else | 310 | #else |
291 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" | 311 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" |
292 | #endif | 312 | #endif |
293 | "www.pi-sync.net\n\n" | 313 | "www.pi-sync.net\n\n" |
294 | 314 | ||
295 | 315 | ||
296 | 316 | ||
297 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" | 317 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" |
298 | "KOpieMail/Pi is based on Opie Mail\n" | 318 | "KOpieMail/Pi is based on Opie Mail\n" |
299 | "Copyright (c) Rajko Albrecht and the Opie team\n" | 319 | "Copyright (c) Rajko Albrecht and the Opie team\n" |
300 | "KOpieMail/Pi is licensed under the GPL\n" | 320 | "KOpieMail/Pi is licensed under the GPL\n" |
301 | "\n" | 321 | "\n" |
302 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" | 322 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" |
303 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" | 323 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" |
304 | "libEtPan has its own licence - see LibEtPan licence\n"; | 324 | "libEtPan has its own licence - see LibEtPan licence\n"; |
305 | 325 | ||
306 | KApplication::showText( cap, text ); | 326 | KApplication::showText( cap, text ); |
307 | } | 327 | } |
308 | void MainWindow::showEtpanLicence() | 328 | void MainWindow::showEtpanLicence() |
309 | { | 329 | { |
310 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); | 330 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); |
311 | 331 | ||
312 | } | 332 | } |
313 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 333 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
314 | { | 334 | { |
315 | qDebug("appMessage implemented by subclass"); | 335 | qDebug("appMessage implemented by subclass"); |
316 | } | 336 | } |
317 | 337 | ||
318 | void MainWindow::slotAdjustLayout() { | 338 | void MainWindow::slotAdjustLayout() { |
319 | 339 | ||
320 | /* | 340 | /* |
321 | QWidget *d = QApplication::desktop(); | 341 | QWidget *d = QApplication::desktop(); |
322 | 342 | ||
323 | if ( d->width() < d->height() ) { | 343 | if ( d->width() < d->height() ) { |
324 | layout->setDirection( QBoxLayout::TopToBottom ); | 344 | layout->setDirection( QBoxLayout::TopToBottom ); |
325 | } else { | 345 | } else { |
326 | layout->setDirection( QBoxLayout::LeftToRight ); | 346 | layout->setDirection( QBoxLayout::LeftToRight ); |
327 | } | 347 | } |
328 | */ | 348 | */ |
329 | } | 349 | } |
330 | 350 | ||
331 | void MainWindow::slotAdjustColumns() | 351 | void MainWindow::slotAdjustColumns() |
332 | { | 352 | { |
333 | bool hidden = folderView->isHidden(); | 353 | bool hidden = folderView->isHidden(); |
334 | if ( hidden ) folderView->show(); | 354 | if ( hidden ) folderView->show(); |
335 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 355 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
336 | if ( hidden ) folderView->hide(); | 356 | if ( hidden ) folderView->hide(); |
337 | 357 | ||