How ammar-elmesaly/prayertimes works
Project Type and Purpose
• This is a single-widget Plasma 6 application written in QML and JavaScript.
• Its sole purpose is to fetch daily prayer times from the Aladhan API (via Fahim Shahriar’s AdhanTimes code) and render them inside Plasma.
High-Level Components
A. Host Environment
– KDE Plasma 6 Shell
– Widget Engine (loads metadata.json and QML)
B. Widget Package
1. metadata.json
2. contents/
• config/
– config.qml (defines config keys & defaults)
– main.xml (layout of the Settings UI)
• ui/
– main.qml (root UI item, ties everything together)
– CompactRepresentation.qml (small form factor view)
– PrayerTimeBlock.qml (individual prayer time display)
– configGeneral.qml (in-widget settings panel)
C. Data & Logic
– AdhanTimes JavaScript code (embedded in QML)
– QNetworkAccessManager (QML HTTP requests)
– Local Configuration Storage (via KConfig)
D. External Service
– Aladhan.com Prayer Times API
Relationships & Data Flow
1. Plasma Shell → loads metadata.json
2. Widget Engine → instantiates QML (main.qml)
3. main.qml → reads user settings via config engine (config.qml XML file)
4. QML/JS Logic → uses AdhanTimes code + QNetworkAccessManager to call Aladhan API
5. API Response → parsed by JS → data model populated
6. UI Components (PrayerTimeBlock.qml, CompactRepresentation.qml) → consume model data → render on screen
7. User Interaction → configGeneral.qml updates settings → writes back via KConfig
Architectural Patterns & Design Principles
• Model-View separation: QML files define Views; JS/QNetwork calls supply the Model.
• Configuration Engine: KConfig-backed UI (config.qml + main.xml).
• Reuse & Extensibility: AdhanTimes code is imported, allowing easy swaps or extensions to other prayer-time sources.
Final Checklist
– [ ] Host environment (Plasma 6 Shell + Widget Engine)
– [ ] Widget package structure (metadata.json, contents/)
– [ ] UI components (with file-names)
– [ ] Configuration subsystem
– [ ] Data-fetching logic (AdhanTimes + QNetwork)
– [ ] External API endpoint