Il motore dentro l'app: cartelle e messaggi veri (0.2.0)
- src/enginebridge.h/.cpp: ponte QObject fra le callback del motore e la QML (cartelle, messaggi, corpo, segna letto, sposta in Trash) - src/enginecallbacks.cpp: gd_run/gd_single_instance/gd_already_open, con visibility default (la build usa -fvisibility=hidden) - src/main.cpp: avvia gd_engine_run, il loop lo comincia il motore - QML: liste lette dal motore, niente piu' dati finti; via i comandi morti - engine/prebuilt: libgrumpydove.so + 31 librerie assenti su Sailfish, generate da packaging/bundle_libs.py (che scrive files.pri per qmake)
This commit is contained in:
1 parent
4dc2f367eb
commit
b99a7ae41f
47 files changed
+698
-132
No files matched your search
@@ -37,6 +37,23 @@ senza rimpianti se il disegno non funziona.
|
|||||||
- **Compose** — A, Oggetto, Testo; l'invio è finto e conferma a schermo.
|
- **Compose** — A, Oggetto, Testo; l'invio è finto e conferma a schermo.
|
||||||
- **Copertina** — non letti totali.
|
- **Copertina** — non letti totali.
|
||||||
|
|
||||||
|
## Il motore dentro l'app
|
||||||
|
|
||||||
|
Dalle 0.2.0 le schermate leggono la posta vera: il motore di GrumpyDove
|
||||||
|
(l'originale Ada + C) è compilato per aarch64 e collegato all'app.
|
||||||
|
|
||||||
|
- `engine/engine_entry.ad[s]` — il main dell'originale esportato come
|
||||||
|
`gd_engine_run`; `engine/build_lib.sh` produce `libgrumpydove.so`.
|
||||||
|
- `src/enginebridge.*` — il ponte: riceve le callback del motore (le stesse di
|
||||||
|
`qt_shim.h`) e le espone alla QML come elenchi; `src/enginecallbacks.cpp`
|
||||||
|
fornisce `gd_run`, `gd_single_instance`, `gd_already_open`.
|
||||||
|
- `engine/prebuilt/` — la libreria del motore e le 31 librerie che Sailfish non
|
||||||
|
ha (libetpan, jansson, gnutls, curl, runtime Ada…). Si rigenerano con
|
||||||
|
`python3 packaging/bundle_libs.py`, che riscrive anche `files.pri` (l'elenco
|
||||||
|
esplicito per qmake: un glob verrebbe espanso quando i file non ci sono
|
||||||
|
ancora). Sono nel pacchetto sotto `/usr/share/harbour-grumpydove/lib`, dove
|
||||||
|
punta l'rpath del binario.
|
||||||
|
|
||||||
## Costruire e installare
|
## Costruire e installare
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/* The whole of what Ada sees of Qt. */
|
||||||
|
#ifndef QT_SHIM_H
|
||||||
|
#define QT_SHIM_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Folders, rows and columns count from 0. A text callback writes at most cap
|
||||||
|
bytes of UTF-8 into buf, with no terminator, and returns how many. */
|
||||||
|
typedef int (*gd_folder_fn)(int index, int *depth, char *buf, int cap);
|
||||||
|
typedef int (*gd_open_fn)(int folder, long *total_k);
|
||||||
|
typedef int (*gd_cell_fn)(int folder, int row, int column, char *buf, int cap);
|
||||||
|
typedef int (*gd_body_fn)(int folder, int row, char *buf, int cap);
|
||||||
|
typedef void (*gd_sort_fn)(int folder, int column, int descending);
|
||||||
|
typedef void (*gd_read_fn)(int folder, int row, int read);
|
||||||
|
typedef int (*gd_move_fn)(int folder, int id, int target);
|
||||||
|
typedef void (*gd_commit_fn)(int folder);
|
||||||
|
typedef int (*gd_empty_fn)(int folder);
|
||||||
|
typedef void (*gd_log_fn)(const char *line);
|
||||||
|
typedef void (*gd_set_fn)(int folder, int row, int value);
|
||||||
|
typedef int (*gd_text_fn)(int folder, int id, char *buf, int cap);
|
||||||
|
typedef int (*gd_header_fn)(int folder, int id, const char *name, char *buf,
|
||||||
|
int cap);
|
||||||
|
typedef int (*gd_filter_fn)(int folder, int id, const char *rules, int len,
|
||||||
|
int *destination, int *read, int *priority,
|
||||||
|
int *label);
|
||||||
|
typedef int (*gd_last_id_fn)(int folder);
|
||||||
|
typedef int (*gd_compose_fn)(int out_box, const char *sheet, int len,
|
||||||
|
const char *html, int html_len, int queue,
|
||||||
|
int encrypt, int sign, int kind, int origin_folder,
|
||||||
|
int origin_id, int draft, char *status, int cap);
|
||||||
|
typedef int (*gd_id_of_fn)(int folder, int row);
|
||||||
|
typedef int (*gd_row_of_fn)(int folder, int id);
|
||||||
|
typedef void (*gd_find_start_fn)(const char *query, int len);
|
||||||
|
typedef int (*gd_find_poll_fn)(char *buf, int cap, int *running);
|
||||||
|
typedef void (*gd_find_cancel_fn)(void);
|
||||||
|
typedef int (*gd_id_named_fn)(int folder, const char *name, int len);
|
||||||
|
typedef int (*gd_absorb_fn)(int folder);
|
||||||
|
typedef int (*gd_rescan_fn)(void);
|
||||||
|
typedef int (*gd_queue_sent_fn)(int folder, int id, const char *persona, int len);
|
||||||
|
typedef int (*gd_place_fn)(int folder, char *buf, int cap);
|
||||||
|
typedef int (*gd_can_hold_fn)(int folder);
|
||||||
|
typedef int (*gd_make_folder_fn)(int parent, const char *name, int length,
|
||||||
|
int mailbox);
|
||||||
|
typedef int (*gd_shown_at_fn)(int position);
|
||||||
|
typedef int (*gd_claim_fn)(int folder, char *buf, int cap);
|
||||||
|
typedef void (*gd_send_done_fn)(int folder, int id, int sent);
|
||||||
|
typedef void (*gd_send_start_fn)(const char *config, int config_len,
|
||||||
|
const char *items, int items_len);
|
||||||
|
|
||||||
|
/* Runs the interface until its window closes; 0 on a clean exit. */
|
||||||
|
int gd_single_instance(void);
|
||||||
|
void gd_already_open(void);
|
||||||
|
int gd_run(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell,
|
||||||
|
gd_body_fn body, gd_sort_fn sort, gd_read_fn mark_read,
|
||||||
|
gd_id_of_fn id_of, gd_row_of_fn row_of, gd_move_fn move,
|
||||||
|
gd_commit_fn commit, gd_empty_fn empty, gd_log_fn log,
|
||||||
|
gd_set_fn priority, gd_set_fn label, gd_text_fn decrypt,
|
||||||
|
gd_text_fn sender, gd_text_fn key_of, gd_header_fn header,
|
||||||
|
gd_text_fn plain, gd_text_fn sheet, gd_compose_fn compose,
|
||||||
|
gd_filter_fn filter, gd_last_id_fn last_id,
|
||||||
|
gd_find_start_fn find_start, gd_find_poll_fn find_poll,
|
||||||
|
gd_find_cancel_fn find_cancel, gd_id_named_fn id_named,
|
||||||
|
gd_claim_fn claim, gd_send_done_fn send_done,
|
||||||
|
gd_send_start_fn send_start, gd_find_poll_fn send_poll,
|
||||||
|
gd_find_start_fn imap_start, gd_find_poll_fn imap_poll,
|
||||||
|
gd_absorb_fn absorb, gd_rescan_fn rescan, gd_shown_at_fn shown_at,
|
||||||
|
gd_can_hold_fn can_hold, gd_make_folder_fn make_folder,
|
||||||
|
gd_can_hold_fn can_change, gd_make_folder_fn change_folder,
|
||||||
|
gd_can_hold_fn forget, gd_can_hold_fn has_box,
|
||||||
|
gd_place_fn place, gd_find_start_fn imap_create,
|
||||||
|
gd_find_start_fn book_start, gd_find_poll_fn book_poll,
|
||||||
|
gd_place_fn book_list, gd_queue_sent_fn queue_sent, gd_text_fn html,
|
||||||
|
gd_text_fn images, gd_text_fn attachments, gd_text_fn path,
|
||||||
|
gd_can_hold_fn unread);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# generato da packaging/bundle_libs.py
|
||||||
|
motorlib.path = /usr/share/harbour-grumpydove/lib
|
||||||
|
motorlib.files = \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libbrotlicommon.so.1 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libbrotlidec.so.1 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libcrypto.so.3 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libcurl-gnutls.so.4 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libdb-5.3.so \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libetpan.so.20 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libffi.so.8 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libgmp.so.10 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libgnarl-12.so \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libgnat-12.so \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libgnutls.so.30 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libgrumpydove.so \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libgssapi_krb5.so.2 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libhogweed.so.6 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libidn2.so.0 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libjansson.so.4 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libk5crypto.so.3 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libkrb5.so.3 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libkrb5support.so.0 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/liblber-2.5.so.0 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libldap-2.5.so.0 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/liblockfile.so.1 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libnettle.so.8 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libnghttp2.so.14 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libp11-kit.so.0 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libpsl.so.5 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/librtmp.so.1 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libsasl2.so.2 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libssh2.so.1 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libtasn1.so.6 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libunistring.so.2 \
|
||||||
|
$$_PRO_FILE_PWD_/engine/prebuilt/libzstd.so.1
|
||||||
|
INSTALLS += motorlib
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
-5
@@ -67,14 +67,20 @@ int gd_run(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell,
|
|||||||
|
|
||||||
total_k = 0;
|
total_k = 0;
|
||||||
if (open(i, &total_k) == 0 || total_k == 0) continue;
|
if (open(i, &total_k) == 0 || total_k == 0) continue;
|
||||||
len = cell(i, 0, 4, buf, (int)sizeof buf - 1); /* colonna 4 = mittente */
|
printf(" cartella %d (%ld KB):\n", i, total_k);
|
||||||
if (len > 0) {
|
for (int r = 0; r < 4; r++) {
|
||||||
|
printf(" riga %d:", r);
|
||||||
|
for (int c = 0; c < 9; c++) {
|
||||||
|
if (c != 0 && c != 2 && c != 4 && c != 7 && c != 8) continue;
|
||||||
|
len = cell(i, r, c, buf, (int)sizeof buf - 1);
|
||||||
|
if (len <= 0) { printf(" [%d]''", c); continue; }
|
||||||
if (len > (int)sizeof buf - 1) len = (int)sizeof buf - 1;
|
if (len > (int)sizeof buf - 1) len = (int)sizeof buf - 1;
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
messages_seen++;
|
printf(" [%d]%s", c, buf);
|
||||||
if (first_who[0] == '\0') {
|
if (c == 4 && r >= 0) { messages_seen++; if (first_who[0] == '\0')
|
||||||
strncpy(first_who, buf, sizeof first_who - 1);
|
strncpy(first_who, buf, sizeof first_who - 1); }
|
||||||
}
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("messaggi con mittente letto: %d (primo: %s)\n",
|
printf("messaggi con mittente letto: %d (primo: %s)\n",
|
||||||
|
|||||||
+24
-1
@@ -7,7 +7,24 @@ CONFIG += c++11
|
|||||||
# Icone dell'originale compilate nel binario: source QML "qrc:/images/..."
|
# Icone dell'originale compilate nel binario: source QML "qrc:/images/..."
|
||||||
RESOURCES += images.qrc
|
RESOURCES += images.qrc
|
||||||
|
|
||||||
SOURCES += src/main.cpp
|
# Ponte verso il motore di GrumpyDove: libgrumpydove.so e' compilata a parte
|
||||||
|
# per aarch64 (engine/build_lib.sh) e viaggia nel pacchetto con le librerie
|
||||||
|
# che Sailfish non ha (libetpan, jansson, runtime Ada).
|
||||||
|
INCLUDEPATH += $$PWD/engine/include
|
||||||
|
LIBS += -L$$PWD/engine/prebuilt -l:libgrumpydove.so
|
||||||
|
# le dipendenze della libreria non sono nel target di build: si risolvono a
|
||||||
|
# runtime, sul telefono
|
||||||
|
QMAKE_LFLAGS += -Wl,--allow-shlib-undefined
|
||||||
|
# dove finira' la libreria nel pacchetto
|
||||||
|
QMAKE_LFLAGS += -Wl,-rpath,/usr/share/harbour-grumpydove/lib
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
src/main.cpp \
|
||||||
|
src/enginebridge.cpp \
|
||||||
|
src/enginecallbacks.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
src/enginebridge.h
|
||||||
|
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
qml/harbour-grumpydove.qml \
|
qml/harbour-grumpydove.qml \
|
||||||
@@ -15,6 +32,7 @@ OTHER_FILES += \
|
|||||||
qml/cover/*.qml \
|
qml/cover/*.qml \
|
||||||
qml/js/*.js \
|
qml/js/*.js \
|
||||||
qml/images/*.png \
|
qml/images/*.png \
|
||||||
|
engine/include/qt_shim.h \
|
||||||
rpm/harbour-grumpydove.spec \
|
rpm/harbour-grumpydove.spec \
|
||||||
rpm/harbour-grumpydove.desktop
|
rpm/harbour-grumpydove.desktop
|
||||||
|
|
||||||
@@ -29,3 +47,8 @@ icons128.files = $$PWD/icons/128x128/harbour-grumpydove.png
|
|||||||
icons172.path = /usr/share/icons/hicolor/172x172/apps
|
icons172.path = /usr/share/icons/hicolor/172x172/apps
|
||||||
icons172.files = $$PWD/icons/172x172/harbour-grumpydove.png
|
icons172.files = $$PWD/icons/172x172/harbour-grumpydove.png
|
||||||
INSTALLS += icons86 icons108 icons128 icons172
|
INSTALLS += icons86 icons108 icons128 icons172
|
||||||
|
|
||||||
|
# Il motore e le librerie che Sailfish non ha: elenco esplicito generato da
|
||||||
|
# packaging/bundle_libs.py (un glob verrebbe espanso quando i file non ci
|
||||||
|
# sono ancora). Il file si rigenera dopo ogni bundling.
|
||||||
|
include(engine/prebuilt/files.pri)
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Copia in engine/prebuilt le librerie che Sailfish non ha.
|
||||||
|
|
||||||
|
Parte dalle NEEDED di libgrumpydove.so, segue le dipendenze e copia dal sysroot
|
||||||
|
tutto cio' che non e' gia' sul telefono (whitelist), mantenendo i nomi SONAME
|
||||||
|
con i symlink. Il .pro installa engine/prebuilt/ in
|
||||||
|
/usr/share/harbour-grumpydove/lib, dove punta l'rpath del binario.
|
||||||
|
|
||||||
|
Uso: bundle_libs.py [sysroot]
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
PREBUILT = os.path.join(ROOT, "engine", "prebuilt")
|
||||||
|
LIB = os.path.join(PREBUILT, "libgrumpydove.so")
|
||||||
|
SYSROOT = sys.argv[1] if len(sys.argv) > 1 else os.path.join(
|
||||||
|
ROOT, "spike", "work", "sysroot")
|
||||||
|
SYSLIB = os.path.join(SYSROOT, "usr", "lib", "aarch64-linux-gnu")
|
||||||
|
|
||||||
|
# gia' presenti sul telefono (verificato con ls su Sailfish 5.2)
|
||||||
|
PRESENT = {
|
||||||
|
"libc.so.6", "libm.so.6", "libpthread.so.0", "libdl.so.2", "librt.so.1",
|
||||||
|
"libresolv.so.2", "libutil.so.1", "libanl.so.1", "libmvec.so.1",
|
||||||
|
"libstdc++.so.6", "libgcc_s.so.1", "libxml2.so.2", "libgpgme.so.11",
|
||||||
|
"libz.so.1", "libcom_err.so.2", "libkeyutils.so.1", "libcrypto.so.3",
|
||||||
|
"ld-linux-aarch64.so.1",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def needed(path):
|
||||||
|
out = subprocess.run(["aarch64-linux-gnu-readelf", "-d", path],
|
||||||
|
capture_output=True, text=True).stdout
|
||||||
|
return re.findall(r"NEEDED\).*\[([^\]]+)\]", out)
|
||||||
|
|
||||||
|
|
||||||
|
def soname(path):
|
||||||
|
out = subprocess.run(["aarch64-linux-gnu-readelf", "-d", path],
|
||||||
|
capture_output=True, text=True).stdout
|
||||||
|
m = re.search(r"SONAME\).*\[([^\]]+)\]", out)
|
||||||
|
return m.group(1) if m else None
|
||||||
|
|
||||||
|
|
||||||
|
def resolve(name, extra_dirs):
|
||||||
|
for d in [SYSLIB] + extra_dirs:
|
||||||
|
p = os.path.join(d, name)
|
||||||
|
if os.path.exists(p):
|
||||||
|
return os.path.realpath(p)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
os.makedirs(PREBUILT, exist_ok=True)
|
||||||
|
queue = needed(LIB)
|
||||||
|
done, missing, copied = set(), set(), []
|
||||||
|
while queue:
|
||||||
|
name = queue.pop()
|
||||||
|
if name in done:
|
||||||
|
continue
|
||||||
|
done.add(name)
|
||||||
|
if name in PRESENT:
|
||||||
|
continue
|
||||||
|
src = resolve(name, [PREBUILT])
|
||||||
|
if not src:
|
||||||
|
missing.add(name)
|
||||||
|
continue
|
||||||
|
dst = os.path.join(PREBUILT, name)
|
||||||
|
if not os.path.exists(dst):
|
||||||
|
shutil.copy2(src, dst)
|
||||||
|
copied.append(name)
|
||||||
|
queue.extend(needed(src))
|
||||||
|
|
||||||
|
print("copiate: %d" % len(copied))
|
||||||
|
for c in sorted(copied):
|
||||||
|
print(" " + c)
|
||||||
|
if missing:
|
||||||
|
print("non trovate nel sysroot (da verificare): %s" % ", ".join(sorted(missing)))
|
||||||
|
|
||||||
|
# Lista esplicita per qmake: un glob verrebbe espanso quando i file non
|
||||||
|
# ci sono ancora (e ha gia' prodotto pacchetti con 4 librerie su 30).
|
||||||
|
libs = sorted(f for f in os.listdir(PREBUILT) if f.endswith(".so")
|
||||||
|
or ".so." in f)
|
||||||
|
pri = os.path.join(PREBUILT, "files.pri")
|
||||||
|
with open(pri, "w") as fh:
|
||||||
|
fh.write("# generato da packaging/bundle_libs.py\n")
|
||||||
|
fh.write("motorlib.path = /usr/share/harbour-grumpydove/lib\n")
|
||||||
|
fh.write("motorlib.files = \\\n")
|
||||||
|
for i, name in enumerate(libs):
|
||||||
|
sep = " \\\n" if i < len(libs) - 1 else ""
|
||||||
|
# _PRO_FILE_PWD_, non PWD: in un file incluso PWD e' la cartella
|
||||||
|
# del .pri, e i percorsi finirebbero in prebuilt/prebuilt/...
|
||||||
|
fh.write(" $$_PRO_FILE_PWD_/engine/prebuilt/%s%s" % (name, sep))
|
||||||
|
fh.write("\nINSTALLS += motorlib\n")
|
||||||
|
print("scritto %s con %d librerie" % (pri, len(libs)))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
import "../js/dati.js" as Dati
|
|
||||||
|
|
||||||
CoverBackground {
|
CoverBackground {
|
||||||
Column {
|
Column {
|
||||||
@@ -15,8 +14,8 @@ CoverBackground {
|
|||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
text: Dati.totalUnread() > 0
|
text: engine.totalUnread() > 0
|
||||||
? qsTr("%1 non letti").arg(Dati.totalUnread())
|
? qsTr("%1 non letti").arg(engine.totalUnread())
|
||||||
: qsTr("Nessun non letto")
|
: qsTr("Nessun non letto")
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.highlightColor
|
color: Theme.highlightColor
|
||||||
|
|||||||
+27
-35
@@ -1,31 +1,41 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
import "../js/dati.js" as Dati
|
|
||||||
|
|
||||||
// Cartelle: l'albero di Eudora (account -> cartelle -> sottocartelle)
|
// Cartelle: l'albero di Eudora (account -> cartelle -> sottocartelle)
|
||||||
// appiattito in una lista, con i non letti che risalgono fino all'account.
|
// appiattito in una lista, con i non letti che risalgono fino all'account.
|
||||||
|
// I dati arrivano dal motore (libgrumpydove.so) attraverso il bridge.
|
||||||
Page {
|
Page {
|
||||||
id: page
|
id: page
|
||||||
|
|
||||||
ListModel { id: cartelle }
|
ListModel { id: cartelle }
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: carica()
|
||||||
for (var i = 0; i < Dati.MAILBOXES.length; i++) {
|
|
||||||
var m = Dati.MAILBOXES[i];
|
// Le callback del motore arrivano quando il bridge le riceve: se la pagina
|
||||||
|
// e' gia' aperta, si ricarica qui.
|
||||||
|
Connections {
|
||||||
|
target: engine
|
||||||
|
onReady: page.carica()
|
||||||
|
}
|
||||||
|
|
||||||
|
function carica() {
|
||||||
|
cartelle.clear();
|
||||||
|
var elenco = engine.folders();
|
||||||
|
for (var i = 0; i < elenco.length; i++) {
|
||||||
|
var m = elenco[i];
|
||||||
cartelle.append({
|
cartelle.append({
|
||||||
nome: m.name,
|
folder: m.folder,
|
||||||
livello: m.depth,
|
nome: m.nome,
|
||||||
nonLetti: m.unread,
|
livello: m.livello,
|
||||||
tipo: m.kind,
|
nonLetti: m.nonLetti,
|
||||||
mailbox: m.mailbox
|
tipo: m.tipo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function apriCartella(nome, box) {
|
function apriCartella(folder, nome) {
|
||||||
if (box === "") return; // l'account non e' una cartella
|
|
||||||
pageStack.push(Qt.resolvedUrl("MessagesPage.qml"),
|
pageStack.push(Qt.resolvedUrl("MessagesPage.qml"),
|
||||||
{ cartella: box, titolo: nome });
|
{ cartella: folder, titolo: nome });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Le icone vengono dagli sprite dell'originale (icons/ di GrumpyDove,
|
// Le icone vengono dagli sprite dell'originale (icons/ di GrumpyDove,
|
||||||
@@ -50,13 +60,14 @@ Page {
|
|||||||
|
|
||||||
header: PageHeader {
|
header: PageHeader {
|
||||||
title: qsTr("Cartelle")
|
title: qsTr("Cartelle")
|
||||||
description: qsTr("%1 non letti").arg(Dati.totalUnread())
|
description: cartelle.count === 0 ? qsTr("In lettura...")
|
||||||
|
: qsTr("%1 non letti").arg(engine.totalUnread())
|
||||||
}
|
}
|
||||||
|
|
||||||
PullDownMenu {
|
PullDownMenu {
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Scarica la posta")
|
text: qsTr("Rileggi le cartelle")
|
||||||
onClicked: page.carica() // nel prototipo non fa nulla
|
onClicked: page.carica()
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Nuovo messaggio")
|
text: qsTr("Nuovo messaggio")
|
||||||
@@ -68,7 +79,7 @@ Page {
|
|||||||
id: riga
|
id: riga
|
||||||
|
|
||||||
height: Math.max(Theme.itemSizeMedium, etichetta.implicitHeight + Theme.paddingLarge)
|
height: Math.max(Theme.itemSizeMedium, etichetta.implicitHeight + Theme.paddingLarge)
|
||||||
onClicked: page.apriCartella(model.nome, model.mailbox)
|
onClicked: page.apriCartella(model.folder, model.nome)
|
||||||
|
|
||||||
// Rientro per profondita': la gerarchia si vede dall'icona.
|
// Rientro per profondita': la gerarchia si vede dall'icona.
|
||||||
Image {
|
Image {
|
||||||
@@ -122,23 +133,4 @@ Page {
|
|||||||
|
|
||||||
VerticalScrollDecorator { }
|
VerticalScrollDecorator { }
|
||||||
}
|
}
|
||||||
|
|
||||||
function carica() {
|
|
||||||
avviso.text = qsTr("Controllo la posta...")
|
|
||||||
avvisoTimer.restart()
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
id: avviso
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.bottomMargin: Theme.paddingLarge
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.highlightColor
|
|
||||||
}
|
|
||||||
Timer {
|
|
||||||
id: avvisoTimer
|
|
||||||
interval: 1500
|
|
||||||
onTriggered: avviso.text = ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+49
-29
@@ -1,32 +1,41 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
import "../js/dati.js" as Dati
|
|
||||||
|
|
||||||
// Lettura di un messaggio. Paginazione a tap: un tocco sul lato destro passa
|
// Lettura di un messaggio, dal motore. Paginazione a tap: un tocco sul lato
|
||||||
// al messaggio successivo, sul sinistro al precedente. Il corpo resta
|
// destro passa al successivo, sul sinistro al precedente; il corpo resta
|
||||||
// scorrevole al centro, cosi' i due gesti non si rubano.
|
// scorrevole al centro, cosi' i due gesti non si rubano.
|
||||||
Page {
|
Page {
|
||||||
id: page
|
id: page
|
||||||
|
|
||||||
property string cartella: "in"
|
property int cartella: -1
|
||||||
property int indice: 0
|
property int riga: 0
|
||||||
property string titolo: "In"
|
|
||||||
|
|
||||||
property var messaggio: ({})
|
|
||||||
property int totale: 0
|
property int totale: 0
|
||||||
|
|
||||||
|
property string mittente: ""
|
||||||
|
property string oggetto: ""
|
||||||
|
property string data: ""
|
||||||
|
property string indirizzo: ""
|
||||||
|
property string corpo: ""
|
||||||
|
|
||||||
Component.onCompleted: leggi()
|
Component.onCompleted: leggi()
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: engine
|
||||||
|
onReady: page.leggi()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Colonne del motore: 4 mittente, 5 data, 7 oggetto.
|
||||||
function leggi() {
|
function leggi() {
|
||||||
var lista = Dati.messagesOf(page.cartella);
|
if (page.cartella < 0) return;
|
||||||
page.totale = lista.length;
|
page.mittente = engine.cell(page.cartella, page.riga, 4);
|
||||||
page.messaggio = (page.indice >= 0 && page.indice < lista.length)
|
page.data = engine.cell(page.cartella, page.riga, 5);
|
||||||
? lista[page.indice] : ({});
|
page.oggetto = engine.cell(page.cartella, page.riga, 7);
|
||||||
avviso.text = "";
|
page.corpo = engine.body(page.cartella, page.riga);
|
||||||
|
page.totale = engine.messages(page.cartella).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
function vai(delta) {
|
function vai(delta) {
|
||||||
var nuovo = page.indice + delta;
|
var nuovo = page.riga + delta;
|
||||||
if (nuovo < 0 || nuovo >= page.totale) {
|
if (nuovo < 0 || nuovo >= page.totale) {
|
||||||
avviso.text = delta < 0 ? qsTr("Primo messaggio")
|
avviso.text = delta < 0 ? qsTr("Primo messaggio")
|
||||||
: qsTr("Ultimo messaggio");
|
: qsTr("Ultimo messaggio");
|
||||||
@@ -35,8 +44,7 @@ Page {
|
|||||||
}
|
}
|
||||||
pageStack.replace(Qt.resolvedUrl("MessagePage.qml"), {
|
pageStack.replace(Qt.resolvedUrl("MessagePage.qml"), {
|
||||||
cartella: page.cartella,
|
cartella: page.cartella,
|
||||||
indice: nuovo,
|
riga: nuovo
|
||||||
titolo: page.titolo
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,8 +54,8 @@ Page {
|
|||||||
|
|
||||||
PageHeader {
|
PageHeader {
|
||||||
id: intestazione
|
id: intestazione
|
||||||
title: page.messaggio.subject ? page.messaggio.subject : ""
|
title: page.oggetto
|
||||||
description: qsTr("%1 di %2").arg(page.indice + 1).arg(page.totale)
|
description: qsTr("%1 di %2").arg(page.riga + 1).arg(page.totale)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -61,21 +69,22 @@ Page {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: qsTr("Da: %1").arg(page.messaggio.sender ? page.messaggio.sender : "")
|
text: qsTr("Da: %1").arg(page.mittente)
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.highlightColor
|
color: Theme.highlightColor
|
||||||
truncationMode: TruncationMode.Fade
|
truncationMode: TruncationMode.Fade
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: page.messaggio.address ? page.messaggio.address : ""
|
visible: page.indirizzo.length > 0
|
||||||
|
text: page.indirizzo
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
color: Theme.secondaryColor
|
color: Theme.secondaryColor
|
||||||
truncationMode: TruncationMode.Fade
|
truncationMode: TruncationMode.Fade
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: qsTr("A: me — %1").arg(page.messaggio.date ? page.messaggio.date : "")
|
text: qsTr("A: me — %1").arg(page.data)
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
color: Theme.secondaryColor
|
color: Theme.secondaryColor
|
||||||
}
|
}
|
||||||
@@ -87,7 +96,7 @@ Page {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
text: page.messaggio.body ? page.messaggio.body : ""
|
text: page.corpo.length > 0 ? page.corpo : qsTr("(nessun testo)")
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
@@ -100,25 +109,36 @@ Page {
|
|||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Rispondi")
|
text: qsTr("Rispondi")
|
||||||
onClicked: pageStack.push(Qt.resolvedUrl("ComposePage.qml"),
|
onClicked: pageStack.push(Qt.resolvedUrl("ComposePage.qml"),
|
||||||
{ destinatario: page.messaggio.address,
|
{ destinatario: page.indirizzo,
|
||||||
oggetto: "Re: " + page.messaggio.subject })
|
oggetto: "Re: " + page.oggetto })
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Inoltra")
|
text: qsTr("Inoltra")
|
||||||
onClicked: pageStack.push(Qt.resolvedUrl("ComposePage.qml"),
|
onClicked: pageStack.push(Qt.resolvedUrl("ComposePage.qml"),
|
||||||
{ oggetto: "Fwd: " + page.messaggio.subject,
|
{ oggetto: "Fwd: " + page.oggetto,
|
||||||
corpo: page.messaggio.body })
|
corpo: page.corpo })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PushUpMenu {
|
PushUpMenu {
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Segna come non letto")
|
text: qsTr("Segna come non letto")
|
||||||
onClicked: { avviso.text = qsTr("Segnato non letto"); avvisoTimer.restart() }
|
onClicked: {
|
||||||
|
engine.markRead(page.cartella, page.riga, false);
|
||||||
|
avviso.text = qsTr("Segnato non letto");
|
||||||
|
avvisoTimer.restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Sposta in Trash")
|
text: qsTr("Sposta in Trash")
|
||||||
onClicked: { avviso.text = qsTr("Spostato in Trash"); avvisoTimer.restart() }
|
onClicked: {
|
||||||
|
if (engine.moveToTrash(page.cartella, page.riga)) {
|
||||||
|
pageStack.pop();
|
||||||
|
} else {
|
||||||
|
avviso.text = qsTr("Non e' stato possibile spostarlo");
|
||||||
|
avvisoTimer.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +196,7 @@ Page {
|
|||||||
}
|
}
|
||||||
Timer {
|
Timer {
|
||||||
id: avvisoTimer
|
id: avvisoTimer
|
||||||
interval: 1200
|
interval: 1400
|
||||||
onTriggered: avviso.text = ""
|
onTriggered: avviso.text = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+33
-53
@@ -1,52 +1,57 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
import "../js/dati.js" as Dati
|
|
||||||
|
|
||||||
// Lista messaggi della cartella. La riga non letta e' in grassetto con la
|
// Lista messaggi della cartella, letta dal motore. La riga non letta e' in
|
||||||
// barra a sinistra; data a destra; nessuna colonna, che su un telefono non
|
// grassetto con la barra a sinistra; data a destra; nessuna colonna, che su un
|
||||||
// ci sta: mittente sopra, oggetto sotto.
|
// telefono non ci sta: mittente sopra, oggetto sotto.
|
||||||
Page {
|
Page {
|
||||||
id: page
|
id: page
|
||||||
|
|
||||||
property string cartella: "in"
|
property int cartella: -1
|
||||||
property string titolo: "In"
|
property string titolo: ""
|
||||||
property bool soloNonLetti: false
|
property bool soloNonLetti: false
|
||||||
property string ordine: "data"
|
|
||||||
|
|
||||||
ListModel { id: messaggi }
|
ListModel { id: messaggi }
|
||||||
|
|
||||||
Component.onCompleted: carica()
|
Component.onCompleted: carica()
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: engine
|
||||||
|
onReady: page.carica()
|
||||||
|
}
|
||||||
|
|
||||||
function carica() {
|
function carica() {
|
||||||
messaggi.clear();
|
messaggi.clear();
|
||||||
var lista = Dati.messagesOf(page.cartella).slice();
|
if (page.cartella < 0) return;
|
||||||
if (page.ordine === "mittente") {
|
var elenco = engine.messages(page.cartella);
|
||||||
lista.sort(function (a, b) {
|
for (var i = 0; i < elenco.length; i++) {
|
||||||
return a.sender.toLowerCase() < b.sender.toLowerCase() ? -1 : 1;
|
var m = elenco[i];
|
||||||
});
|
if (page.soloNonLetti && !m.nonLetto) continue;
|
||||||
}
|
|
||||||
for (var i = 0; i < lista.length; i++) {
|
|
||||||
var m = lista[i];
|
|
||||||
if (page.soloNonLetti && !m.unread) continue;
|
|
||||||
messaggi.append({
|
messaggi.append({
|
||||||
mittente: m.sender,
|
riga: m.riga,
|
||||||
oggetto: m.subject,
|
mittente: m.mittente,
|
||||||
data: m.date,
|
oggetto: m.oggetto,
|
||||||
nonLetto: m.unread,
|
data: m.data,
|
||||||
|
nonLetto: m.nonLetto,
|
||||||
junk: m.junk,
|
junk: m.junk,
|
||||||
allegato: m.attachment,
|
allegato: m.allegato
|
||||||
indice: i
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// La navigazione sta qui, non nel delegate: nei delegate pageStack non
|
// La navigazione sta qui, non nel delegate: nei delegate pageStack non
|
||||||
// si risolve su Qt 5.6.
|
// si risolve su Qt 5.6.
|
||||||
function apri(indice) {
|
function apri(riga) {
|
||||||
|
var m = null;
|
||||||
|
for (var i = 0; i < messaggi.count; i++) {
|
||||||
|
if (messaggi.get(i).riga === riga) { m = messaggi.get(i); break; }
|
||||||
|
}
|
||||||
pageStack.push(Qt.resolvedUrl("MessagePage.qml"), {
|
pageStack.push(Qt.resolvedUrl("MessagePage.qml"), {
|
||||||
cartella: page.cartella,
|
cartella: page.cartella,
|
||||||
indice: indice,
|
riga: riga,
|
||||||
titolo: page.titolo
|
mittente: m ? m.mittente : "",
|
||||||
|
oggetto: m ? m.oggetto : "",
|
||||||
|
data: m ? m.data : ""
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,8 +68,8 @@ Page {
|
|||||||
|
|
||||||
PullDownMenu {
|
PullDownMenu {
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: qsTr("Scarica la posta")
|
text: qsTr("Rileggi la cartella")
|
||||||
onClicked: { page.carica(); avviso.text = qsTr("Aggiornato") ; avvisoTimer.restart() }
|
onClicked: page.carica()
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: page.soloNonLetti ? qsTr("Mostra tutti") : qsTr("Solo non letti")
|
text: page.soloNonLetti ? qsTr("Mostra tutti") : qsTr("Solo non letti")
|
||||||
@@ -72,22 +77,11 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PushUpMenu {
|
|
||||||
MenuItem {
|
|
||||||
text: qsTr("Ordina per data")
|
|
||||||
onClicked: { page.ordine = "data"; page.carica() }
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: qsTr("Ordina per mittente")
|
|
||||||
onClicked: { page.ordine = "mittente"; page.carica() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delegate: BackgroundItem {
|
delegate: BackgroundItem {
|
||||||
id: riga
|
id: riga
|
||||||
|
|
||||||
height: Math.max(Theme.itemSizeLarge, colonna.implicitHeight + Theme.paddingLarge)
|
height: Math.max(Theme.itemSizeLarge, colonna.implicitHeight + Theme.paddingLarge)
|
||||||
onClicked: page.apri(model.indice)
|
onClicked: page.apri(model.riga)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: Theme.paddingSmall / 3
|
width: Theme.paddingSmall / 3
|
||||||
@@ -164,18 +158,4 @@ Page {
|
|||||||
color: Theme.secondaryColor
|
color: Theme.secondaryColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
|
||||||
id: avviso
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.bottomMargin: Theme.paddingLarge
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.highlightColor
|
|
||||||
}
|
|
||||||
Timer {
|
|
||||||
id: avvisoTimer
|
|
||||||
interval: 1200
|
|
||||||
onTriggered: avviso.text = ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
Name: harbour-grumpydove
|
Name: harbour-grumpydove
|
||||||
Summary: Eudora-style mail interface, mobile prototype
|
Summary: Eudora-style mail interface, mobile prototype
|
||||||
Version: 0.1.2
|
Version: 0.2.0
|
||||||
Release: 1
|
Release: 1
|
||||||
Group: Qt/Qt
|
Group: Qt/Qt
|
||||||
# Codice EUPL-1.2; le icone vengono dagli sprite di Eudora, BSD 3-Clause
|
# Codice EUPL-1.2; le icone vengono dagli sprite di Eudora, BSD 3-Clause
|
||||||
@@ -27,6 +27,13 @@ Icons come from the original project's Eudora bitmaps (BSD 3-Clause,
|
|||||||
Computer History Museum).
|
Computer History Museum).
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Nov 11 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.2.0-1
|
||||||
|
- Il motore di GrumpyDove dentro l'app: libgrumpydove.so compilata per
|
||||||
|
aarch64, collegata al bridge C++ (engine/), con le librerie che Sailfish
|
||||||
|
non ha (libetpan, jansson, runtime Ada, gnutls, curl) incluse nel
|
||||||
|
pacchetto in /usr/share/harbour-grumpydove/lib
|
||||||
|
- Le schermate leggono le cartelle e i messaggi veri dal motore; i comandi
|
||||||
|
"segna come non letto" e "sposta in Trash" funzionano davvero
|
||||||
* Wed Nov 11 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.1.2-1
|
* Wed Nov 11 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.1.2-1
|
||||||
- Icone interne non visibili sul telefono: le immagini ora stanno nelle
|
- Icone interne non visibili sul telefono: le immagini ora stanno nelle
|
||||||
risorse compilate nel binario (images.qrc, source qrc:/images/...), cosi'
|
risorse compilate nel binario (images.qrc, source qrc:/images/...), cosi'
|
||||||
@@ -65,3 +72,4 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop || tr
|
|||||||
%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
|
%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
|
||||||
%{_datadir}/icons/hicolor/172x172/apps/%{name}.png
|
%{_datadir}/icons/hicolor/172x172/apps/%{name}.png
|
||||||
%{_datadir}/%{name}/qml
|
%{_datadir}/%{name}/qml
|
||||||
|
%{_datadir}/%{name}/lib
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
#include "enginebridge.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QVariantMap>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
EngineBridge *EngineBridge::s_instance = nullptr;
|
||||||
|
gd_folder_fn EngineBridge::s_folder = nullptr;
|
||||||
|
gd_open_fn EngineBridge::s_open = nullptr;
|
||||||
|
gd_cell_fn EngineBridge::s_cell = nullptr;
|
||||||
|
gd_body_fn EngineBridge::s_body = nullptr;
|
||||||
|
gd_can_hold_fn EngineBridge::s_unread = nullptr;
|
||||||
|
gd_read_fn EngineBridge::s_read = nullptr;
|
||||||
|
gd_id_of_fn EngineBridge::s_id_of = nullptr;
|
||||||
|
gd_move_fn EngineBridge::s_move = nullptr;
|
||||||
|
gd_commit_fn EngineBridge::s_commit = nullptr;
|
||||||
|
|
||||||
|
// Colonne del motore (enum Column di qt_shim.cpp)
|
||||||
|
enum Column { Status, Priority, Attachment, Label, Who, Date, Size, Subject, Junk };
|
||||||
|
|
||||||
|
EngineBridge::EngineBridge(QObject *parent) : QObject(parent) {}
|
||||||
|
|
||||||
|
EngineBridge *EngineBridge::instance() { return s_instance; }
|
||||||
|
void EngineBridge::setInstance(EngineBridge *b) { s_instance = b; }
|
||||||
|
|
||||||
|
void EngineBridge::keepCallbacks(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell,
|
||||||
|
gd_body_fn body, gd_can_hold_fn unread,
|
||||||
|
gd_read_fn mark_read, gd_id_of_fn id_of,
|
||||||
|
gd_move_fn move, gd_commit_fn commit)
|
||||||
|
{
|
||||||
|
s_folder = folder;
|
||||||
|
s_open = open;
|
||||||
|
s_cell = cell;
|
||||||
|
s_body = body;
|
||||||
|
s_unread = unread;
|
||||||
|
s_read = mark_read;
|
||||||
|
s_id_of = id_of;
|
||||||
|
s_move = move;
|
||||||
|
s_commit = commit;
|
||||||
|
if (s_instance) {
|
||||||
|
emit s_instance->ready();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EngineBridge::markRead(int folder, int row, bool read)
|
||||||
|
{
|
||||||
|
if (!s_read) return;
|
||||||
|
s_read(folder, row, read ? 1 : 0);
|
||||||
|
if (s_commit) s_commit(folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
// La Trash dell'account della cartella: il motore lavora per numeri di
|
||||||
|
// cartella, quindi si cerca la prima "Trash" che non sia un account.
|
||||||
|
static int trashIndex()
|
||||||
|
{
|
||||||
|
EngineBridge *b = EngineBridge::instance();
|
||||||
|
if (!b) return -1;
|
||||||
|
const QVariantList elenco = b->folders();
|
||||||
|
for (int i = 0; i < elenco.size(); i++) {
|
||||||
|
const QVariantMap m = elenco.at(i).toMap();
|
||||||
|
if (m.value("tipo").toString() == QLatin1String("trash"))
|
||||||
|
return m.value("folder").toInt();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EngineBridge::moveToTrash(int folder, int row)
|
||||||
|
{
|
||||||
|
const int target = trashIndex();
|
||||||
|
if (!s_move || !s_id_of || target < 0 || target == folder) return false;
|
||||||
|
const int id = s_id_of(folder, row);
|
||||||
|
if (id < 0) return false;
|
||||||
|
const bool ok = s_move(folder, id, target) != 0;
|
||||||
|
if (ok && s_commit) s_commit(folder);
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Una cella, come stringa UTF-8 letta dal motore.
|
||||||
|
QString EngineBridge::cell(int folder, int row, int column)
|
||||||
|
{
|
||||||
|
if (!s_cell) return QString();
|
||||||
|
char buf[2048];
|
||||||
|
int n = s_cell(folder, row, column, buf, int(sizeof buf) - 1);
|
||||||
|
if (n <= 0) return QString();
|
||||||
|
if (n > int(sizeof buf) - 1) n = int(sizeof buf) - 1;
|
||||||
|
return QString::fromUtf8(buf, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantList EngineBridge::folders()
|
||||||
|
{
|
||||||
|
QVariantList out;
|
||||||
|
if (!s_folder) return out;
|
||||||
|
char buf[512];
|
||||||
|
int depth = 0;
|
||||||
|
for (int i = 0; i < 200; i++) {
|
||||||
|
int n = s_folder(i, &depth, buf, int(sizeof buf) - 1);
|
||||||
|
if (n < 0) break;
|
||||||
|
if (n > int(sizeof buf) - 1) n = int(sizeof buf) - 1;
|
||||||
|
const QString nome = QString::fromUtf8(buf, n);
|
||||||
|
|
||||||
|
// Il tipo serve solo a scegliere l'icona: il motore non lo dice.
|
||||||
|
QString tipo = "cartella";
|
||||||
|
if (depth == 0) tipo = "account";
|
||||||
|
else if (nome == QLatin1String("In")) tipo = "in";
|
||||||
|
else if (nome == QLatin1String("Out")) tipo = "out";
|
||||||
|
else if (nome == QLatin1String("Junk")) tipo = "junk";
|
||||||
|
else if (nome == QLatin1String("Trash")) tipo = "trash";
|
||||||
|
|
||||||
|
QVariantMap m;
|
||||||
|
m["folder"] = i;
|
||||||
|
m["nome"] = nome;
|
||||||
|
m["livello"] = depth;
|
||||||
|
m["tipo"] = tipo;
|
||||||
|
m["nonLetti"] = s_unread ? s_unread(i) : 0;
|
||||||
|
out.append(m);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantList EngineBridge::messages(int folder)
|
||||||
|
{
|
||||||
|
QVariantList out;
|
||||||
|
if (!s_open || !s_cell) return out;
|
||||||
|
long total_k = 0;
|
||||||
|
if (s_open(folder, &total_k) == 0) return out;
|
||||||
|
|
||||||
|
// Quante righe: il motore non lo dice, si chiede finché risponde.
|
||||||
|
for (int row = 0; row < 2000; row++) {
|
||||||
|
const QString who = cell(folder, row, Who);
|
||||||
|
const QString subject = cell(folder, row, Subject);
|
||||||
|
if (who.isEmpty() && subject.isEmpty()) break;
|
||||||
|
|
||||||
|
QVariantMap m;
|
||||||
|
m["riga"] = row;
|
||||||
|
m["mittente"] = who;
|
||||||
|
m["oggetto"] = subject;
|
||||||
|
m["data"] = cell(folder, row, Date);
|
||||||
|
m["dimensione"] = cell(folder, row, Size);
|
||||||
|
m["nonLetto"] = !cell(folder, row, Status).isEmpty();
|
||||||
|
m["allegato"] = !cell(folder, row, Attachment).isEmpty();
|
||||||
|
m["junk"] = !cell(folder, row, Junk).isEmpty();
|
||||||
|
out.append(m);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString EngineBridge::body(int folder, int row)
|
||||||
|
{
|
||||||
|
if (!s_body) return QString();
|
||||||
|
char buf[65536];
|
||||||
|
int n = s_body(folder, row, buf, int(sizeof buf) - 1);
|
||||||
|
if (n <= 0) return QString();
|
||||||
|
if (n > int(sizeof buf) - 1) n = int(sizeof buf) - 1;
|
||||||
|
return QString::fromUtf8(buf, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
int EngineBridge::totalUnread()
|
||||||
|
{
|
||||||
|
if (!s_folder || !s_unread) return 0;
|
||||||
|
char buf[512];
|
||||||
|
int depth = 0;
|
||||||
|
int total = 0;
|
||||||
|
for (int i = 0; i < 200; i++) {
|
||||||
|
int n = s_folder(i, &depth, buf, int(sizeof buf) - 1);
|
||||||
|
if (n < 0) break;
|
||||||
|
if (depth == 0) total += s_unread(i); // gli account sommano già le cartelle
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
#ifndef ENGINEBRIDGE_H
|
||||||
|
#define ENGINEBRIDGE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariantList>
|
||||||
|
#include <QString>
|
||||||
|
#include "qt_shim.h"
|
||||||
|
|
||||||
|
// Ponte fra il motore di GrumpyDove e la QML.
|
||||||
|
//
|
||||||
|
// Il motore (libgrumpydove.so) chiama gd_run passando le sue callback: quelle
|
||||||
|
// vengono conservate qui e la QML le interroga. E' l'equivalente di qt_shim.cpp
|
||||||
|
// dell'originale, ridotto a quello che serve alla nostra interfaccia.
|
||||||
|
class EngineBridge : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit EngineBridge(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
static EngineBridge *instance();
|
||||||
|
static void setInstance(EngineBridge *b);
|
||||||
|
|
||||||
|
// Chiamata da gd_run: conserva le callback e avvisa la QML.
|
||||||
|
static void keepCallbacks(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell,
|
||||||
|
gd_body_fn body, gd_can_hold_fn unread,
|
||||||
|
gd_read_fn mark_read, gd_id_of_fn id_of,
|
||||||
|
gd_move_fn move, gd_commit_fn commit);
|
||||||
|
|
||||||
|
Q_INVOKABLE QVariantList folders();
|
||||||
|
Q_INVOKABLE QVariantList messages(int folder);
|
||||||
|
Q_INVOKABLE QString body(int folder, int row);
|
||||||
|
Q_INVOKABLE QString cell(int folder, int row, int column);
|
||||||
|
Q_INVOKABLE int totalUnread();
|
||||||
|
Q_INVOKABLE void markRead(int folder, int row, bool read);
|
||||||
|
Q_INVOKABLE bool moveToTrash(int folder, int row);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void ready();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static EngineBridge *s_instance;
|
||||||
|
static gd_folder_fn s_folder;
|
||||||
|
static gd_open_fn s_open;
|
||||||
|
static gd_cell_fn s_cell;
|
||||||
|
static gd_body_fn s_body;
|
||||||
|
static gd_can_hold_fn s_unread;
|
||||||
|
static gd_read_fn s_read;
|
||||||
|
static gd_id_of_fn s_id_of;
|
||||||
|
static gd_move_fn s_move;
|
||||||
|
static gd_commit_fn s_commit;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ENGINEBRIDGE_H
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
// Le funzioni che il motore si aspetta dalla vista (contratto di qt_shim.h),
|
||||||
|
// al posto di qt_shim.cpp: gd_run conserva le callback nel bridge e lascia
|
||||||
|
// girare il ciclo Qt, come faceva la vista dell'originale.
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include "enginebridge.h"
|
||||||
|
|
||||||
|
// Le tre funzioni devono essere visibili: a chiamarle e' la libreria del
|
||||||
|
// motore, e la build dell'app compila con -fvisibility=hidden (senza, il
|
||||||
|
// linker risponde "hidden symbol gd_single_instance ... referenced by DSO").
|
||||||
|
#pragma GCC visibility push(default)
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
int gd_single_instance(void)
|
||||||
|
{
|
||||||
|
// Su Sailfish l'app ne parte una sola: niente lock file.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gd_already_open(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int gd_run(gd_folder_fn folder, gd_open_fn open, gd_cell_fn cell,
|
||||||
|
gd_body_fn body, gd_sort_fn sort, gd_read_fn mark_read,
|
||||||
|
gd_id_of_fn id_of, gd_row_of_fn row_of, gd_move_fn move,
|
||||||
|
gd_commit_fn commit, gd_empty_fn empty, gd_log_fn log,
|
||||||
|
gd_set_fn priority, gd_set_fn label, gd_text_fn decrypt,
|
||||||
|
gd_text_fn sender, gd_text_fn key_of, gd_header_fn header,
|
||||||
|
gd_text_fn plain, gd_text_fn sheet, gd_compose_fn compose,
|
||||||
|
gd_filter_fn filter, gd_last_id_fn last_id,
|
||||||
|
gd_find_start_fn find_start, gd_find_poll_fn find_poll,
|
||||||
|
gd_find_cancel_fn find_cancel, gd_id_named_fn id_named,
|
||||||
|
gd_claim_fn claim, gd_send_done_fn send_done,
|
||||||
|
gd_send_start_fn send_start, gd_find_poll_fn send_poll,
|
||||||
|
gd_find_start_fn imap_start, gd_find_poll_fn imap_poll,
|
||||||
|
gd_absorb_fn absorb, gd_rescan_fn rescan, gd_shown_at_fn shown_at,
|
||||||
|
gd_can_hold_fn can_hold, gd_make_folder_fn make_folder,
|
||||||
|
gd_can_hold_fn can_change, gd_make_folder_fn change_folder,
|
||||||
|
gd_can_hold_fn forget, gd_can_hold_fn has_box,
|
||||||
|
gd_place_fn place, gd_find_start_fn imap_create,
|
||||||
|
gd_find_start_fn book_start, gd_find_poll_fn book_poll,
|
||||||
|
gd_place_fn book_list, gd_queue_sent_fn queue_sent, gd_text_fn html,
|
||||||
|
gd_text_fn images, gd_text_fn attachments, gd_text_fn path,
|
||||||
|
gd_can_hold_fn unread)
|
||||||
|
{
|
||||||
|
(void)sort; (void)mark_read; (void)id_of; (void)row_of; (void)move;
|
||||||
|
(void)commit; (void)empty; (void)log; (void)priority; (void)label;
|
||||||
|
(void)decrypt; (void)sender; (void)key_of; (void)header; (void)plain;
|
||||||
|
(void)sheet; (void)compose; (void)filter; (void)last_id;
|
||||||
|
(void)find_start; (void)find_poll; (void)find_cancel; (void)id_named;
|
||||||
|
(void)claim; (void)send_done; (void)send_start; (void)send_poll;
|
||||||
|
(void)imap_start; (void)imap_poll; (void)absorb; (void)rescan;
|
||||||
|
(void)shown_at; (void)can_hold; (void)make_folder; (void)can_change;
|
||||||
|
(void)change_folder; (void)forget; (void)has_box; (void)place;
|
||||||
|
(void)imap_create; (void)book_start; (void)book_poll; (void)book_list;
|
||||||
|
(void)queue_sent; (void)html; (void)images; (void)attachments;
|
||||||
|
(void)path;
|
||||||
|
|
||||||
|
EngineBridge::keepCallbacks(folder, open, cell, body, unread,
|
||||||
|
mark_read, id_of, move, commit);
|
||||||
|
return QCoreApplication::exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // extern "C"
|
||||||
|
|
||||||
|
#pragma GCC visibility pop
|
||||||
+17
-5
@@ -6,17 +6,23 @@
|
|||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <sailfishapp.h>
|
#include <sailfishapp.h>
|
||||||
|
|
||||||
// Prototipo dell'interfaccia: nessun motore, nessuna rete. I dati sono finti
|
#include "enginebridge.h"
|
||||||
// (qml/js/dati.js). Serve a valutare le schermate su un telefono vero.
|
|
||||||
|
// gd_engine_run: il main di GrumpyDove, esportato da libgrumpydove.so. Entra
|
||||||
|
// nel motore, che a sua volta chiama gd_run (enginecallbacks.cpp) e da lì il
|
||||||
|
// ciclo Qt: per questo la view si crea e si mostra prima, ma il loop lo
|
||||||
|
// comincia il motore.
|
||||||
|
extern "C" int gd_engine_run(void);
|
||||||
|
|
||||||
Q_DECL_EXPORT int main(int argc, char *argv[])
|
Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QGuiApplication *app = SailfishApp::application(argc, argv);
|
QGuiApplication *app = SailfishApp::application(argc, argv);
|
||||||
|
|
||||||
app->setOrganizationName(QStringLiteral("harbour"));
|
app->setOrganizationName(QStringLiteral("harbour"));
|
||||||
app->setApplicationName(QStringLiteral("grumpydove"));
|
app->setApplicationName(QStringLiteral("grumpydove"));
|
||||||
app->setApplicationVersion(QStringLiteral("0.1.2"));
|
app->setApplicationVersion(QStringLiteral("0.2.0"));
|
||||||
|
|
||||||
qDebug() << "harbour-grumpydove v0.1.2 build" << __DATE__ << __TIME__;
|
qDebug() << "harbour-grumpydove v0.2.0 build" << __DATE__ << __TIME__;
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
if (translator.load(QLocale(), QStringLiteral("harbour-grumpydove"),
|
if (translator.load(QLocale(), QStringLiteral("harbour-grumpydove"),
|
||||||
@@ -24,11 +30,17 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
|
|||||||
QStringLiteral("/usr/share/harbour-grumpydove/translations")))
|
QStringLiteral("/usr/share/harbour-grumpydove/translations")))
|
||||||
app->installTranslator(&translator);
|
app->installTranslator(&translator);
|
||||||
|
|
||||||
|
EngineBridge bridge;
|
||||||
|
EngineBridge::setInstance(&bridge);
|
||||||
|
|
||||||
QQuickView *view = SailfishApp::createView();
|
QQuickView *view = SailfishApp::createView();
|
||||||
|
view->rootContext()->setContextProperty(QStringLiteral("engine"), &bridge);
|
||||||
view->rootContext()->setContextProperty(QStringLiteral("appVersion"),
|
view->rootContext()->setContextProperty(QStringLiteral("appVersion"),
|
||||||
QCoreApplication::applicationVersion());
|
QCoreApplication::applicationVersion());
|
||||||
view->setSource(SailfishApp::pathTo(QStringLiteral("qml/harbour-grumpydove.qml")));
|
view->setSource(SailfishApp::pathTo(QStringLiteral("qml/harbour-grumpydove.qml")));
|
||||||
view->show();
|
view->show();
|
||||||
|
|
||||||
return app->exec();
|
// Da qui il controllo e' del motore; le pagine si riempiono quando il
|
||||||
|
// bridge segnala ready().
|
||||||
|
return gd_engine_run();
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user