kitsas: 3.0 → 3.1.1, enable on darwin

This commit is contained in:
Nikolay Korotkiy 2021-11-19 13:37:32 +03:00
parent 03a46c8b3d
commit d49cad9bad
No known key found for this signature in database
GPG Key ID: D1DE6D7F693663A5
2 changed files with 44 additions and 25 deletions

View File

@ -1,44 +1,39 @@
{ lib, mkDerivation, fetchFromGitHub, qmake, qtsvg, qtcreator, poppler, libzip, pkg-config }:
{ lib, stdenv, fetchFromGitHub, qmake, qtbase, qtsvg, poppler, libzip, pkg-config, wrapQtAppsHook }:
mkDerivation rec {
stdenv.mkDerivation rec {
pname = "kitsas";
version = "3.0";
version = "3.1.1";
src = fetchFromGitHub {
owner = "artoh";
repo = "kitupiikki";
rev = "v${version}";
sha256 = "sha256-UH2bFJZd83APRjlv6JR+Uy+ng4DWnnLmavAgjgSOiRo=";
sha256 = "sha256-nmlGLrVsTQawYHNgaax9EiutL4xgFdOD34Q4/rnB/D0=";
};
nativeBuildInputs = [ pkg-config ];
# QList::swapItemsAt was introduced in Qt 5.13
patches = lib.optional (lib.versionOlder qtbase.version "5.13") ./qt-512.patch;
buildInputs = [ qmake qtsvg poppler libzip ];
nativeBuildInputs = [ pkg-config qmake wrapQtAppsHook ];
buildInputs = [ qtsvg poppler libzip ];
# We use a separate build-dir as otherwise ld seems to get confused between
# directory and executable name on buildPhase.
preConfigure = ''
mkdir build-linux
cd build-linux
mkdir build && cd build
'';
qmakeFlags = [
"../kitsas/kitsas.pro"
"-spec"
"linux-g++"
"CONFIG+=release"
];
qmakeFlags = [ "../kitsas/kitsas.pro" ];
preFixup = ''
make clean
rm Makefile
'';
installPhase = ''
mkdir -p $out/bin $out/share/applications
cp kitsas $out/bin
cp $src/kitsas.png $out/share/applications
cp $src/kitsas.desktop $out/share/applications
installPhase = if stdenv.isDarwin then ''
mkdir -p $out/Applications
mv kitsas.app $out/Applications
'' else ''
install -Dm755 kitsas -t $out/bin
install -Dm644 ../kitsas.svg -t $out/share/icons/hicolor/scalable/apps
install -Dm644 ../kitsas.png -t $out/share/icons/hicolor/256x256/apps
install -Dm644 ../kitsas.desktop -t $out/share/applications
'';
meta = with lib; {
@ -46,6 +41,6 @@ mkDerivation rec {
description = "An accounting tool suitable for Finnish associations and small business";
maintainers = with maintainers; [ gspia ];
license = licenses.gpl3Plus;
platforms = platforms.linux;
platforms = platforms.unix;
};
}

View File

@ -0,0 +1,24 @@
diff --git i/kitsas/apuri/siirtoapuri.cpp w/kitsas/apuri/siirtoapuri.cpp
index 9a2c51f3..9565200f 100644
--- i/kitsas/apuri/siirtoapuri.cpp
+++ w/kitsas/apuri/siirtoapuri.cpp
@@ -25,6 +25,7 @@
#include "db/tositetyyppimodel.h"
#include "tiliote/tiliotekirjaaja.h"
+#include <QtAlgorithms>
#include <QDebug>
SiirtoApuri::SiirtoApuri(QWidget *parent, Tosite *tosite) :
@@ -361,8 +362,9 @@ void SiirtoApuri::laskunmaksu()
TositeVienti eka = lista.at(0).toMap();
tosite()->asetaPvm(eka.pvm());
tosite()->asetaOtsikko( eka.selite() );
- if( eka.kreditEuro() )
- lista.swapItemsAt(0,1);
+ if( eka.kreditEuro() ) {
+ qSwap(lista.begin()[0], lista.begin()[1]);
+ }
tosite()->viennit()->asetaViennit(lista);
reset();