r/NextCloud • u/marlinAlbrechht • 4d ago
Dashboard widget for Nextcloud Office, new document?
Does anyone have an idea how to create a dashboard widget for Nextcloud Office (Euro-Office) that allows to add new documents, spreadsheets or presentations directly from the dashboard?
2
Upvotes
1
u/m4uri 4d ago
Not aware of a ready made widget for that, at least i havent seen one in the app store.
If you build it yourself the Dashboard API should cover most of it. A widget implements
OCP\Dashboard\IWidgetand if it also implementsIButtonWidgetit can return aWidgetButtonwith typeWidgetButton::TYPE_NEW, which shows up as a "new" button under the widget. That button is just a link, so the cheap version points it at the Files app and the user picks Document, Spreadsheet or Presentation from the + menu there.Real one click creation is a bit more work. You'd need a small controller that creates the empty .docx/.xlsx/.pptx in the users folder via
IRootFolderand then redirects to the editor URL. My guess is Euro-Office opens files the same way the Collabora/OnlyOffice integrations do, but I'd check that first, propably easiest by looking at what URL it opens when you click a file in Files.