author | harlekin <harlekin> | 2003-12-13 22:17:45 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-13 22:17:45 (UTC) |
commit | f1fa9ca873169e803fcc28cecd756a3edaa30ec4 (patch) (unidiff) | |
tree | 6e1f14694056c341427475d9fdddac1b9dcf99a7 | |
parent | 8290f1a524b6f0051e49f8045d24e508d46868e2 (diff) | |
download | opie-f1fa9ca873169e803fcc28cecd756a3edaa30ec4.zip opie-f1fa9ca873169e803fcc28cecd756a3edaa30ec4.tar.gz opie-f1fa9ca873169e803fcc28cecd756a3edaa30ec4.tar.bz2 |
make sure the wrapper pointer is not Ol
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 560715c..8ef7ddd 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -53,83 +53,83 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
53 | showFolders->addTo( toolBar ); | 53 | showFolders->addTo( toolBar ); |
54 | showFolders->addTo( mailMenu ); | 54 | showFolders->addTo( mailMenu ); |
55 | connect(showFolders, SIGNAL( toggled( bool ) ), | 55 | connect(showFolders, SIGNAL( toggled( bool ) ), |
56 | SLOT( slotShowFolders( bool ) ) ); | 56 | SLOT( slotShowFolders( bool ) ) ); |
57 | 57 | ||
58 | searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, | 58 | searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, |
59 | 0, 0, this ); | 59 | 0, 0, this ); |
60 | searchMails->addTo( toolBar ); | 60 | searchMails->addTo( toolBar ); |
61 | searchMails->addTo( mailMenu ); | 61 | searchMails->addTo( mailMenu ); |
62 | 62 | ||
63 | 63 | ||
64 | editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, | 64 | editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, |
65 | 0, 0, this ); | 65 | 0, 0, this ); |
66 | editSettings->addTo( settingsMenu ); | 66 | editSettings->addTo( settingsMenu ); |
67 | 67 | ||
68 | editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, | 68 | editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, |
69 | 0, 0, this ); | 69 | 0, 0, this ); |
70 | editAccounts->addTo( settingsMenu ); | 70 | editAccounts->addTo( settingsMenu ); |
71 | 71 | ||
72 | QWidget *view = new QWidget( this ); | 72 | QWidget *view = new QWidget( this ); |
73 | setCentralWidget( view ); | 73 | setCentralWidget( view ); |
74 | 74 | ||
75 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); | 75 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); |
76 | 76 | ||
77 | folderView = new AccountView( view ); | 77 | folderView = new AccountView( view ); |
78 | folderView->header()->hide(); | 78 | folderView->header()->hide(); |
79 | folderView->addColumn( tr( "Mailbox" ) ); | 79 | folderView->addColumn( tr( "Mailbox" ) ); |
80 | folderView->hide(); | 80 | folderView->hide(); |
81 | 81 | ||
82 | layout->addWidget( folderView ); | 82 | layout->addWidget( folderView ); |
83 | 83 | ||
84 | mailView = new QListView( view ); | 84 | mailView = new QListView( view ); |
85 | mailView->addColumn( tr( "Status" ) ); | 85 | mailView->addColumn( tr( "" ) ); |
86 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 86 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
87 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 87 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
88 | mailView->addColumn( tr( "Date" )); | 88 | mailView->addColumn( tr( "Date" )); |
89 | mailView->setAllColumnsShowFocus(true); | 89 | mailView->setAllColumnsShowFocus(true); |
90 | mailView->setSorting(-1); | 90 | mailView->setSorting(-1); |
91 | 91 | ||
92 | layout->addWidget( mailView ); | 92 | layout->addWidget( mailView ); |
93 | layout->setStretchFactor( folderView, 1 ); | 93 | layout->setStretchFactor( folderView, 1 ); |
94 | layout->setStretchFactor( mailView, 2 ); | 94 | layout->setStretchFactor( mailView, 2 ); |
95 | 95 | ||
96 | slotAdjustLayout(); | 96 | slotAdjustLayout(); |
97 | 97 | ||
98 | connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, | 98 | connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, |
99 | SLOT( displayMail( QListViewItem * ) ) ); | 99 | SLOT( displayMail( QListViewItem * ) ) ); |
100 | 100 | ||
101 | connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); | 101 | connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); |
102 | 102 | ||
103 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 103 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | void MainWindow::slotAdjustLayout() { | 107 | void MainWindow::slotAdjustLayout() { |
108 | 108 | ||
109 | QWidget *d = QApplication::desktop(); | 109 | QWidget *d = QApplication::desktop(); |
110 | 110 | ||
111 | if ( d->width() < d->height() ) { | 111 | if ( d->width() < d->height() ) { |
112 | layout->setDirection( QBoxLayout::TopToBottom ); | 112 | layout->setDirection( QBoxLayout::TopToBottom ); |
113 | } else { | 113 | } else { |
114 | layout->setDirection( QBoxLayout::LeftToRight ); | 114 | layout->setDirection( QBoxLayout::LeftToRight ); |
115 | } | 115 | } |
116 | delete d; | 116 | delete d; |
117 | } | 117 | } |
118 | 118 | ||
119 | void MainWindow::slotAdjustColumns() | 119 | void MainWindow::slotAdjustColumns() |
120 | { | 120 | { |
121 | bool hidden = folderView->isHidden(); | 121 | bool hidden = folderView->isHidden(); |
122 | if ( hidden ) folderView->show(); | 122 | if ( hidden ) folderView->show(); |
123 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 123 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
124 | if ( hidden ) folderView->hide(); | 124 | if ( hidden ) folderView->hide(); |
125 | 125 | ||
126 | mailView->setColumnWidth( 0, 10 ); | 126 | mailView->setColumnWidth( 0, 10 ); |
127 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 127 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); |
128 | mailView->setColumnWidth( 2, 80 ); | 128 | mailView->setColumnWidth( 2, 80 ); |
129 | mailView->setColumnWidth( 3, 50 ); | 129 | mailView->setColumnWidth( 3, 50 ); |
130 | } | 130 | } |
131 | 131 | ||
132 | void MainWindow::slotShowFolders( bool show ) | 132 | void MainWindow::slotShowFolders( bool show ) |
133 | { | 133 | { |
134 | qDebug( "Show Folders" ); | 134 | qDebug( "Show Folders" ); |
135 | if ( show && folderView->isHidden() ) { | 135 | if ( show && folderView->isHidden() ) { |
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index a73dac5..42707e3 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -83,88 +83,89 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { | |||
83 | ++w; | 83 | ++w; |
84 | if (w>=2) break; | 84 | if (w>=2) break; |
85 | } | 85 | } |
86 | switch(w) { | 86 | switch(w) { |
87 | case 1: | 87 | case 1: |
88 | q="k"; | 88 | q="k"; |
89 | break; | 89 | break; |
90 | case 2: | 90 | case 2: |
91 | q="M"; | 91 | q="M"; |
92 | break; | 92 | break; |
93 | default: | 93 | default: |
94 | q=""; | 94 | q=""; |
95 | break; | 95 | break; |
96 | } | 96 | } |
97 | QTextOStream o(&desc); | 97 | QTextOStream o(&desc); |
98 | if (w>0) o.precision(2); else o.precision(0); | 98 | if (w>0) o.precision(2); else o.precision(0); |
99 | o.setf(QTextStream::fixed); | 99 | o.setf(QTextStream::fixed); |
100 | o << s << " " << q << "Byte"; | 100 | o << s << " " << q << "Byte"; |
101 | curItem=new AttachItem(attachments,curItem,type,filename,desc,i); | 101 | curItem=new AttachItem(attachments,curItem,type,filename,desc,i); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int c ) { | 105 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int c ) { |
106 | if (!item ) | 106 | if (!item ) |
107 | return; | 107 | return; |
108 | 108 | ||
109 | QPopupMenu *menu = new QPopupMenu(); | 109 | QPopupMenu *menu = new QPopupMenu(); |
110 | int ret=0; | 110 | int ret=0; |
111 | 111 | ||
112 | if ( item->text( 0 ).left( 4 ) == "text" ) { | 112 | if ( item->text( 0 ).left( 4 ) == "text" ) { |
113 | menu->insertItem( tr( "Show Text" ), 1 ); | 113 | menu->insertItem( tr( "Show Text" ), 1 ); |
114 | } | 114 | } |
115 | menu->insertItem( tr( "Save Attachemt" ), 0 ); | 115 | menu->insertItem( tr( "Save Attachment" ), 0 ); |
116 | menu->insertSeparator(1); | 116 | menu->insertSeparator(1); |
117 | 117 | ||
118 | ret = menu->exec( point, 0 ); | 118 | ret = menu->exec( point, 0 ); |
119 | 119 | ||
120 | switch(ret) { | 120 | switch(ret) { |
121 | case 0: | 121 | case 0: |
122 | { MimeTypes types; | 122 | { MimeTypes types; |
123 | types.insert( "all", "*" ); | 123 | types.insert( "all", "*" ); |
124 | QString str = OFileDialog::getSaveFileName( 1, | 124 | QString str = OFileDialog::getSaveFileName( 1, |
125 | "/", item->text( 1 ) , types, 0 ); | 125 | "/", item->text( 1 ) , types, 0 ); |
126 | 126 | ||
127 | if( !str.isEmpty() ) { | 127 | if( !str.isEmpty() ) { |
128 | qDebug( " first we will need a MIME wrapper" ); | 128 | qDebug( "first we will need a MIME wrapper" ); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | break ; | 131 | break ; |
132 | 132 | ||
133 | case 1: | 133 | case 1: |
134 | qDebug( QString( "Test selected" ).arg( ( ( AttachItem* )item )->Partnumber() ) ); | ||
135 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { | 134 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { |
136 | setText(); | 135 | setText(); |
137 | } else { | 136 | } else { |
137 | if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions | ||
138 | browser->setText( m_recMail.Wrapper()->fetchPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 138 | browser->setText( m_recMail.Wrapper()->fetchPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
139 | } | ||
139 | } | 140 | } |
140 | break; | 141 | break; |
141 | } | 142 | } |
142 | delete menu; | 143 | delete menu; |
143 | } | 144 | } |
144 | 145 | ||
145 | 146 | ||
146 | void ViewMail::setMail( RecMail mail ) { | 147 | void ViewMail::setMail( RecMail mail ) { |
147 | 148 | ||
148 | m_recMail = mail; | 149 | m_recMail = mail; |
149 | 150 | ||
150 | m_mail[0] = mail.getFrom(); | 151 | m_mail[0] = mail.getFrom(); |
151 | m_mail[1] = mail.getSubject(); | 152 | m_mail[1] = mail.getSubject(); |
152 | m_mail[3] = mail.getDate(); | 153 | m_mail[3] = mail.getDate(); |
153 | m_mail[4] = mail.Msgid(); | 154 | m_mail[4] = mail.Msgid(); |
154 | 155 | ||
155 | m_mail2[0] = mail.To(); | 156 | m_mail2[0] = mail.To(); |
156 | m_mail2[1] = mail.CC(); | 157 | m_mail2[1] = mail.CC(); |
157 | m_mail2[2] = mail.Bcc(); | 158 | m_mail2[2] = mail.Bcc(); |
158 | 159 | ||
159 | setText(); | 160 | setText(); |
160 | } | 161 | } |
161 | 162 | ||
162 | 163 | ||
163 | 164 | ||
164 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 165 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
165 | : ViewMailBase(parent, name, fl), _inLoop(false) | 166 | : ViewMailBase(parent, name, fl), _inLoop(false) |
166 | { | 167 | { |
167 | m_gotBody = false; | 168 | m_gotBody = false; |
168 | 169 | ||
169 | connect(reply, SIGNAL(activated()), SLOT(slotReply())); | 170 | connect(reply, SIGNAL(activated()), SLOT(slotReply())); |
170 | connect(forward, SIGNAL(activated()), SLOT(slotForward())); | 171 | connect(forward, SIGNAL(activated()), SLOT(slotForward())); |