~ubuntu-branches/debian/sid/filezilla/sid

« back to all changes in this revision

Viewing changes to src/interface/statusbar.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adrien Cunin
  • Date: 2010-04-20 09:25:39 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100420092539-10d1003e0nm4zfyp
Tags: 3.3.2.1-1
* New upstream release
   - Really fixes previously mentioned bugs (the patches for them were not
     included in upstream 3.3.1)
* Added libgtk2.0-dev to build-deps
* Added libtinyxml-dev to build-deps, so that the system libtinyxml is used
* Added debian/README.source saying that dpatch is used
* Updated Standards-Version, no change needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "FileZilla.h"
 
1
#include <filezilla.h>
 
2
#include "Options.h"
 
3
#include "sftp_crypt_info_dlg.h"
 
4
#include "sizeformatting.h"
 
5
#include "speedlimits_dialog.h"
2
6
#include "statusbar.h"
3
 
#include "Options.h"
4
7
#include "verifycertdialog.h"
5
 
#include "sftp_crypt_info_dlg.h"
6
8
 
7
 
static const int statbarWidths[5] = {
8
 
        -3, 40, 20, 0, 35
 
9
static const int statbarWidths[3] = {
 
10
        -3, 0, 35
9
11
};
10
 
#define FIELD_QUEUESIZE 3
 
12
#define FIELD_QUEUESIZE 1
11
13
 
12
14
BEGIN_EVENT_TABLE(wxStatusBarEx, wxStatusBar)
13
15
EVT_SIZE(wxStatusBarEx::OnSize)
122
124
        return field;
123
125
}
124
126
 
125
 
void wxStatusBarEx::AddChild(int field, wxWindow* pChild, int cx)
126
 
{
127
 
        t_statbar_child data;
128
 
        data.field = GetFieldIndex(field);
129
 
        data.pChild = pChild;
130
 
        data.cx = cx;
131
 
 
132
 
        m_children.push_back(data);
133
 
 
134
 
        PositionChild(data);
135
 
}
136
 
 
137
 
void wxStatusBarEx::RemoveChild(int field, wxWindow* pChild)
138
 
{
139
 
        field = GetFieldIndex(field);
140
 
 
141
 
        for (std::list<struct t_statbar_child>::iterator iter = m_children.begin(); iter != m_children.end(); iter++)
142
 
        {
143
 
                if (pChild != iter->pChild)
144
 
                        continue;
145
 
 
146
 
                if (field != iter->field)
147
 
                        continue;
148
 
 
149
 
                m_children.erase(iter);
150
 
                break;
151
 
        }
152
 
}
153
 
 
154
 
void wxStatusBarEx::PositionChild(const struct wxStatusBarEx::t_statbar_child& data)
155
 
{
156
 
        const wxSize size = data.pChild->GetSize();
157
 
 
158
 
        wxRect rect;
159
 
        GetFieldRect(data.field, rect);
160
 
 
161
 
        data.pChild->SetSize(rect.x + data.cx, rect.GetTop() + (rect.GetHeight() - size.x + 1) / 2, -1, -1);
162
 
}
163
 
 
164
127
void wxStatusBarEx::OnSize(wxSizeEvent& event)
165
128
{
166
129
#ifdef __WXMSW__
183
146
                }
184
147
        }
185
148
#endif
186
 
 
187
 
        for (std::list<struct t_statbar_child>::iterator iter = m_children.begin(); iter != m_children.end(); iter++)
188
 
                PositionChild(*iter);
189
 
 
190
 
#ifdef __WXMSW__
191
 
        if (GetLayoutDirection() != wxLayout_RightToLeft)
192
 
                Update();
193
 
#endif
194
149
}
195
150
 
196
151
#ifdef __WXGTK__
210
165
}
211
166
#endif
212
167
 
 
168
int wxStatusBarEx::GetGripperWidth()
 
169
{
 
170
#if defined(__WXMSW__)
 
171
        return m_pParent->IsMaximized() ? 0 : 6;
 
172
#elif defined(__WXGTK__)
 
173
        return 15;
 
174
#else
 
175
        return 0;
 
176
#endif
 
177
}
 
178
 
 
179
 
 
180
 
 
181
BEGIN_EVENT_TABLE(CWidgetsStatusBar, wxStatusBarEx)
 
182
EVT_SIZE(CWidgetsStatusBar::OnSize)
 
183
END_EVENT_TABLE()
 
184
 
 
185
CWidgetsStatusBar::CWidgetsStatusBar(wxTopLevelWindow* parent)
 
186
        : wxStatusBarEx(parent)
 
187
{
 
188
}
 
189
 
 
190
CWidgetsStatusBar::~CWidgetsStatusBar()
 
191
{
 
192
}
 
193
 
 
194
void CWidgetsStatusBar::OnSize(wxSizeEvent& event)
 
195
{
 
196
        wxStatusBarEx::OnSize(event);
 
197
 
 
198
        for (int i = 0; i < GetFieldsCount(); i++)
 
199
                PositionChildren(i);
 
200
 
 
201
#ifdef __WXMSW__
 
202
        if (GetLayoutDirection() != wxLayout_RightToLeft)
 
203
                Update();
 
204
#endif
 
205
}
 
206
 
 
207
void CWidgetsStatusBar::AddChild(int field, int idx, wxWindow* pChild)
 
208
{
 
209
        field = GetFieldIndex(field);
 
210
 
 
211
        t_statbar_child data;
 
212
        data.field = field;
 
213
        data.pChild = pChild;
 
214
 
 
215
        m_children[idx] = data;
 
216
 
 
217
        PositionChildren(field);
 
218
}
 
219
 
 
220
void CWidgetsStatusBar::RemoveChild(int idx)
 
221
{
 
222
        std::map<int, struct t_statbar_child>::iterator iter = m_children.find(idx);
 
223
        if (iter != m_children.end())
 
224
        {
 
225
                int field = iter->second.field;
 
226
                m_children.erase(iter);
 
227
                PositionChildren(field);
 
228
        }
 
229
}
 
230
 
 
231
void CWidgetsStatusBar::PositionChildren(int field)
 
232
{
 
233
        wxRect rect;
 
234
        GetFieldRect(field, rect);
 
235
        
 
236
        int offset = 2;
 
237
 
 
238
        if (field + 1 == GetFieldsCount())
 
239
        {
 
240
                rect.SetWidth(m_columnWidths[field]);   
 
241
                offset += 5 + GetGripperWidth();
 
242
        }
 
243
 
 
244
        for (std::map<int, struct t_statbar_child>::iterator iter = m_children.begin(); iter != m_children.end(); iter++)
 
245
        {
 
246
                if (iter->second.field != field)
 
247
                        continue;
 
248
 
 
249
                const wxSize size = iter->second.pChild->GetSize();
 
250
                int position = rect.GetRight() - size.x - offset;
 
251
 
 
252
                iter->second.pChild->SetSize(position, rect.GetTop() + (rect.GetHeight() - size.y + 1) / 2, -1, -1);
 
253
 
 
254
                offset += size.x + 3;
 
255
        }
 
256
}
 
257
 
213
258
#ifdef __WXMSW__
214
259
class wxStaticBitmapEx : public wxStaticBitmap
215
260
{
271
316
EVT_RIGHT_UP(CIndicator::OnRightMouseUp)
272
317
END_EVENT_TABLE()
273
318
 
 
319
BEGIN_EVENT_TABLE(CStatusBar, CWidgetsStatusBar)
 
320
EVT_MENU(XRCID("ID_SPEEDLIMITCONTEXT_ENABLE"), CStatusBar::OnSpeedLimitsEnable)
 
321
EVT_MENU(XRCID("ID_SPEEDLIMITCONTEXT_CONFIGURE"), CStatusBar::OnSpeedLimitsConfigure)
 
322
END_EVENT_TABLE()
 
323
 
274
324
CStatusBar::CStatusBar(wxTopLevelWindow* pParent)
275
 
        : wxStatusBarEx(pParent)
 
325
        : CWidgetsStatusBar(pParent), CStateEventHandler(0)
276
326
{
 
327
        // Speedlimits
 
328
        RegisterOption(OPTION_SPEEDLIMIT_ENABLE);
 
329
        RegisterOption(OPTION_SPEEDLIMIT_INBOUND);
 
330
        RegisterOption(OPTION_SPEEDLIMIT_OUTBOUND);
 
331
 
 
332
        // Size format
 
333
        RegisterOption(OPTION_SIZE_FORMAT);
 
334
        RegisterOption(OPTION_SIZE_USETHOUSANDSEP);
 
335
        RegisterOption(OPTION_SIZE_DECIMALPLACES);
 
336
 
 
337
        RegisterOption(OPTION_ASCIIBINARY);
 
338
 
 
339
        CContextManager::Get()->RegisterHandler(this, STATECHANGE_SERVER, true, false);
 
340
        CContextManager::Get()->RegisterHandler(this, STATECHANGE_CHANGEDCONTEXT, false, false);
 
341
 
277
342
        m_pDataTypeIndicator = 0;
278
343
        m_pEncryptionIndicator = 0;
279
 
        m_pCertificate = 0;
280
 
        m_pSftpEncryptionInfo = 0;
 
344
        m_pSpeedLimitsIndicator = 0;
281
345
 
282
346
        m_size = 0;
283
347
        m_hasUnknownFiles = false;
284
348
 
285
 
        const int count = 5;
 
349
        const int count = 3;
286
350
        SetFieldsCount(count);
287
351
        int array[count];
288
 
        for (int i = 0; i < count - 2; i++)
289
 
                array[i] = wxSB_FLAT;
290
 
        array[count - 2] = wxSB_NORMAL;
291
 
        array[count - 1] = wxSB_FLAT;
 
352
        array[0] = wxSB_FLAT;
 
353
        array[1] = wxSB_NORMAL;
 
354
        array[2] = wxSB_FLAT;
292
355
        SetStatusStyles(count, array);
293
356
 
294
357
        SetStatusWidths(count, statbarWidths);
295
358
 
296
359
        UpdateSizeFormat();
 
360
 
 
361
        UpdateSpeedLimitsIcon();
 
362
        DisplayDataType();
 
363
        DisplayEncrypted();
297
364
}
298
365
 
299
366
CStatusBar::~CStatusBar()
300
367
{
301
 
        delete m_pCertificate;
302
 
        delete m_pSftpEncryptionInfo;
303
368
}
304
369
 
305
 
// Defined in LocalListView.cpp
306
 
extern wxString FormatSize(const wxLongLong& size, bool add_bytes_suffix, int format, bool thousands_separator, int num_decimal_places);
307
 
 
308
370
void CStatusBar::DisplayQueueSize(wxLongLong totalSize, bool hasUnknown)
309
371
{
310
372
        m_size = totalSize;
317
379
        }
318
380
 
319
381
        wxString queueSize = wxString::Format(_("Queue: %s%s"), hasUnknown ? _T(">") : _T(""),
320
 
                        FormatSize(totalSize, true, m_sizeFormat, m_sizeFormatThousandsSep, m_sizeFormatDecimalPlaces).c_str());
 
382
                CSizeFormat::Format(totalSize, true, m_sizeFormat, m_sizeFormatThousandsSep, m_sizeFormatDecimalPlaces).c_str());
321
383
 
322
384
        SetStatusText(queueSize, FIELD_QUEUESIZE);
323
385
}
324
386
 
325
 
void CStatusBar::DisplayDataType(const CServer* const pServer)
 
387
void CStatusBar::DisplayDataType()
326
388
{
 
389
        const CServer* pServer = 0;
 
390
        const CState* pState = CContextManager::Get()->GetCurrentContext();
 
391
        if (pState)
 
392
                pServer = pState->GetServer();
 
393
 
327
394
        if (!pServer || !CServer::ProtocolHasDataTypeConcept(pServer->GetProtocol()))
328
395
        {
329
396
                if (m_pDataTypeIndicator)
330
397
                {
331
 
                        RemoveChild(-4, m_pDataTypeIndicator);
 
398
                        RemoveChild(widget_datatype);
332
399
                        m_pDataTypeIndicator->Destroy();
333
400
                        m_pDataTypeIndicator = 0;
334
 
 
335
 
                        if (m_pEncryptionIndicator)
336
 
                        {
337
 
                                RemoveChild(-4, m_pEncryptionIndicator);
338
 
                                AddChild(-4, m_pEncryptionIndicator, 22);
339
 
                        }
340
401
                }
341
402
        }
342
403
        else
365
426
                if (!m_pDataTypeIndicator)
366
427
                {
367
428
                        m_pDataTypeIndicator = new CIndicator(this, bmp);
368
 
                        AddChild(-4, m_pDataTypeIndicator, 22);
369
 
 
370
 
                        if (m_pEncryptionIndicator)
371
 
                        {
372
 
                                RemoveChild(-4, m_pEncryptionIndicator);
373
 
                                AddChild(-4, m_pEncryptionIndicator, 2);
374
 
                        }
 
429
                        AddChild(0, widget_datatype, m_pDataTypeIndicator);
375
430
                }
376
431
                else
377
432
                        m_pDataTypeIndicator->SetBitmap(bmp);
395
450
        }
396
451
        s.IncTo(dc.GetTextExtent(wxString::Format(_("Queue: %s MiB"), tmp.c_str())));
397
452
 
398
 
        SetFieldWidth(-2, s.x + 10);
 
453
        SetFieldWidth(FIELD_QUEUESIZE, s.x + 10);
399
454
}
400
455
 
401
 
void CStatusBar::DisplayEncrypted(const CServer* const pServer)
 
456
void CStatusBar::DisplayEncrypted()
402
457
{
403
 
        delete m_pCertificate;
404
 
        m_pCertificate = 0;
405
 
        delete m_pSftpEncryptionInfo;
406
 
        m_pSftpEncryptionInfo = 0;
 
458
        const CServer* pServer = 0;
 
459
        const CState* pState = CContextManager::Get()->GetCurrentContext();
 
460
        if (pState)
 
461
                pServer = pState->GetServer();
 
462
 
407
463
        if (!pServer || (pServer->GetProtocol() != FTPS && pServer->GetProtocol() != FTPES && pServer->GetProtocol() != SFTP))
408
464
        {
409
465
                if (m_pEncryptionIndicator)
410
466
                {
411
 
                        RemoveChild(-4, m_pEncryptionIndicator);
 
467
                        RemoveChild(widget_encryption);
412
468
                        m_pEncryptionIndicator->Destroy();
413
469
                        m_pEncryptionIndicator = 0;
414
470
                }
419
475
                        return;
420
476
                wxBitmap bmp = wxArtProvider::GetBitmap(_T("ART_LOCK"), wxART_OTHER, wxSize(16, 16));
421
477
                m_pEncryptionIndicator = new CIndicator(this, bmp);
422
 
                AddChild(-4, m_pEncryptionIndicator, m_pDataTypeIndicator ? 2 : 22);
 
478
                AddChild(0, widget_encryption, m_pEncryptionIndicator);
423
479
 
424
480
                m_pEncryptionIndicator->SetToolTip(_("The connection is encrypted. Click icon for details."));
425
481
        }
429
485
{
430
486
        // 0 equals bytes, however just use IEC binary prefixes instead, 
431
487
        // exact byte counts for queue make no sense.
432
 
        m_sizeFormat = COptions::Get()->GetOptionVal(OPTION_SIZE_FORMAT);
 
488
        m_sizeFormat = CSizeFormat::_format(COptions::Get()->GetOptionVal(OPTION_SIZE_FORMAT));
433
489
        if (!m_sizeFormat)
434
 
                m_sizeFormat = 1;
 
490
                m_sizeFormat = CSizeFormat::iec;
435
491
 
436
492
        m_sizeFormatThousandsSep = COptions::Get()->GetOptionVal(OPTION_SIZE_USETHOUSANDSEP) != 0;
437
493
        m_sizeFormatDecimalPlaces = COptions::Get()->GetOptionVal(OPTION_SIZE_DECIMALPLACES);
443
499
 
444
500
void CStatusBar::OnHandleLeftClick(wxWindow* pWnd)
445
501
{
446
 
        if (pWnd != m_pEncryptionIndicator)
447
 
                return;
448
 
 
449
 
        if (m_pCertificate)
450
 
        {
451
 
                CVerifyCertDialog dlg;
452
 
                dlg.ShowVerificationDialog(m_pCertificate, true);
453
 
        }
454
 
        else if (m_pSftpEncryptionInfo)
455
 
        {
456
 
                CSftpEncryptioInfoDialog dlg;
457
 
                dlg.ShowDialog(m_pSftpEncryptionInfo);
458
 
        }
459
 
        else
460
 
                wxMessageBox(_("Certificate and session data are not available yet."), _("Security information"));
 
502
        if (pWnd == m_pEncryptionIndicator)
 
503
        {
 
504
                CState* pState = CContextManager::Get()->GetCurrentContext();
 
505
                CCertificateNotification *pCertificateNotification = 0;
 
506
                CSftpEncryptionNotification *pSftpEncryptionNotification = 0;
 
507
                if (pState->GetSecurityInfo(pCertificateNotification))
 
508
                {
 
509
                        CVerifyCertDialog dlg;
 
510
                        dlg.ShowVerificationDialog(pCertificateNotification, true);
 
511
                }
 
512
                else if (pState->GetSecurityInfo(pSftpEncryptionNotification))
 
513
                {
 
514
                        CSftpEncryptioInfoDialog dlg;
 
515
                        dlg.ShowDialog(pSftpEncryptionNotification);
 
516
                }
 
517
                else
 
518
                        wxMessageBox(_("Certificate and session data are not available yet."), _("Security information"));
 
519
        }
 
520
        else if (pWnd == m_pSpeedLimitsIndicator)
 
521
        {
 
522
                CSpeedLimitsDialog dlg;
 
523
                dlg.Run(m_pParent);
 
524
        }
461
525
}
462
526
 
463
527
void CStatusBar::OnHandleRightClick(wxWindow* pWnd)
464
528
{
465
 
        if (pWnd != m_pDataTypeIndicator)
466
 
                return;
467
 
 
468
 
        wxMenu* pMenu = wxXmlResource::Get()->LoadMenu(_T("ID_MENU_TRANSFER_TYPE_CONTEXT"));
469
 
        if (!pMenu)
470
 
                return;
471
 
        
472
 
        const int type = COptions::Get()->GetOptionVal(OPTION_ASCIIBINARY);
473
 
        switch (type)
474
 
        {
475
 
        case 1:
476
 
                pMenu->Check(XRCID("ID_MENU_TRANSFER_TYPE_ASCII"), true);
477
 
                break;
478
 
        case 2:
479
 
                pMenu->Check(XRCID("ID_MENU_TRANSFER_TYPE_BINARY"), true);
 
529
        if (pWnd == m_pDataTypeIndicator)
 
530
        {
 
531
                wxMenu* pMenu = wxXmlResource::Get()->LoadMenu(_T("ID_MENU_TRANSFER_TYPE_CONTEXT"));
 
532
                if (!pMenu)
 
533
                        return;
 
534
        
 
535
                const int type = COptions::Get()->GetOptionVal(OPTION_ASCIIBINARY);
 
536
                switch (type)
 
537
                {
 
538
                case 1:
 
539
                        pMenu->Check(XRCID("ID_MENU_TRANSFER_TYPE_ASCII"), true);
 
540
                        break;
 
541
                case 2:
 
542
                        pMenu->Check(XRCID("ID_MENU_TRANSFER_TYPE_BINARY"), true);
 
543
                        break;
 
544
                default:
 
545
                        pMenu->Check(XRCID("ID_MENU_TRANSFER_TYPE_AUTO"), true);
 
546
                        break;
 
547
                }
 
548
 
 
549
                PopupMenu(pMenu);
 
550
                delete pMenu;
 
551
        }
 
552
        else if (pWnd == m_pSpeedLimitsIndicator)
 
553
        {
 
554
                wxMenu* pMenu = wxXmlResource::Get()->LoadMenu(_T("ID_MENU_SPEEDLIMITCONTEXT"));
 
555
                if (!pMenu)
 
556
                        return;
 
557
 
 
558
                int downloadlimit = COptions::Get()->GetOptionVal(OPTION_SPEEDLIMIT_INBOUND);
 
559
                int uploadlimit = COptions::Get()->GetOptionVal(OPTION_SPEEDLIMIT_OUTBOUND);
 
560
                bool enable = COptions::Get()->GetOptionVal(OPTION_SPEEDLIMIT_ENABLE) != 0;
 
561
                if (!downloadlimit && !uploadlimit)
 
562
                        enable = false;
 
563
                pMenu->Check(XRCID("ID_SPEEDLIMITCONTEXT_ENABLE"), enable);
 
564
 
 
565
                PopupMenu(pMenu);
 
566
                delete pMenu;
 
567
        }
 
568
}
 
569
 
 
570
void CStatusBar::UpdateSpeedLimitsIcon()
 
571
{
 
572
        bool enable = COptions::Get()->GetOptionVal(OPTION_SPEEDLIMIT_ENABLE) != 0;
 
573
 
 
574
        wxBitmap bmp = wxArtProvider::GetBitmap(_T("ART_SPEEDLIMITS"), wxART_OTHER, wxSize(16, 16));
 
575
        wxString tooltip;
 
576
 
 
577
        int downloadLimit = COptions::Get()->GetOptionVal(OPTION_SPEEDLIMIT_INBOUND);
 
578
        int uploadLimit = COptions::Get()->GetOptionVal(OPTION_SPEEDLIMIT_OUTBOUND);
 
579
        if (!enable || (!downloadLimit && !uploadLimit))
 
580
        {
 
581
                wxImage img = bmp.ConvertToImage();
 
582
                img = img.ConvertToGreyscale();
 
583
                bmp = wxBitmap(img);
 
584
                tooltip = _("Speed limits are disabled, click to change.");
 
585
        }
 
586
        else
 
587
        {
 
588
                tooltip = _("Speed limits are enabled, click to change.");
 
589
                tooltip += _T("\n");
 
590
                if (downloadLimit)
 
591
                        tooltip += wxString::Format(_("Download limit: %s/s"), CSizeFormat::FormatUnit(downloadLimit, CSizeFormat::kilo).c_str());
 
592
                else
 
593
                        tooltip += _("Download limit: none");
 
594
                tooltip += _T("\n");
 
595
                if (uploadLimit)
 
596
                        tooltip += wxString::Format(_("Upload limit: %s/s"), CSizeFormat::FormatUnit(uploadLimit, CSizeFormat::kilo).c_str());
 
597
                else
 
598
                        tooltip += _("Upload limit: none");
 
599
        }
 
600
        
 
601
        if (!m_pSpeedLimitsIndicator)
 
602
        {
 
603
                m_pSpeedLimitsIndicator = new CIndicator(this, bmp);
 
604
                AddChild(0, widget_speedlimit, m_pSpeedLimitsIndicator);
 
605
        }
 
606
        else
 
607
        {
 
608
                m_pSpeedLimitsIndicator->SetBitmap(bmp);
 
609
        }
 
610
        m_pSpeedLimitsIndicator->SetToolTip(tooltip);
 
611
}
 
612
 
 
613
void CStatusBar::OnOptionChanged(int option)
 
614
{
 
615
        switch (option)
 
616
        {
 
617
        case OPTION_SPEEDLIMIT_ENABLE:
 
618
        case OPTION_SPEEDLIMIT_INBOUND:
 
619
        case OPTION_SPEEDLIMIT_OUTBOUND:
 
620
                UpdateSpeedLimitsIcon();
 
621
                break;
 
622
        case OPTION_SIZE_FORMAT:
 
623
        case OPTION_SIZE_USETHOUSANDSEP:
 
624
        case OPTION_SIZE_DECIMALPLACES:
 
625
                UpdateSizeFormat();
 
626
                break;
 
627
        case OPTION_ASCIIBINARY:
 
628
                DisplayDataType();
480
629
                break;
481
630
        default:
482
 
                pMenu->Check(XRCID("ID_MENU_TRANSFER_TYPE_AUTO"), true);
483
631
                break;
484
632
        }
485
 
 
486
 
        PopupMenu(pMenu);
487
 
        delete pMenu;
488
 
}
489
 
 
490
 
void CStatusBar::SetCertificate(CCertificateNotification* pCertificate)
491
 
{
492
 
        delete m_pSftpEncryptionInfo;
493
 
        m_pSftpEncryptionInfo = 0;
494
 
 
495
 
        delete m_pCertificate;
496
 
        if (pCertificate)
497
 
                m_pCertificate = new CCertificateNotification(*pCertificate);
498
 
        else
499
 
                m_pCertificate = 0;
500
 
}
501
 
 
502
 
void CStatusBar::SetSftpEncryptionInfo(const CSftpEncryptionNotification* pEncryptionInfo)
503
 
{
504
 
        delete m_pCertificate;
505
 
        m_pCertificate = 0;
506
 
 
507
 
        delete m_pSftpEncryptionInfo;
508
 
        if (pEncryptionInfo)
509
 
                m_pSftpEncryptionInfo = new CSftpEncryptionNotification(*pEncryptionInfo);
510
 
        else
511
 
                m_pSftpEncryptionInfo = 0;
 
633
}
 
634
 
 
635
void CStatusBar::OnStateChange(CState* pState, enum t_statechange_notifications notification, const wxString& data, const void* data2)
 
636
{
 
637
        if (notification == STATECHANGE_SERVER || notification == STATECHANGE_CHANGEDCONTEXT)
 
638
        {
 
639
                DisplayDataType();
 
640
                DisplayEncrypted();
 
641
        }
 
642
}
 
643
 
 
644
void CStatusBar::OnSpeedLimitsEnable(wxCommandEvent& event)
 
645
{
 
646
        int downloadlimit = COptions::Get()->GetOptionVal(OPTION_SPEEDLIMIT_INBOUND);
 
647
        int uploadlimit = COptions::Get()->GetOptionVal(OPTION_SPEEDLIMIT_OUTBOUND);
 
648
        bool enable = COptions::Get()->GetOptionVal(OPTION_SPEEDLIMIT_ENABLE) == 0;
 
649
        if (enable)
 
650
        {
 
651
                if (!downloadlimit && !uploadlimit)
 
652
                {
 
653
                        CSpeedLimitsDialog dlg;
 
654
                        dlg.Run(m_pParent);
 
655
                }
 
656
                else
 
657
                        COptions::Get()->SetOption(OPTION_SPEEDLIMIT_ENABLE, 1);
 
658
        }
 
659
        else
 
660
                COptions::Get()->SetOption(OPTION_SPEEDLIMIT_ENABLE, 0);
 
661
}
 
662
 
 
663
void CStatusBar::OnSpeedLimitsConfigure(wxCommandEvent& event)
 
664
{
 
665
        CSpeedLimitsDialog dlg;
 
666
        dlg.Run(m_pParent);
512
667
}