| 1 |
/* |
| 2 |
* Copyright 2015 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
import QtQuick 2.4 |
| 18 |
import Lomiri.Components |
| 19 |
|
| 20 |
/*! |
| 21 |
\internal |
| 22 |
\deprecated |
| 23 |
Older version of Sections to work around bug 1511839 |
| 24 |
(only for controlling sections via PageHeadSections). |
| 25 |
*/ |
| 26 |
StyledItem { |
| 27 |
id: sections |
| 28 |
styleName: "SectionsForPageHeadStyle" |
| 29 |
|
| 30 |
property list<Action> actions |
| 31 |
property var model: actions |
| 32 |
onModelChanged: { |
| 33 |
if (model && model.length > 3) { |
| 34 |
console.warn("PageHeadSections does not support more than 3 sections. Use PageHeader and Sections instead."); |
| 35 |
} |
| 36 |
} |
| 37 |
property int selectedIndex: model ? 0 : -1 |
| 38 |
onSelectedIndexChanged: { |
| 39 |
if ((selectedIndex >= 0) && (selectedIndex < model.length)) { |
| 40 |
if (model[selectedIndex].hasOwnProperty("trigger")) { |
| 41 |
model[selectedIndex].trigger(); |
| 42 |
} |
| 43 |
} |
| 44 |
} |
| 45 |
} |