MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / PushQueueItem

Method PushQueueItem

src/Windows/QueueWindow.cpp:63–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63int QueueWindow::PushQueueItem(QueueOperation * op) {
64 QueueOperation::QueueType type = op->GetType();
65 if (!ValidType(type))
66 return -1;
67
68 LVITEM lvi;
69 lvi.mask = LVIF_TEXT | LVIF_PARAM;
70 lvi.iItem = GetNrItems();
71 lvi.iSubItem = 0;
72 lvi.lParam = (LPARAM)op;
73 lvi.pszText = (TCHAR*)(type==QueueOperation::QueueTypeDownload||type==QueueOperation::QueueTypeDownloadHandle?TEXT("Download"):TEXT("Upload"));
74
75 int index = ListView_InsertItem(m_hwnd, &lvi);
76 if (index == -1)
77 return -1;
78
79 ListView_SetItemText(m_hwnd, index, 1, TEXT("0.0%") );
80
81 TCHAR * path = NULL;
82 if (type == QueueOperation::QueueTypeDownload) {
83 QueueDownload * qdld = (QueueDownload*)op;
84 path = SU::Utf8ToTChar(qdld->GetExternalPath());
85 } else if (type == QueueOperation::QueueTypeDownloadHandle) {
86 QueueDownloadHandle * qdld = (QueueDownloadHandle*)op;
87 path = SU::Utf8ToTChar(qdld->GetExternalPath());
88 } else if (type == QueueOperation::QueueTypeUpload) {
89 QueueUpload * quld = (QueueUpload*)op;
90 path = SU::Utf8ToTChar(quld->GetExternalPath());
91 }
92
93 ListView_SetItemText(m_hwnd, index, 2, path );
94 SU::FreeTChar(path);
95
96 return 0;
97}
98
99int QueueWindow::PopQueueItem(QueueOperation * op) {
100 if (!ValidType(op->GetType()))

Callers 1

MessageProcMethod · 0.80

Calls 2

GetExternalPathMethod · 0.80
GetTypeMethod · 0.45

Tested by

no test coverage detected