-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpcloudapp.cpp
More file actions
2367 lines (2146 loc) · 87.2 KB
/
pcloudapp.cpp
File metadata and controls
2367 lines (2146 loc) · 87.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "pcloudapp.h"
#include "common.h"
#include <QDesktopWidget>
#include <QMenu>
#include <QUrl>
#include <QDir>
#include <QDesktopServices>
#include <unistd.h>
#include <QDebug> //temp
#include "unistd.h" //for sync statuses
#include <QTextCodec>
#include <QWidgetAction> //temp maybe
#include <QMutex>
#include <QProcess>
#include "ui_pcloudwindow.h"
#ifdef Q_OS_WIN
#include <windows.h> //TEMP
#endif
PCloudApp* PCloudApp::appStatic = NULL;
QMutex mutex(QMutex::Recursive);
void PCloudApp::hideAllWindows(){
if (regwin && regwin->isVisible())
regwin->hide();
if (logwin && logwin->isVisible())
logwin->close();
if (pCloudWin && pCloudWin->isVisible())
pCloudWin->hide();
if(welcomeWin && welcomeWin->isVisible())
welcomeWin->hide();
if(introwin && introwin->isVisible())
introwin->close();
if(!loggedin)
{
if(sharefolderwin && sharefolderwin->isVisible())
sharefolderwin->hide();
if(syncFldrsWin && syncFldrsWin->isVisible())
syncFldrsWin->hide();
}
}
void PCloudApp::showWindow(QMainWindow *win)
{
QDesktopWidget *desktop = QApplication::desktop();
int x = (desktop->width() - win->width()) / 2;
int y = (desktop->height() - win->height()) / 2;
win->move(x,y); //center the win
win->raise();
win->activateWindow();
win->showNormal();
win->setWindowState(Qt::WindowActive);
this->setActiveWindow(win);
}
void PCloudApp::showRegister()
{
hideAllWindows();
int currPage;
QString user = psync_get_username();
if (user != "") //case after logout when the user is still linked
currPage = 1; // we have a linked user
else
currPage = 0; //register
if (!regwin)
regwin=new RegisterWindow(this,currPage);
else
regwin->setCurrPage(currPage);
showWindow(regwin);
/*
QMessageBox msgBox;
msgBox.setWindowTitle("pCloud Drive");
msgBox.setText(trUtf8 ("User %1 has already linked in.").arg(user));
msgBox.setInformativeText(trUtf8 ("Do you want to unlink %1 and continue?").arg(user));
msgBox.setStandardButtons(QMessageBox::Cancel);
msgBox.addButton(trUtf8("Unlink"), QMessageBox::YesRole);
if(msgBox.exec() != QMessageBox::Cancel)
{
this->unlink();
hideAllWindows();
}
else
this->showLogin();
}
else
{
if (!regwin)
regwin=new RegisterWindow(this, 0); // register
showWindow(regwin);
}
*/
}
void PCloudApp::showLogin(){
hideAllWindows();
if (!logwin)
logwin=new LoginWindow(this);
showWindow(logwin);
}
void PCloudApp::showAccount()
{
if (welcomeWin && welcomeWin->isVisible())
return;
hideAllWindows();
pCloudWin->setCurrntIndxPclWin(ACCNT_LOGGED_PAGE_NUM);
this->showWindow(pCloudWin);
}
void PCloudApp::showDrive() // osbolete specif
{
if(psync_fs_isstarted())
emit this->openCloudDir();
else
{
hideAllWindows();
//pCloudWin->setCurrntIndxPclWin(DRIVE_PAGE_NUM);
this->showWindow(pCloudWin);
}
}
void PCloudApp::showSync()
{
hideAllWindows();
pCloudWin->setCurrntIndxPclWin(SYNC_PAGE_NUM);
pCloudWin->get_sync_page()->openTab(0);
this->showWindow(pCloudWin);
}
void PCloudApp::showShares()
{
hideAllWindows();
pCloudWin->setCurrntIndxPclWin(SHARES_PAGE_NUM);
this->showWindow(pCloudWin);
}
void PCloudApp::showCrypto()
{
hideAllWindows();
pCloudWin->setCurrntIndxPclWin(CRYPTO_PAGE_NUM);
this->showWindow(pCloudWin);
}
void PCloudApp::showSettings()
{
hideAllWindows();
pCloudWin->setCurrntIndxPclWin(SETTINGS_PAGE_NUM);
this->showWindow(pCloudWin);
}
void PCloudApp::showpcloudHelp()
{
hideAllWindows();
pCloudWin->setCurrntIndxPclWin(HELP_PAGE_NUM);
this->showWindow(pCloudWin);
}
void PCloudApp::showpCloudAbout(){
hideAllWindows();
pCloudWin->setCurrntIndxPclWin(ABOUT_PAGE_NUM);
this->showWindow(pCloudWin);
}
const QPoint PCloudApp::calcWinNextToTrayCoords(const int winWidth, const int winHeigh)
{
QDesktopWidget *desktop = QApplication::desktop();
int xres, yres, avlbGeomW = desktop->availableGeometry().width();
QPoint trayBL = this->tray->geometry().bottomLeft();
if (trayBL.x() <2 || trayBL.y()<2)
return QPoint (desktop->availableGeometry().bottomRight().rx()-winWidth, desktop->availableGeometry().bottomRight().ry()-winHeigh); //default location
QPoint avlbGeomTL = desktop->availableGeometry().topLeft();
int trayx = trayBL.x(), trayy = trayBL.y();
//qDebug()<<"calcWinNextToTrayCoords" << trayBL << avlbGeomTL<<"menu"<<loggedmenu->geometry().topLeft()<<"tray coords"<< trayx<<trayy << winHeigh;
//calc x
if(trayx < avlbGeomW/2) // I or IV quadrant (left vertical half of the screen)
{
xres = qMax(trayx, avlbGeomTL.x());
}
else //II or III quadrant
{
xres = qMin(trayx,avlbGeomW - winWidth);
}
//calc y
if(trayy < desktop->availableGeometry().height()/2) //I or II quadrant
{
yres = qMax(trayy, desktop->availableGeometry().left());
}
else // III or IV quadrant
{
yres = qMin(trayy, desktop->availableGeometry().bottom() - winHeigh);
}
//qDebug()<<"calcWinNextToTrayCoords res"<<xres<<yres;
return QPoint(xres,yres);
}
void PCloudApp::openCloudDir()
{
QDesktopServices::openUrl(QUrl::fromLocalFile(psync_fs_getmountpoint()));
/*p QString path = settings->get("path");
#ifdef Q_OS_WIN
int retray = 5;
char drive = path.toUtf8().at(0);
if (drive >= 'A' && drive <= 'Z')
drive -= 'A';
else if (drive >= 'a' && drive <= 'z')
drive -= 'a';
else return;
while (retray-- && !isConnected(drive)){
Sleep(1000);
}
if (!QProcess::startDetached("explorer.exe", QStringList(path))){
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
}
#else
if (isMounted()){
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
}
#endif
*/
}
void PCloudApp::logOut(){
loggedin=false;
#ifdef Q_OS_WIN
/*p
if (notifythread){
notifythread->terminate();
notifythread->wait();
delete notifythread;
notifythread = NULL;
}
*/
#endif
username="";
if(this->lastStatus != PSTATUS_BAD_LOGIN_DATA || this->lastStatus != PSTATUS_LOGIN_REQUIRED || this->lastStatus != PSTATUS_BAD_LOGIN_TOKEN)
psync_logout();
tray->setContextMenu(notloggedmenu);
tray->setToolTip("pCloud");
pCloudWin->setOnlineItems(false);
emit changeSyncIcon(0);
this->hideAllWindows();
if(!this->unlinkFlag)
this->isFirstLaunch = false;
notificationsMngr->clear();
this->showLogin();
//p unmount
}
void PCloudApp::unlink()
{
psync_unlink();
unlinkFlag = true; //init the sync gui part, remove synced folder menu etc.
if(isLogedIn()) // when unlink come from the pcloudwin and the user was logged
emit this->logOut(); //sets offline gui items also
setFirstLaunch(true); // to show suggestions
if(noFreeSpaceMsgShownFlag)
noFreeSpaceMsgShownFlag = false;
removeSetting("autostartcrypto");
//clearAllSettings();
//stopfs
}
void PCloudApp::removeSetting(QString settingKey)
{
if(settings->contains(settingKey))
settings->remove(settingKey);
}
void PCloudApp::clearUpdtNotifctnSettngs()
{
removeSetting("vrsnNotifyInvervalIndx");
}
void PCloudApp::clearAllSettings()
{
clearUpdtNotifctnSettngs();
//clear settings from settings page
#ifdef Q_OS_WIN
removeSetting("shellExt");
if(!registrySttng->contains("pCloud")) //set app to auto start with windows; this setting is written in windows registry
{
QSettings appDir("HKEY_LOCAL_MACHINE\\SOFTWARE\\PCloud\\pCloud",QSettings::NativeFormat); //take app install ddir
registrySttng->setValue("pCloud",appDir.value("Install_Dir").toString().append("\\pCloud.exe"));
}
#endif
}
void PCloudApp::doExit(){
//p unMount();
// psync_destroy();
quit();
}
void PCloudApp::showOnClick(){
/*p if (loggedin)
openCloudDir();
else
showLogin();
*/
if(!loggedin)
showLogin();
else
{
if(this->newNtfFLag)
{
notificationsMngr->showNotificationsWin();
this->newNtfFLag = false;
}
else
this->openCloudDir();
}
}
void PCloudApp::trayClicked(QSystemTrayIcon::ActivationReason reason)
{
// qDebug()<<Q_FUNC_INFO<<"tray activation reason"<<reason;
if (reason == QSystemTrayIcon::Trigger || reason == QSystemTrayIcon::MiddleClick) //3 = Trigger - left click
showOnClick();
}
void PCloudApp::createMenus()
{
notloggedmenu=new QMenu();
QIcon plusIcon, loginIcon,helpIcon, aboutIcon, exitIcon, accntIcon, userinfoIcon, driveIcon, cryptoIcon, cryptoUnlckIcon, cryptoFldrIcon,
sttngsIcon, pauseIcon, resumeIcon, dwnldIcon, upldIcon, syncIcon, shareIcon, manageIcon;
if(this->desktopEnv == "ubuntu") //
{
plusIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/plus.png"), QIcon::Normal);
loginIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/login.png"), QIcon::Normal);
aboutIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/info.png"), QIcon::Normal);
helpIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/help.png"), QIcon::Normal);
exitIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/exit.png"), QIcon::Normal);
accntIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/user.png"), QIcon::Normal);
userinfoIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/spaceinfo.png"), QIcon::Normal);
driveIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/drive.png"), QIcon::Normal);
cryptoIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/crypto.png"), QIcon::Normal);
cryptoUnlckIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/crypto-unlck.png"), QIcon::Normal);
cryptoFldrIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/cryptoFldr.png"), QIcon::Normal);
ntfIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/notifications.png"), QIcon::Normal);
sttngsIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/settings.png"), QIcon::Normal);
pauseIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/pause.png"), QIcon::Normal);
resumeIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/resume.png"), QIcon::Normal);
dwnldIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/download.png"), QIcon::Normal);
upldIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/upload.png"), QIcon::Normal);
syncIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/sync.png"), QIcon::Normal);
shareIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/share.png"), QIcon::Normal);
manageIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/manage.png"), QIcon::Normal);
emptyFldrIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/emptyfolder.png"), QIcon::Normal);
newNtfIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/lightgray/notifications-new.png"), QIcon::Normal);
newNtfIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/notifications-new-active.png"), QIcon::Active);
}
else
{
plusIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/plus.png"), QIcon::Normal);
loginIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/login.png"), QIcon::Normal);
aboutIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/info.png"), QIcon::Normal);
helpIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/help.png"), QIcon::Normal);
exitIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/exit.png"), QIcon::Normal);
accntIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/user.png"), QIcon::Normal);
userinfoIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/spaceinfo.png"), QIcon::Normal);
driveIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/drive.png"), QIcon::Normal);
cryptoIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/crypto.png"), QIcon::Normal);
cryptoUnlckIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/crypto-unlck.png"), QIcon::Normal);
cryptoFldrIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/cryptoFldr.png"), QIcon::Normal);
ntfIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/notifications.png"), QIcon::Normal);
sttngsIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/settings.png"), QIcon::Normal);
pauseIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/pause.png"), QIcon::Normal);
resumeIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/resume.png"), QIcon::Normal);
dwnldIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/download.png"), QIcon::Normal);
upldIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/upload.png"), QIcon::Normal);
syncIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/sync.png"), QIcon::Normal);
shareIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/share.png"), QIcon::Normal);
manageIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/manage.png"), QIcon::Normal);
emptyFldrIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/darkgray/emptyfolder.png"), QIcon::Normal);
}
#ifdef Q_OS_WIN
// if(notloggedmenu->palette().highlightedText().color().value() == 255)
plusIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/plus.png"), QIcon::Active);
loginIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/login.png"), QIcon::Active);
aboutIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/info.png"), QIcon::Active);
helpIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/help.png"), QIcon::Active);
exitIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/exit.png"), QIcon::Active);
accntIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/user.png"), QIcon::Active);
userinfoIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/spaceinfo.png"), QIcon::Active);
driveIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/drive.png"), QIcon::Active);
cryptoIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/crypto.png"), QIcon::Active);
cryptoUnlckIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/crypto-unlck.png"), QIcon::Active);
cryptoFldrIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/cryptoFldr.png"), QIcon::Active);
ntfIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/notifications.png"), QIcon::Active);
sttngsIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/settings.png"), QIcon::Active);
pauseIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/pause.png"), QIcon::Active);
resumeIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/resume.png"), QIcon::Active);
dwnldIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/download.png"), QIcon::Active);
upldIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/upload.png"), QIcon::Active);
syncIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/sync.png"), QIcon::Active);
shareIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/share.png"), QIcon::Active);
manageIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/manage.png"), QIcon::Active);
emptyFldrIcon.addPixmap(QPixmap(":/menu/images/menu 16x16/white/emptyfolder.png"), QIcon::Active);
#endif
//NOTLOGGED MENU
registerAction=new QAction(plusIcon, trUtf8 ("Register"), this);
connect(registerAction, SIGNAL(triggered()), this, SLOT(showRegister()));
loginAction=new QAction(loginIcon, trUtf8("Login"), this);
connect(loginAction, SIGNAL(triggered()), this, SLOT(showLogin()));
helpAction = new QAction(helpIcon, trUtf8("Help"),this);
connect(helpAction, SIGNAL(triggered()), this, SLOT(showpcloudHelp()));
aboutPCloudAction = new QAction(aboutIcon, trUtf8("About"), this);
connect(aboutPCloudAction, SIGNAL(triggered()), this, SLOT(showpCloudAbout()));
exitAction=new QAction(exitIcon, trUtf8("Exit"), this); // to be hidden in account tab
connect(exitAction, SIGNAL(triggered()), this, SLOT(doExit()));
notloggedmenu->addAction(registerAction);
notloggedmenu->addAction(loginAction);
notloggedmenu->addSeparator();
notloggedmenu->addAction(helpAction);
notloggedmenu->addAction(aboutPCloudAction);
notloggedmenu->addSeparator();
notloggedmenu->addAction(exitAction);
//LOGGED MENU
//main menu actions
accountAction = new QAction(accntIcon, trUtf8("Account"), this); // Account tab
connect(accountAction, SIGNAL(triggered()),this, SLOT(showAccount()));
userinfoAction = new QAction(userinfoIcon, "", this); //UserInfo - space action
driveAction = new QAction(driveIcon, trUtf8("Open Drive"), this); //pDrive tab
//connect(driveAction, SIGNAL(triggered()), this, SLOT(showDrive()));
connect(driveAction, SIGNAL(triggered()), this, SLOT(openCloudDir()));
//crypto
cryptoWelcomeAction = new QAction(cryptoIcon, trUtf8("Crypto"), this); //Crypto tab
connect(cryptoWelcomeAction, SIGNAL(triggered()), this, SLOT(showCrypto()));
cryptoFldrLockedAction = new QAction(cryptoUnlckIcon, trUtf8("Unlock Crypto"), this);
connect(cryptoFldrLockedAction, SIGNAL(triggered()), this, SLOT(unlockCryptoFldr()));
cryptoFldrUnlockedAction = new QAction(cryptoIcon, trUtf8("Lock Crypto"), this);
connect(cryptoFldrUnlockedAction, SIGNAL(triggered()), this, SLOT(lockCryptoFldr()));
cryptoOpenFldrAction = new QAction(cryptoFldrIcon, trUtf8("Open Folder"),this);
connect(cryptoOpenFldrAction, SIGNAL(triggered()), this, SLOT(openCryptoFldr()));
notfctnsAction = new QAction (ntfIcon, trUtf8("Notifications"), this);
if(this->desktopEnv == "ubuntu" && this->newNtfFLag)
notfctnsAction->setIcon(newNtfIcon);
connect(notfctnsAction, SIGNAL(triggered()), notificationsMngr, SLOT(showNotificationsWin()));
settingsAction=new QAction(sttngsIcon, trUtf8("Settings"), this); //Settings tab
connect(settingsAction, SIGNAL(triggered()), this, SLOT(showSettings()));
pauseSyncAction = new QAction(pauseIcon, trUtf8("Pause"),this);
connect(pauseSyncAction, SIGNAL(triggered()),this,SLOT(pauseSync()));
resumeSyncAction = new QAction(resumeIcon, trUtf8("Resume"), this);
connect(resumeSyncAction, SIGNAL(triggered()), this, SLOT(resumeSync()));
syncDownldAction = new QAction(dwnldIcon, trUtf8("Everything downloaded"),this);
syncUpldAction = new QAction(upldIcon, trUtf8("Everything uploaded"),this);
//sync actions
syncAction = new QAction(manageIcon, trUtf8("Manage"),this);
connect(syncAction, SIGNAL(triggered()), this, SLOT(showSync()));
addSyncAction = new QAction(plusIcon, trUtf8("Add New"),this);
connect(addSyncAction, SIGNAL(triggered()),this, SLOT(addNewSync()));
connect(this, SIGNAL(addNewSyncSgnl()), this, SLOT(addNewSync()));
connect(this, SIGNAL(addNewSyncLstSgnl(bool)), this, SLOT(addNewSyncLst(bool))); //for creating syncs from OS file browser Contextmenu
//shares actions
sharesAction = new QAction(manageIcon, trUtf8("Manage"),this);
connect(sharesAction, SIGNAL(triggered()), this, SLOT(showShares()));
shareFolderAction = new QAction(plusIcon, trUtf8("Add New"),this);
connect(shareFolderAction, SIGNAL(triggered()), this, SLOT(addNewShare()));
//create tray menu and it's submenus and add actions
loggedmenu = new QMenu();
loggedmenu->addAction(driveAction);
loggedmenu->addAction(cryptoWelcomeAction);
loggedmenu->addAction(cryptoFldrLockedAction);
cryptoUnlockedMenu = new QMenu(trUtf8("Crypto"));
cryptoUnlockedMenu->setIcon(cryptoIcon);
cryptoUnlockedMenuAction = loggedmenu->addMenu(cryptoUnlockedMenu);
cryptoUnlockedMenu->addAction(cryptoOpenFldrAction);
cryptoUnlockedMenu->addAction(cryptoFldrUnlockedAction);
loggedmenu->addSeparator();
syncMenu = loggedmenu->addMenu(syncIcon, trUtf8("Sync"));
syncedFldrsMenu = syncMenu->addMenu(emptyFldrIcon, trUtf8("Synced Folders"));
// this->createSyncFolderActions(); //loads sub menu with local synced folders
syncMenu->addSeparator();
syncMenu->addAction(syncAction);
syncMenu->addAction(addSyncAction);
sharesMenu = loggedmenu->addMenu(shareIcon, trUtf8("Shares"));
sharesMenu->addAction(sharesAction);
sharesMenu->addAction(shareFolderAction);
loggedmenu->addSeparator();
loggedmenu->addAction(notfctnsAction);
loggedmenu->addAction(settingsAction);
loggedmenu->addAction(accountAction);
loggedmenu->addAction(userinfoAction);
loggedmenu->addAction(helpAction);
loggedmenu->addAction(aboutPCloudAction);
loggedmenu->addSeparator();
loggedmenu->addAction(exitAction);
loggedmenu->addSeparator();
loggedmenu->addAction(pauseSyncAction);
loggedmenu->addAction(resumeSyncAction);
loggedmenu->addAction(syncUpldAction);
loggedmenu->addAction(syncDownldAction);
pstatus_t status;
memset(&status, 0, sizeof(status));
psync_get_status(&status);
if (status.status != PSTATUS_PAUSED)
{
resumeSyncAction->setVisible(false);
//pCloudWin->ui->btnResumeSync->setVisible(false);
}
else
{
pauseSyncAction->setVisible(false);
// pCloudWin->ui->btnPauseSync->setVisible(false);
}
connect(loggedmenu, SIGNAL(aboutToShow()), this, SLOT(refreshTray()));
connect(syncedFldrsMenu, SIGNAL(aboutToShow()),this,SLOT(createSyncFolderActions())); //delete old if exist, adds new
//connect(syncMenu, SIGNAL(aboutToShow()),this,SLOT(createSyncFolderActions())); //fu4ur version
userinfoAction->setEnabled(false);
syncDownldAction->setEnabled(false);
syncUpldAction->setEnabled(false);
}
#ifdef Q_OS_WIM
#define PIPE_NAME L"\\\\.\\pipe\\shellextnpipe2"
void PCloudApp::dbgPipeHlprSLot()
{
HANDLE hPipedbg;
//open & create
hPipedbg = CreateFile(
PIPE_NAME,
GENERIC_WRITE | GENERIC_READ, // read and write access
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
FILE_ATTRIBUTE_NORMAL, // default attributes
NULL);
if (hPipedbg == INVALID_HANDLE_VALUE)
{
if(GetLastError() == ERROR_PIPE_BUSY)
{
if (!WaitNamedPipe(PIPE_NAME, 10000))
{
OutputDebugString(L"Qt dbgpipe: ERR_PIPE_BUSY - Could not open pipe: 10 second wait timed out.");
return;
}
}
}
//write
char buffer[270];
strcpy(buffer, "synclist*P:\\r(1)");
// strcpy(buffer, "addsyncD:\\newwww|");
//strcpy(buffer,"synclist");
//_tcscpy_s()
DWORD size = (strlen(buffer))*sizeof(char);
bool result = WriteFile(
hPipedbg,
buffer, // the data to be sent
(strlen(buffer)+1)*sizeof(char), //length of data to send
&size, //actual amount of sent data
NULL); // not using overlapped IO
FlushFileBuffers(hPipedbg);
if(!result)
qDebug()<<"Qt: dbgpipe write failed "<<GetLastError();
// read
}
#endif
void status_callback(pstatus_t *status)
{
mutex.lock();
quint32 err = psync_get_last_error();
if(err)
qDebug()<<"status callback get last error: "<<err;
// ++ syncing flag
quint32 previousStatus = PCloudApp::appStatic->lastStatus;
switch(status->status)
{
case PSTATUS_READY: //0
qDebug()<<"PSTATUS_READY" << status->downloadstr << status->uploadstr;
if (previousStatus != PSTATUS_READY) //
{
if(PCloudApp::appStatic->isLogedIn())
{
PCloudApp::appStatic->changeSyncIconPublic(1);
if(PCloudApp::appStatic->nointernetFlag)
{
PCloudApp::appStatic->changeOnlineItemsPublic(true);
PCloudApp::appStatic->nointernetFlag = false; //already connected to net
}
}
if(previousStatus == PSTATUS_DOWNLOADING || previousStatus == PSTATUS_DOWNLOADINGANDUPLOADING || previousStatus == PSTATUS_PAUSED)
//PCloudApp::appStatic->downldInfo = QObject::trUtf8("Everything Downloaded");
PCloudApp::appStatic->downldInfo = status->downloadstr;
if(previousStatus == PSTATUS_UPLOADING || previousStatus == PSTATUS_DOWNLOADINGANDUPLOADING || previousStatus == PSTATUS_PAUSED)
//PCloudApp::appStatic->uploadInfo = QObject::tr("Everything Uploaded");
PCloudApp::appStatic->uploadInfo = status->uploadstr;
if (PCloudApp::appStatic->isMenuorWinActive())
PCloudApp::appStatic->updateSyncStatusPublic();
if(PCloudApp::appStatic->noFreeSpaceMsgShownFlag)
PCloudApp::appStatic->noFreeSpaceMsgShownFlag = false;
PCloudApp::appStatic->lastStatus = PSTATUS_READY;
}
break;
case PSTATUS_DOWNLOADING: //1
qDebug()<<"PSTATUS_DOWNLOADING"<<
"bytes downloaded "<<status->bytesdownloaded << "bytestodownload= "<<status->bytestodownload << " current "<<status->bytestodownloadcurrent<< " speed" <<status->downloadspeed
<<"DOWNLOAD files filesdownloading "<<status->filesdownloading<< " filestodownload="<<status->filestodownload<<"is full: "<< status->localisfull<<status->remoteisfull;
if(!PCloudApp::appStatic->isLogedIn())
break;
if(!(previousStatus == PSTATUS_DOWNLOADING || previousStatus == PSTATUS_DOWNLOADINGANDUPLOADING || previousStatus == PSTATUS_UPLOADING))
PCloudApp::appStatic->changeSyncIconPublic(2);
PCloudApp::appStatic->downldInfo = status->downloadstr;
/* move text building to lib
if (PCloudApp::appStatic->isMenuorWinActive() || previousStatus != PSTATUS_DOWNLOADING)
{
if (status->bytestodownload)
{
char files[16];
if (status->filestodownload > 1)
strcpy(files, " files");
else
strcpy(files, " file");
if(status->downloadspeed)// sometimes lib returns 0
{
PCloudApp::appStatic->downldInfo = QObject::trUtf8("Download: ") + QString::number(status->downloadspeed/1000) + " kB/s, " +
PCloudApp::appStatic->timeConvert(status->bytestodownload/status->downloadspeed) + ", " +
PCloudApp::appStatic->bytesConvert(status->bytestodownload - status->bytesdownloaded) + ", " +
QString::number(status->filestodownload) + files;
}
else
PCloudApp::appStatic->downldInfo = QObject::trUtf8("Download: ") + PCloudApp::appStatic->bytesConvert(status->bytestodownload - status->bytesdownloaded) +
", " + QString::number(status->filestodownload) + files;
}
else
PCloudApp::appStatic->downldInfo = QObject::trUtf8("Everything Downloaded");
}
*/
if(previousStatus == PSTATUS_DOWNLOADINGANDUPLOADING || previousStatus == PSTATUS_UPLOADING || previousStatus == PSTATUS_PAUSED) //case when come upload just has finished
PCloudApp::appStatic->uploadInfo = status->uploadstr;
if(PCloudApp::appStatic->isMenuorWinActive() || previousStatus != PSTATUS_DOWNLOADING)
PCloudApp::appStatic->updateSyncStatusPublic();
PCloudApp::appStatic->lastStatus = PSTATUS_DOWNLOADING;
break;
case PSTATUS_UPLOADING: //2
qDebug()<<"PSTATUS_UPLOADING";
if(!PCloudApp::appStatic->isLogedIn())
break;
if(!(previousStatus == PSTATUS_DOWNLOADING || previousStatus == PSTATUS_DOWNLOADINGANDUPLOADING || previousStatus == PSTATUS_UPLOADING))
PCloudApp::appStatic->changeSyncIconPublic(2);
qDebug()<<"UPLOAD bytes bytesuploaded= "<<status->bytesuploaded << " bytestoupload = "<<status->bytestoupload << " current= "<<status->bytestouploadcurrent<<" speed" <<status->uploadspeed
<<"UPLOAD filesuploading= "<<status->filesuploading<< " filestoupload= "<<status->filestoupload<<"is full: "<< status->localisfull<<status->remoteisfull;
PCloudApp::appStatic->uploadInfo = status->uploadstr;
/* string building moved to lib
if (PCloudApp::appStatic->isMenuorWinActive() || previousStatus != PSTATUS_UPLOADING)
{
if (status->bytestoupload)
{
char files[16];
if (status->filestoupload > 1)
strcpy(files, " files");
else
strcpy(files, " file");
if(status->uploadspeed)// sometimes is 0
{
PCloudApp::appStatic->uploadInfo = QObject::trUtf8("Upload: ") + QString::number(status->uploadspeed/1000) + " kB/s, " +
PCloudApp::appStatic->timeConvert(status->bytestoupload/status->uploadspeed) + ", " +
PCloudApp::appStatic->bytesConvert(status->bytestoupload - status->bytesuploaded) + ", " +
QString::number(status->filestoupload) + files;
}
else
PCloudApp::appStatic->uploadInfo = QObject::trUtf8("Upload: ") + PCloudApp::appStatic->bytesConvert(status->bytestoupload - status->bytesuploaded) + ", " +
QString::number(status->filestoupload) + files;
}
else
PCloudApp::appStatic->uploadInfo = QObject::trUtf8("Everything Uploaded");
//case when download just has finished
if(previousStatus == PSTATUS_DOWNLOADINGANDUPLOADING || previousStatus == PSTATUS_DOWNLOADING)
PCloudApp::appStatic->downldInfo = status->downloadstr;
PCloudApp::appStatic->updateSyncStatusPublic();
}
*/
//case when download just has finished
if(previousStatus == PSTATUS_DOWNLOADINGANDUPLOADING || previousStatus == PSTATUS_DOWNLOADING || previousStatus == PSTATUS_PAUSED)
PCloudApp::appStatic->downldInfo = status->downloadstr;
if(PCloudApp::appStatic->isMenuorWinActive() || previousStatus != PSTATUS_UPLOADING)
PCloudApp::appStatic->updateSyncStatusPublic();
PCloudApp::appStatic->lastStatus = PSTATUS_UPLOADING;
break;
case PSTATUS_DOWNLOADINGANDUPLOADING: //3
qDebug()<<"PSTATUS_DOWNLOADINGANDUPLOADING";
if(!PCloudApp::appStatic->isLogedIn())
break;
if(!(previousStatus == PSTATUS_DOWNLOADING || previousStatus == PSTATUS_DOWNLOADINGANDUPLOADING
|| previousStatus == PSTATUS_UPLOADING))
PCloudApp::appStatic->changeSyncIconPublic(2);
qDebug()<<"DOWNLOAD bytes downlaoded "<<status->bytesdownloaded << "bytestodownload= "<<status->bytestodownload << " current "<<status->bytestodownloadcurrent<< " speed" <<status->downloadspeed
<<"DOWNLOAD files filesdownloading "<<status->filesdownloading<< " filestodownload="<<status->filestodownload<<"is full: "<< status->localisfull<<status->remoteisfull;
qDebug()<<"UPLOAD bytes bytesuploaded= "<<status->bytesuploaded << " bytestoupload = "<<status->bytestoupload << " current= "<<status->bytestouploadcurrent<<" speed" <<status->uploadspeed
<<"UPLOAD filesuploading= "<<status->filesuploading<< " filestoupload= "<<status->filestoupload;
PCloudApp::appStatic->downldInfo = status->downloadstr;
PCloudApp::appStatic->uploadInfo= status->uploadstr;
if (PCloudApp::appStatic->isMenuorWinActive() || previousStatus != PSTATUS_DOWNLOADINGANDUPLOADING)
PCloudApp::appStatic->updateSyncStatusPublic();
/*
if (PCloudApp::appStatic->isMenuorWinActive() || previousStatus != PSTATUS_DOWNLOADINGANDUPLOADING)
{
if(status->bytestodownload)
{
char filesdwnld[16];
if (status->filestodownload > 1)
strcpy(filesdwnld, " files");
else
strcpy(filesdwnld, " file");
if(status->downloadspeed)// sometimes is 0
{
PCloudApp::appStatic->downldInfo = QObject::trUtf8("Download: ") + QString::number(status->downloadspeed/1000) + " kB/s, " +
PCloudApp::appStatic->timeConvert(status->bytestodownload/status->downloadspeed) + ", " +
PCloudApp::appStatic->bytesConvert(status->bytestodownload - status->bytesdownloaded) + ", " +
QString::number(status->filestodownload) + filesdwnld;
}
else
PCloudApp::appStatic->downldInfo = QObject::trUtf8("Download: ") + PCloudApp::appStatic->bytesConvert(status->bytestodownload - status->bytesdownloaded) + ", " +
QString::number(status->filestodownload) + filesdwnld;
}
else
PCloudApp::appStatic->downldInfo = QObject::trUtf8("Everything Downloaded");
if(status->bytestoupload)
{
char filesupld[16];
if (status->filestoupload > 1)
strcpy(filesupld, " files");
else
strcpy(filesupld, " file");
if(status->uploadspeed)// sometimes is 0
{
PCloudApp::appStatic->uploadInfo = QObject::trUtf8("Upload: ") + QString::number(status->uploadspeed/1000) + " kB/s, " +
PCloudApp::appStatic->timeConvert(status->bytestoupload/status->uploadspeed) + ", " +
PCloudApp::appStatic->bytesConvert(status->bytestoupload - status->bytesuploaded) + ", " +
QString::number(status->filestoupload) + filesupld;
}
else
PCloudApp::appStatic->uploadInfo = QObject::trUtf8("Upload: ") + PCloudApp::appStatic->bytesConvert(status->bytestoupload - status->bytesuploaded) +", " +
QString::number(status->filestoupload) + filesupld;
}
else
PCloudApp::appStatic->uploadInfo = QObject::trUtf8("Everything Uploaded");
PCloudApp::appStatic->updateSyncStatusPublic();
}
*/
PCloudApp::appStatic->lastStatus = PSTATUS_DOWNLOADINGANDUPLOADING;
break;
case PSTATUS_LOGIN_REQUIRED: //4
qDebug()<<"PSTATUS_LOGIN_REQUIRED";
if(PCloudApp::appStatic->isLogedIn() && previousStatus != PSTATUS_LOGIN_REQUIRED)
PCloudApp::appStatic->logoutPublic();
PCloudApp::appStatic->lastStatus = PSTATUS_LOGIN_REQUIRED;
break;
case PSTATUS_BAD_LOGIN_DATA: //5
qDebug()<<"PSTATUS_BAD_LOGIN_DATA";
if(previousStatus != PSTATUS_BAD_LOGIN_DATA && PCloudApp::appStatic->isLogedIn())
PCloudApp::appStatic->logoutPublic();
PCloudApp::appStatic->lastStatus = PSTATUS_BAD_LOGIN_DATA;
break;
case PSTATUS_BAD_LOGIN_TOKEN: //6
qDebug()<<"PSTATUS_BAD_LOGIN_TOKEN";
if(previousStatus != PSTATUS_BAD_LOGIN_TOKEN)
{
if (PCloudApp::appStatic->isLogedIn())
PCloudApp::appStatic->logoutPublic();
PCloudApp::appStatic->lastStatus = PSTATUS_BAD_LOGIN_TOKEN;
PCloudApp::appStatic->showMsgBoxPublic("Session expired", "Your session has expired. Please login again.", QMessageBox::Critical);
}
break;
case PSTATUS_ACCOUNT_FULL: //7
qDebug()<<"PSTATUS_ACCOUNT_FULL";
if(previousStatus != PSTATUS_ACCOUNT_FULL)
{
PCloudApp::appStatic->lastStatus = PSTATUS_ACCOUNT_FULL;
PCloudApp::appStatic->changeSyncIconPublic(4);
}
break;
case PSTATUS_DISK_FULL:
qDebug()<<"PSTATUS_DISK_FULL";
if(previousStatus != PSTATUS_DISK_FULL)
{
PCloudApp::appStatic->lastStatus = PSTATUS_DISK_FULL;
PCloudApp::appStatic->changeSyncIconPublic(4);
if (PCloudApp::appStatic->isLogedIn())
PCloudApp::appStatic->changeOnlineItems(true);
}
break;
case PSTATUS_PAUSED:
qDebug()<<"PSTATUS_PAUSED";
if (PCloudApp::appStatic->isLogedIn() && previousStatus != PSTATUS_PAUSED)
PCloudApp::appStatic->changeSyncIconPublic(3);
PCloudApp::appStatic->downldInfo = status->downloadstr;
PCloudApp::appStatic->uploadInfo = status->uploadstr;
PCloudApp::appStatic->lastStatus = PSTATUS_PAUSED;
//update menu -> start sync for initial login
break;
case PSTATUS_STOPPED:
qDebug()<<"PSTATUS_STOPPED";
PCloudApp::appStatic->changeSyncIconPublic(0);
PCloudApp::appStatic->lastStatus = PSTATUS_STOPPED;
break;
case PSTATUS_OFFLINE:
qDebug()<<"PSTATUS_OFFLINE";
if(previousStatus != PSTATUS_OFFLINE)
{
PCloudApp::appStatic->changeSyncIconPublic(0);
//PCloudApp::appStatic->changeOnlineItemsPublic(false);
PCloudApp::appStatic->nointernetFlag = true;
PCloudApp::appStatic->lastStatus = PSTATUS_OFFLINE;
}
break;
case PSTATUS_CONNECTING:
qDebug()<<"PSTATUS_CONNECTING";
PCloudApp::appStatic->lastStatus = PSTATUS_CONNECTING;
break;
case PSTATUS_SCANNING:
qDebug()<<" PSTATUS_SCANNING";
PCloudApp::appStatic->lastStatus = PSTATUS_SCANNING;
break;
case PSTATUS_USER_MISMATCH:
//case when set wrong user
qDebug()<<"PSTATUS_USER_MISMATCH";
PCloudApp::appStatic->lastStatus = PSTATUS_USER_MISMATCH;
break;
default:
break;
}
mutex.unlock();
}
static void event_callback(psync_eventtype_t event, psync_eventdata_t data)
{
mutex.lock();
qDebug()<<"Event callback" << event;
if(PCloudApp::appStatic->noEventCallbackFlag)
{
PCloudApp::appStatic->noEventCallbackFlag = false;
return;
}
char title[128], msg[512];
switch(event)
{
case PEVENT_LOCAL_FOLDER_CREATED:
qDebug() << "PEVENT_LOCAL_FOLDER_CREATED";
break;
case PEVENT_REMOTE_FOLDER_CREATED:
qDebug()<<"PEVENT_REMOTE_FOLDER_CREATED";
break;
case PEVENT_FILE_DOWNLOAD_STARTED:
qDebug()<<"PEVENT_FILE_DOWNLOAD_STARTED";
break;
case PEVENT_FILE_DOWNLOAD_FINISHED:
qDebug()<<"PEVENT_FILE_DOWNLOAD_FINISHED";
break;
case PEVENT_FILE_DOWNLOAD_FAILED:
qDebug()<<"PEVENT_FILE_DOWNLOAD_FAILED";
break;
case PEVENT_FILE_UPLOAD_STARTED:
qDebug()<<"PEVENT_FILE_UPLOAD_STARTED";
break;
case PEVENT_FILE_UPLOAD_FINISHED:
qDebug()<<"PEVENT_FILE_UPLOAD_FINISHED";
break;
case PEVENT_FILE_UPLOAD_FAILED:
qDebug()<<"PEVENT_FILE_UPLOAD_FAILED";
break;
case PEVENT_LOCAL_FOLDER_DELETED:
qDebug()<<"PEVENT_LOCAL_FOLDER_DELETED";
break;
case PEVENT_REMOTE_FOLDER_DELETED:
qDebug()<<"PEVENT_REMOTE_FOLDER_DELETED";
break;
case PEVENT_LOCAL_FILE_DELETED:
qDebug()<<"PEVENT_LOCAL_FILE_DELETED";
break;
case PEVENT_REMOTE_FILE_DELETED:
qDebug()<<"PEVENT_REMOTE_FILE_DELETED";
break;
case PEVENT_LOCAL_FOLDER_RENAMED:
qDebug()<<"PEVENT_LOCAL_FOLDER_RENAMED";
break;
case PEVENT_USERINFO_CHANGED:
qDebug()<<"PEVENT_USERINFO_CHANGED";
if (PCloudApp::appStatic->isLogedIn())
PCloudApp::appStatic->updateUserInfoPublic("userinfo");
break;
case PEVENT_USEDQUOTA_CHANGED:
qDebug()<<"PEVENT_USEDQUOTA_CHANGED";
if (PCloudApp::appStatic->isLogedIn())
PCloudApp::appStatic->updateUserInfoPublic("quota");
break;
case PEVENT_SHARE_REQUESTIN:
qDebug()<<"PEVENT_SHARE_REQUESTIN"; // someone else shares me a folder, can be added from web
/* moved in notifications win
strcpy(title, "New Share Request Received!");
strcpy(msg,"You received a new Share Request from \"");
strcat(msg, data.share->email);
strcat(msg,"\"");
PCloudApp::appStatic->sendTrayMsgTypePublic(title,msg,1);
*/
if(PCloudApp::appStatic->isMainWinPageActive(SHARES_PAGE_NUM)) //if shraes page is visible
PCloudApp::appStatic->pCloudWin->refreshPagePulbic(SHARES_PAGE_NUM,1);
break;