Tatsh / kate-wakatime

Kate plugin to interface with WakaTime
https://tatsh.github.io/kate-wakatime/
11 stars 9 forks source link

Support for api_url #17

Closed Mte90 closed 3 years ago

Mte90 commented 3 years ago

Added support for a new parameter api_url for other wakatime host replacements.

Mte90 commented 3 years ago

This looks good. Could you rebase/squash this into a single commit?

I am trying to understand why I am getting a 401 if I use https://wakapi.dev/ and not with the official service. Also I am not sure how to get debug info as I am not so skilled with C++ and Qt network APIs.

Mte90 commented 3 years ago

So I updated the code also for Qt 5.15 to avoid some deprecation errors. There is one that I don't know how to fix:

/home/mte90/Desktop/kde/kate-wakatime/wakatimeplugin.cpp: In member function ‘void WakaTimeView::sendQueuedHeartbeats()’:
/home/mte90/Desktop/kde/kate-wakatime/wakatimeplugin.cpp:384:32: warning: ‘QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccessible() const’ is deprecated [-Wdeprecated-declarations]
  384 |     if (nam->networkAccessible() != QNetworkAccessManager::Accessible) {
      |                                ^
In file included from /usr/include/x86_64-linux-gnu/qt5/QtNetwork/QNetworkAccessManager:1,
                 from /home/mte90/Desktop/kde/kate-wakatime/wakatimeplugin.cpp:46:
/usr/include/x86_64-linux-gnu/qt5/QtNetwork/qnetworkaccessmanager.h:160:53: note: declared here
  160 |     QT_DEPRECATED_VERSION_5_15 NetworkAccessibility networkAccessible() const;

About merge in a single commit you can do in Github the squash to a single commit when you press the green button on the arrow.

Tatsh commented 3 years ago

Are you going to push more or do you want me to try this locally? I want to see about removing the changes in CMakeLists.txt and the deprecation issue with QNetworkAccess.

That part is just a warning. It seems Qt project does not want those functions to be used anymore. So I guess a replacement to check if we are offline needs to be put in. In particular, probably just want to check if apiUrlPath can be used at all. If it fails a pre-flight then assume we are offline. If you want to implement this, please do so.

Mte90 commented 3 years ago

I finished working on that PR :-)

Mte90 commented 3 years ago

Thanks!