2015-05-14 16:05:01 +00:00
/***************************************************************************
* Copyright ( C ) 2015 Marco Martin < mart @ kde . org > *
* *
* This program is free software ; you can redistribute it and / or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation ; either version 2 of the License , or *
* ( at your option ) any later version . *
* *
* This program is distributed in the hope that it will be useful , *
* but WITHOUT ANY WARRANTY ; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the *
* GNU General Public License for more details . *
* *
* You should have received a copy of the GNU General Public License *
* along with this program ; if not , write to the *
* Free Software Foundation , Inc . , *
* 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA . *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# include "homescreen.h"
# include "applicationlistmodel.h"
# include <QtQml>
# include <QDebug>
2019-09-04 16:39:31 +00:00
# include <QQuickItem>
2015-05-14 16:05:01 +00:00
HomeScreen : : HomeScreen ( QObject * parent , const QVariantList & args )
: Plasma : : Containment ( parent , args )
{
2019-09-04 16:39:31 +00:00
qmlRegisterUncreatableType < ApplicationListModel > ( " org.kde.phone.homescreen " , 1 , 0 , " ApplicationListModel " , QStringLiteral ( " Cannot create item of type ApplicationListModel " ) ) ;
2015-05-14 16:05:01 +00:00
setHasConfigurationInterface ( true ) ;
}
HomeScreen : : ~ HomeScreen ( )
2018-12-31 03:13:55 +00:00
= default ;
2015-05-14 16:05:01 +00:00
2019-09-16 17:13:52 +00:00
void HomeScreen : : configChanged ( )
{
Plasma : : Containment : : configChanged ( ) ;
if ( m_applicationListModel ) {
m_applicationListModel - > loadSettings ( ) ;
}
}
2015-05-14 16:05:01 +00:00
ApplicationListModel * HomeScreen : : applicationListModel ( )
{
2019-09-04 16:39:31 +00:00
if ( ! m_applicationListModel ) {
m_applicationListModel = new ApplicationListModel ( this ) ;
}
2015-05-14 16:05:01 +00:00
return m_applicationListModel ;
}
2019-09-04 16:39:31 +00:00
void HomeScreen : : stackBefore ( QQuickItem * item1 , QQuickItem * item2 )
{
if ( ! item1 | | ! item2 | | item1 - > parentItem ( ) ! = item2 - > parentItem ( ) ) {
return ;
}
item1 - > stackBefore ( item2 ) ;
}
void HomeScreen : : stackAfter ( QQuickItem * item1 , QQuickItem * item2 )
{
if ( ! item1 | | ! item2 | | item1 - > parentItem ( ) ! = item2 - > parentItem ( ) ) {
return ;
}
item1 - > stackAfter ( item2 ) ;
}
2015-05-14 16:05:01 +00:00
K_EXPORT_PLASMA_APPLET_WITH_JSON ( homescreen , HomeScreen , " metadata.json " )
# include "homescreen.moc"